Merge lp:~michael.nelson/launchpad/ppa-privatisation-test-refactor6 into lp:launchpad
- ppa-privatisation-test-refactor6
- Merge into devel
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Gary Poster | ||||
Approved revision: | not available | ||||
Merged at revision: | not available | ||||
Proposed branch: | lp:~michael.nelson/launchpad/ppa-privatisation-test-refactor6 | ||||
Merge into: | lp:launchpad | ||||
Prerequisite: | lp:~michael.nelson/launchpad/ppa-privatisation-test-refactor5 | ||||
Diff against target: |
750 lines (+158/-167) 6 files modified
lib/lp/soyuz/stories/soyuz/xx-private-builds.txt (+47/-77) lib/lp/soyuz/stories/soyuz/xx-queue-pages-delayed-copies.txt (+9/-9) lib/lp/soyuz/stories/webservice/xx-archive.txt (+28/-28) lib/lp/soyuz/stories/webservice/xx-archivedependency.txt (+18/-24) lib/lp/soyuz/stories/webservice/xx-binary-package-publishing.txt (+21/-10) lib/lp/soyuz/stories/webservice/xx-source-package-publishing.txt (+35/-19) |
||||
To merge this branch: | bzr merge lp:~michael.nelson/launchpad/ppa-privatisation-test-refactor6 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gary Poster (community) | Approve | ||
Review via email: mp+20227@code.launchpad.net |
Commit message
Ensures that the privacy of a PPA cannot be altered once it has published packages (and updates a gazillion tests that depended on being able to do just that)
Description of the change
Michael Nelson (michael.nelson) wrote : | # |
Gary Poster (gary) wrote : | # |
Hi Michael. These look like nice fixes.
I asked some questions on IRC to which you replied to my satisfaction. I'll include the log beneath for reference.
I did ask you to consider whether the duplicated code for private setup in xx-source-
Thank you!
Gary
Edited IRC log:
gary_poster: noodles775: why did you remove test_login.py?
noodles775: gary_poster: I didn't... a local diff between this pipe and the prev shows everything but the test_login.py.
noodles775: I was just trying to figure out what was going on with the MP.
gary_poster: noodles775: ok, I'll just clarify in the review that merging that removal is not ok, and leave you to handle the mechanism
noodles775: gary_poster: I'll merge RF into the initial pipe (there are 7 in total) and push it through and see if it's still there when the diff regenerates on the MP.
gary_poster: noodles775: ack, ok
salgado: gary_poster, noodles775, in my openid branch I added a test_new_login.py file and later removed test_login.py. then on a subsequent branch I renamed test_new_login.py to test_login.py. that, together with pipes, might have confused bzr?
noodles775: salgado: thanks for the info - I thought it may have been related to your branch I reviewed yesterday. If that's the case, pumping a fresh RF through my pipes should resolve the issue. (I hope)
gary_poster: noodles775: in xx-private-
gary_poster: thanks salgado
gary_poster: noodles775: also, in the previous section of the same file, why did the result change (5 of 17 results, and different values)? If explaining it takes too long, I'll accept "because of changes that have previously passed review"
gary_poster: but I'd like reassurance that you are confident of the change, at least
gary_poster: hm, I could understand an increase of 1, since we added the private p3a archive, but I don't understand 14 -> 17
noodles775: gary_poster: so, regarding your first question, 375ff, the test for authorised viewers seeing the builds in the history was moved to just below with the Frog builder.
noodles775: It looks like a lot less test-code because the Frog builder only has the one build in its history (it's not polluted with sample data :)).
gary_poster: noodles775: ah ok cool thanks
noodles775: gary_poster: and your second question is related, because previously cprov's ppa was switched to private (which is no longer allowed), and had a bunch of publishings.
noodles775: So the 14 -> 17 is because there are 3 packages in cprov's public archive (when it was private ,they did not show up).
Topic changed to "on call: adeuring,
noodles775: s/packages/builds of course.
gary_poster: noodles775: we ...
Preview Diff
1 | === modified file 'lib/lp/soyuz/stories/soyuz/xx-private-builds.txt' |
2 | --- lib/lp/soyuz/stories/soyuz/xx-private-builds.txt 2009-12-24 01:41:54 +0000 |
3 | +++ lib/lp/soyuz/stories/soyuz/xx-private-builds.txt 2010-02-26 15:44:20 +0000 |
4 | @@ -20,6 +20,7 @@ |
5 | >>> from zope.component import getUtility |
6 | >>> from canonical.launchpad.interfaces import ( |
7 | ... IBuilderSet, IPersonSet) |
8 | + >>> from lp.registry.interfaces.distribution import IDistributionSet |
9 | >>> from lp.soyuz.tests.test_publishing import ( |
10 | ... SoyuzTestPublisher) |
11 | >>> from lp.soyuz.interfaces.publishing import ( |
12 | @@ -29,14 +30,16 @@ |
13 | |
14 | >>> login("foo.bar@canonical.com") |
15 | >>> cprov = getUtility(IPersonSet).getByName("cprov") |
16 | - >>> cprov.archive.buildd_secret = "secret" |
17 | - >>> cprov.archive.private = True |
18 | + >>> ubuntu = getUtility(IDistributionSet).getByName('ubuntu') |
19 | + >>> cprov_private_ppa = factory.makeArchive( |
20 | + ... private=True, owner=cprov, name="p3a", |
21 | + ... distribution=ubuntu) |
22 | >>> test_publisher = SoyuzTestPublisher() |
23 | >>> test_publisher.prepareBreezyAutotest() |
24 | >>> private_source_pub = test_publisher.getPubSource( |
25 | ... status=PackagePublishingStatus.PUBLISHED, |
26 | ... sourcename='privacy-test', |
27 | - ... archive=cprov.archive) |
28 | + ... archive=cprov_private_ppa) |
29 | >>> [private_build] = private_source_pub.createMissingBuilds() |
30 | >>> frog = getUtility(IBuilderSet)['frog'] |
31 | >>> frog.builderok = True |
32 | @@ -105,7 +108,7 @@ |
33 | users: |
34 | |
35 | >>> anon_browser.open( |
36 | - ... "http://launchpad.dev/~cprov/+archive/ppa/+build/%s" % |
37 | + ... "http://launchpad.dev/~cprov/+archive/p3a/+build/%s" % |
38 | ... private_build.id) |
39 | Traceback (most recent call last): |
40 | ... |
41 | @@ -114,10 +117,10 @@ |
42 | But it is fine for authorised users: |
43 | |
44 | >>> cprov_browser.open( |
45 | - ... "http://launchpad.dev/~cprov/+archive/ppa/+build/%s" % |
46 | + ... "http://launchpad.dev/~cprov/+archive/p3a/+build/%s" % |
47 | ... private_build.id) |
48 | >>> print cprov_browser.url |
49 | - http://launchpad.dev/~cprov/+archive/ppa/+build/... |
50 | + http://launchpad.dev/~cprov/+archive/p3a/+build/... |
51 | |
52 | |
53 | == Builder history page == |
54 | @@ -130,7 +133,7 @@ |
55 | user is viewing it. |
56 | |
57 | The builder "bob" has lots of builds in the sample data, including some |
58 | -for cprov's private archive. We can visit bob's history page and see |
59 | +for cprov's public archive. We can visit bob's history page and see |
60 | what it shows a non-privileged user: |
61 | |
62 | >>> anon_browser.open("http://launchpad.dev/+builds/bob/+history") |
63 | @@ -141,63 +144,20 @@ |
64 | ... |
65 | hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE |
66 | ... |
67 | - i386 build of cdrkit 1.0 in ubuntu warty RELEASE |
68 | - ... |
69 | - i386 build of cdrkit 1.0 in ubuntu breezy-autotest RELEASE |
70 | - ... |
71 | - i386 build of foobar 1.0 in ubuntu warty RELEASE |
72 | - ... |
73 | - i386 build of netapplet 0.99.6-1 in ubuntu warty RELEASE |
74 | - ... |
75 | - 5 of 14 results |
76 | - ... |
77 | - |
78 | -Now visit the same page as an admin we can see that there are four more |
79 | -results in the total set of results with an extra "mozilla-firefox" |
80 | -build at the top of the first batch. |
81 | - |
82 | - >>> admin_browser.open("http://launchpad.dev/+builds/bob/+history") |
83 | - >>> [builds_list] = find_tags_by_class( |
84 | - ... admin_browser.contents, 'builds_list') |
85 | - >>> print extract_text(builds_list) |
86 | - Package: |
87 | - ... |
88 | - hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE |
89 | - ... |
90 | - hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE |
91 | - ... |
92 | - i386 build of pmount 0.1-1 in ubuntu warty RELEASE |
93 | - ... |
94 | - i386 build of cdrkit 1.0 in ubuntu breezy-autotest RELEASE |
95 | - ... |
96 | - i386 build of cdrkit 1.0 in ubuntu warty RELEASE |
97 | - ... |
98 | - 5 of 17 results |
99 | - ... |
100 | - |
101 | -If cprov browses the list he will also see his own builds in the list. |
102 | - |
103 | - >>> cprov_browser.open("http://launchpad.dev/+builds/bob/+history") |
104 | - >>> [builds_list] = find_tags_by_class( |
105 | - ... cprov_browser.contents, 'builds_list') |
106 | - >>> print extract_text(builds_list) |
107 | - Package: |
108 | - ... |
109 | - hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE |
110 | - ... |
111 | - hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE |
112 | - ... |
113 | - i386 build of pmount 0.1-1 in ubuntu warty RELEASE |
114 | - ... |
115 | - i386 build of cdrkit 1.0 in ubuntu breezy-autotest RELEASE |
116 | - ... |
117 | - i386 build of cdrkit 1.0 in ubuntu warty RELEASE |
118 | - ... |
119 | - 5 of 17 results |
120 | - ... |
121 | - |
122 | -"Frog" is currently building a private build but again the unauthorised user |
123 | -cannot see any of the private details. |
124 | + hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE |
125 | + ... |
126 | + i386 build of pmount 0.1-1 in ubuntu warty RELEASE |
127 | + ... |
128 | + i386 build of cdrkit 1.0 in ubuntu breezy-autotest RELEASE |
129 | + ... |
130 | + i386 build of cdrkit 1.0 in ubuntu warty RELEASE |
131 | + ... |
132 | + 5 of 17 results |
133 | + ... |
134 | + |
135 | + |
136 | +The builder "Frog" has only the one build created above. So viewing the |
137 | +history as an unauthorised user shows an empty history. |
138 | |
139 | >>> anon_browser.open("http://launchpad.dev/+builds/frog/+history") |
140 | >>> [builds_list] = find_tags_by_class( |
141 | @@ -207,7 +167,17 @@ |
142 | ... |
143 | No build records. |
144 | |
145 | -An authorised user will see the build however: |
146 | +Both admin and the owner of the build, cprov, can see the build in |
147 | +"Frog"'s build history. |
148 | + |
149 | + >>> admin_browser.open("http://launchpad.dev/+builds/frog/+history") |
150 | + >>> [builds_list] = find_tags_by_class( |
151 | + ... admin_browser.contents, 'builds_list') |
152 | + >>> print extract_text(builds_list) |
153 | + Package: |
154 | + ... |
155 | + i386 build of privacy-test 666 in ubuntutest breezy-autotest RELEASE |
156 | + ... |
157 | |
158 | >>> cprov_browser.open("http://launchpad.dev/+builds/frog/+history") |
159 | >>> [builds_list] = find_tags_by_class( |
160 | @@ -233,7 +203,7 @@ |
161 | ... |
162 | Name Processor Status |
163 | bob 386 Building i386 build of mozilla-firefox ... |
164 | - frog 386 Building i386 build of privacy-test ... [cprov/ppa] |
165 | + frog 386 Building i386 build of privacy-test ... [cprov/p3a] |
166 | ... |
167 | |
168 | Launchpad Buildd admins cannot see private builds. |
169 | @@ -255,7 +225,7 @@ |
170 | ... |
171 | Name Processor Status |
172 | bob 386 Building i386 build of mozilla-firefox ... |
173 | - frog 386 Building i386 build of privacy-test ... [cprov/ppa] |
174 | + frog 386 Building i386 build of privacy-test ... [cprov/p3a] |
175 | Updated on ... |
176 | |
177 | Anonymous users cannot see the private build: |
178 | @@ -282,7 +252,7 @@ |
179 | >>> from zope.security.interfaces import Unauthorized |
180 | >>> try: |
181 | ... anon_browser.open( |
182 | - ... "http://launchpad.dev/~cprov/+archive/ppa/+build/%s" % |
183 | + ... "http://launchpad.dev/~cprov/+archive/p3a/+build/%s" % |
184 | ... private_build.id) |
185 | ... except Unauthorized: |
186 | ... print "Got expected exception" |
187 | @@ -293,7 +263,7 @@ |
188 | >>> browser = setupBrowser(auth="Basic no-priv@canonical.com:test") |
189 | >>> try: |
190 | ... browser.open( |
191 | - ... "http://launchpad.dev/~cprov/+archive/ppa/+build/%s" % |
192 | + ... "http://launchpad.dev/~cprov/+archive/p3a/+build/%s" % |
193 | ... private_build.id) |
194 | ... except Unauthorized: |
195 | ... print "Got expected exception" |
196 | @@ -331,7 +301,7 @@ |
197 | ... |
198 | Name Processor Status |
199 | bob 386 Building i386 build of mozilla-firefox ... |
200 | - frog 386 Building i386 build of privacy-test 666 ... [cprov/ppa] |
201 | + frog 386 Building i386 build of privacy-test 666 ... [cprov/p3a] |
202 | ... |
203 | |
204 | Any other logged-in user will also see the build: |
205 | @@ -342,22 +312,22 @@ |
206 | ... |
207 | Name Processor Status |
208 | bob 386 Building i386 build of mozilla-firefox ... |
209 | - frog 386 Building i386 build of privacy-test 666 ... [cprov/ppa] |
210 | + frog 386 Building i386 build of privacy-test 666 ... [cprov/p3a] |
211 | ... |
212 | |
213 | Accessing the build page will now also work: |
214 | |
215 | >>> anon_browser.open( |
216 | - ... "http://launchpad.dev/~cprov/+archive/ppa/+build/%s" % |
217 | + ... "http://launchpad.dev/~cprov/+archive/p3a/+build/%s" % |
218 | ... private_build.id) |
219 | >>> print anon_browser.title |
220 | - PPA for Celso Providelo : Celso Providelo |
221 | + PPA named p3a for Celso Providelo : Celso Providelo |
222 | |
223 | >>> browser.open( |
224 | - ... "http://launchpad.dev/~cprov/+archive/ppa/+build/%s" % |
225 | + ... "http://launchpad.dev/~cprov/+archive/p3a/+build/%s" % |
226 | ... private_build.id) |
227 | >>> print browser.title |
228 | - PPA for Celso Providelo : Celso Providelo |
229 | + PPA named p3a for Celso Providelo : Celso Providelo |
230 | |
231 | When accessing the distroseries source package release page, the builds |
232 | portlet will display a link to the newly unembargoed build: |
233 | @@ -371,7 +341,7 @@ |
234 | breezy-autotest i386 Successfully built |
235 | |
236 | >>> print browser.getLink('i386').url |
237 | - http://launchpad.dev/~cprov/+archive/ppa/+build/... |
238 | + http://launchpad.dev/~cprov/+archive/p3a/+build/... |
239 | |
240 | Similarly, when accessing the distribution source package release page, |
241 | the main content will display a link to the newly unembargoed build: |
242 | @@ -384,4 +354,4 @@ |
243 | Breezy Badger Autotest: i386 |
244 | |
245 | >>> print browser.getLink('i386').url |
246 | - http://launchpad.dev/~cprov/+archive/ppa/+build/... |
247 | + http://launchpad.dev/~cprov/+archive/p3a/+build/... |
248 | |
249 | === modified file 'lib/lp/soyuz/stories/soyuz/xx-queue-pages-delayed-copies.txt' |
250 | --- lib/lp/soyuz/stories/soyuz/xx-queue-pages-delayed-copies.txt 2009-11-16 21:42:53 +0000 |
251 | +++ lib/lp/soyuz/stories/soyuz/xx-queue-pages-delayed-copies.txt 2010-02-26 15:44:20 +0000 |
252 | @@ -15,12 +15,12 @@ |
253 | >>> login('foo.bar@canonical.com') |
254 | >>> ubuntu = getUtility(IDistributionSet).getByName('ubuntu') |
255 | >>> cprov = getUtility(IPersonSet).getByName('cprov') |
256 | - >>> cprov.archive.buildd_secret = 'x' |
257 | - >>> cprov.archive.private = True |
258 | - >>> cprov.archive.require_virtualized = False |
259 | + >>> cprov_private_ppa = factory.makeArchive( |
260 | + ... private=True, owner=cprov, distribution=ubuntu, |
261 | + ... virtualized=False, name="p3a") |
262 | >>> stp = SoyuzTestPublisher() |
263 | >>> stp.prepareBreezyAutotest() |
264 | - >>> [bin_hppa, bin_i386] = stp.getPubBinaries(archive=cprov.archive) |
265 | + >>> [bin_hppa, bin_i386] = stp.getPubBinaries(archive=cprov_private_ppa) |
266 | >>> build = bin_hppa.binarypackagerelease.build |
267 | >>> breezy_autotest = ubuntu.getSeries('breezy-autotest') |
268 | >>> stp.addFakeChroots(breezy_autotest) |
269 | @@ -63,12 +63,12 @@ |
270 | >>> print extract_text( |
271 | ... first_tag_by_class(anon_browser.contents, |
272 | ... 'queue-%s' % delayed_copy.id)) |
273 | - Copied from PPA for Celso Providelo |
274 | + Copied from PPA named p3a for Celso Providelo |
275 | |
276 | The delayed-copy source archive is not linked, since the requester has |
277 | no permission to view it. |
278 | |
279 | - >>> anon_browser.getLink('PPA for Celso Providelo') |
280 | + >>> anon_browser.getLink('PPA named p3a for Celso Providelo') |
281 | Traceback (most recent call last): |
282 | ... |
283 | LinkNotFoundError |
284 | @@ -95,10 +95,10 @@ |
285 | >>> print extract_text( |
286 | ... first_tag_by_class(cprov_browser.contents, |
287 | ... 'queue-%s' % delayed_copy.id)) |
288 | - Copied from PPA for Celso Providelo |
289 | + Copied from PPA named p3a for Celso Providelo |
290 | |
291 | - >>> print cprov_browser.getLink('PPA for Celso Providelo').url |
292 | - http://launchpad.dev/~cprov/+archive/ppa |
293 | + >>> print cprov_browser.getLink('PPA named p3a for Celso Providelo').url |
294 | + http://launchpad.dev/~cprov/+archive/p3a |
295 | |
296 | When the delayed-copy is processed (moved to DONE queue) its contents |
297 | become available to everyone. |
298 | |
299 | === modified file 'lib/lp/soyuz/stories/webservice/xx-archive.txt' |
300 | --- lib/lp/soyuz/stories/webservice/xx-archive.txt 2010-02-02 12:04:19 +0000 |
301 | +++ lib/lp/soyuz/stories/webservice/xx-archive.txt 2010-02-26 15:44:20 +0000 |
302 | @@ -736,15 +736,14 @@ |
303 | |
304 | == Private archives == |
305 | |
306 | -Make Celso's PPA private and create a private source publication. |
307 | +Create a private PPA for Celso with a private source publication. |
308 | |
309 | >>> login('foo.bar@canonical.com') |
310 | - |
311 | - >>> cprov.archive.buildd_secret = 'boing' |
312 | - >>> cprov.archive.private = True |
313 | - |
314 | + >>> cprov_private_ppa_db = factory.makeArchive( |
315 | + ... private=True, owner=cprov, distribution=ubuntu_db, name="p3a", |
316 | + ... description="packages to help my friends.") |
317 | >>> private_publication = test_publisher.createSource( |
318 | - ... cprov.archive, 'foocomm', '1.0-1') |
319 | + ... cprov_private_ppa_db, 'foocomm', '1.0-1') |
320 | >>> private_publication.secure_record.status = ( |
321 | ... PackagePublishingStatus.PUBLISHED) |
322 | |
323 | @@ -760,28 +759,28 @@ |
324 | attributes are only exposed when the requestor has View permission in |
325 | the IArchive context, in this case only Celso has it. |
326 | |
327 | - >>> pprint_entry(user_webservice.get("/~cprov/+archive/ppa").jsonBody()) |
328 | - dependencies_collection_link: u'http://.../~cprov/+archive/ppa/dependencies' |
329 | + >>> pprint_entry(user_webservice.get("/~cprov/+archive/p3a").jsonBody()) |
330 | + dependencies_collection_link: u'http://.../~cprov/+archive/p3a/dependencies' |
331 | description: u'tag:launchpad.net:2008:redacted' |
332 | - displayname: u'PPA for Celso Providelo' |
333 | + displayname: u'PPA named p3a for Celso Providelo' |
334 | distribution_link: u'http://.../ubuntu' |
335 | - name: u'ppa' |
336 | + name: u'p3a' |
337 | owner_link: u'http://.../~cprov' |
338 | private: True |
339 | resource_type_link: u'http://.../#archive' |
340 | - self_link: u'http://.../~cprov/+archive/ppa' |
341 | + self_link: u'http://.../~cprov/+archive/p3a' |
342 | signing_key_fingerprint: u'tag:launchpad.net:2008:redacted' |
343 | |
344 | - >>> pprint_entry(cprov_webservice.get("/~cprov/+archive/ppa").jsonBody()) |
345 | - dependencies_collection_link: u'http://.../~cprov/+archive/ppa/dependencies' |
346 | + >>> pprint_entry(cprov_webservice.get("/~cprov/+archive/p3a").jsonBody()) |
347 | + dependencies_collection_link: u'http://.../~cprov/+archive/p3a/dependencies' |
348 | description: u'packages to help my friends.' |
349 | - displayname: u'PPA for Celso Providelo' |
350 | + displayname: u'PPA named p3a for Celso Providelo' |
351 | distribution_link: u'http://.../ubuntu' |
352 | - name: u'ppa' |
353 | + name: u'p3a' |
354 | owner_link: u'http://.../~cprov' |
355 | private: True |
356 | resource_type_link: u'http://.../#archive' |
357 | - self_link: u'http://.../~cprov/+archive/ppa' |
358 | + self_link: u'http://.../~cprov/+archive/p3a' |
359 | signing_key_fingerprint: u'ABCDEF0123456789ABCDDCBA0000111112345678' |
360 | |
361 | == Creating subscriptions to a (private) archive == |
362 | @@ -813,9 +812,10 @@ |
363 | First we'll subscribe mark to cprov's archive: |
364 | |
365 | >>> mark = webservice.get("/~mark").jsonBody() |
366 | - >>> cprov_archive = cprov_webservice.get("/~cprov/+archive/ppa").jsonBody() |
367 | + >>> cprov_private_ppa = cprov_webservice.get( |
368 | + ... "/~cprov/+archive/p3a").jsonBody() |
369 | >>> response = cprov_webservice.named_post( |
370 | - ... cprov_archive['self_link'], 'newSubscription', |
371 | + ... cprov_private_ppa['self_link'], 'newSubscription', |
372 | ... subscriber=mark['self_link']) |
373 | |
374 | >>> print response |
375 | @@ -823,20 +823,20 @@ |
376 | ... |
377 | |
378 | >>> print response.getHeader('Location') |
379 | - http://.../~cprov/+archive/ppa/+subscriptions/mark |
380 | + http://.../~cprov/+archive/p3a/+subscriptions/mark |
381 | |
382 | We publish a subset of the IArchiveSubscriber attributes. |
383 | |
384 | >>> new_subscription = cprov_webservice.get( |
385 | ... response.getHeader('Location')).jsonBody() |
386 | >>> pprint_entry(new_subscription) |
387 | - archive_link: u'http://api.launchpad.dev/beta/~cprov/+archive/ppa' |
388 | + archive_link: u'http://api.launchpad.dev/beta/~cprov/+archive/p3a' |
389 | date_created: ... |
390 | date_expires: None |
391 | description: None |
392 | registrant_link: u'http://api.launchpad.dev/beta/~cprov' |
393 | resource_type_link: u'http://api.launchpad.dev/beta/#archive_subscriber' |
394 | - self_link: u'http://api.launchpad.dev/beta/~cprov/+archive/ppa/+subscriptions/mark' |
395 | + self_link: u'http://api.../~cprov/+archive/p3a/+subscriptions/mark' |
396 | status: u'Active' |
397 | subscriber_link: u'http://api.launchpad.dev/beta/~mark' |
398 | |
399 | @@ -854,7 +854,7 @@ |
400 | |
401 | >>> response = user_webservice.named_post( |
402 | ... cprov_archive['self_link'], 'newSubscription', |
403 | - ... subscriber=cprov_archive['owner_link']) |
404 | + ... subscriber=cprov_private_ppa['owner_link']) |
405 | >>> print response |
406 | HTTP/1.1 401 Unauthorized |
407 | ... |
408 | @@ -863,13 +863,13 @@ |
409 | is already a current subscription: |
410 | |
411 | >>> response = cprov_webservice.named_post( |
412 | - ... cprov_archive['self_link'], 'newSubscription', |
413 | + ... cprov_private_ppa['self_link'], 'newSubscription', |
414 | ... subscriber=mark['self_link']) |
415 | >>> print response |
416 | HTTP/1.1 400 Bad Request |
417 | ... |
418 | AlreadySubscribed: Mark Shuttleworth already has a current subscription |
419 | - for 'PPA for Celso Providelo'. |
420 | + for 'PPA named p3a for Celso Providelo'. |
421 | |
422 | |
423 | == Modifying privacy == |
424 | @@ -904,7 +904,7 @@ |
425 | >>> print cprov_webservice.named_post( |
426 | ... ubuntu['main_archive_link'], 'syncSource', {}, |
427 | ... source_name='foocomm', version='1.0-1', to_pocket='release', |
428 | - ... from_archive=cprov_archive['self_link'], |
429 | + ... from_archive=cprov_private_ppa['self_link'], |
430 | ... to_series="hoary") |
431 | HTTP/1.1 200 Ok |
432 | ... |
433 | @@ -914,7 +914,7 @@ |
434 | |
435 | >>> login('foo.bar@canonical.com') |
436 | >>> subsequent_version = test_publisher.createSource( |
437 | - ... cprov.archive, 'foocomm', '1.0-2') |
438 | + ... cprov_private_ppa_db, 'foocomm', '1.0-2') |
439 | >>> subsequent_version.secure_record.status = ( |
440 | ... PackagePublishingStatus.PUBLISHED) |
441 | >>> logout() |
442 | @@ -922,7 +922,7 @@ |
443 | >>> print cprov_webservice.named_post( |
444 | ... ubuntu['main_archive_link'], 'syncSources', {}, |
445 | ... source_names=['foocomm'], to_pocket='release', |
446 | - ... from_archive=cprov_archive['self_link'], |
447 | + ... from_archive=cprov_private_ppa['self_link'], |
448 | ... to_series="hoary") |
449 | HTTP/1.1 200 Ok |
450 | ... |
451 | @@ -933,7 +933,7 @@ |
452 | >>> print cprov_webservice.named_post( |
453 | ... ubuntu['main_archive_link'], 'syncSource', {}, |
454 | ... source_name='foocomm', version='1.0-2', to_pocket='release', |
455 | - ... from_archive=cprov_archive['self_link'], |
456 | + ... from_archive=cprov_private_ppa['self_link'], |
457 | ... to_series="hoary") |
458 | HTTP/1.1 400 Bad Request |
459 | ... |
460 | |
461 | === modified file 'lib/lp/soyuz/stories/webservice/xx-archivedependency.txt' |
462 | --- lib/lp/soyuz/stories/webservice/xx-archivedependency.txt 2009-08-28 06:39:38 +0000 |
463 | +++ lib/lp/soyuz/stories/webservice/xx-archivedependency.txt 2010-02-26 15:44:20 +0000 |
464 | @@ -1,14 +1,15 @@ |
465 | = Archive dependencies = |
466 | |
467 | `ArchiveDependency` records represent build-dependencies between |
468 | -archives, and are exposed through the API. |
469 | +archives, and are exposed through the API. |
470 | |
471 | Most of the tests live in |
472 | lib/lp/soyuz/stories/webservice/xx-archive.txt. |
473 | |
474 | Firstly we need to set some things up: we need a PPA with a dependency. |
475 | We'll use Celso's PPA, and give it a custom dependency on the primary |
476 | -archive. |
477 | +archive, and then create a private PPA for Celso with a similar custom |
478 | +dependency. |
479 | |
480 | >>> import simplejson |
481 | >>> from zope.component import getUtility |
482 | @@ -22,14 +23,18 @@ |
483 | ... cprov_ppa_db.distribution.main_archive, |
484 | ... PackagePublishingPocket.RELEASE, |
485 | ... component=getUtility(IComponentSet)['universe']) |
486 | + >>> cprov_private_ppa_db = factory.makeArchive( |
487 | + ... private=True, owner=cprov_db, name="p3a", |
488 | + ... distribution=cprov_ppa_db.distribution, |
489 | + ... description="packages to help my friends.") |
490 | + >>> dep = cprov_private_ppa_db.addArchiveDependency( |
491 | + ... cprov_ppa_db.distribution.main_archive, |
492 | + ... PackagePublishingPocket.RELEASE, |
493 | + ... component=getUtility(IComponentSet)['universe']) |
494 | >>> logout() |
495 | |
496 | Any user can retrieve a public PPA's dependencies. |
497 | |
498 | - >>> login('foo.bar@canonical.com') |
499 | - >>> cprov_ppa_db.private = False |
500 | - >>> logout() |
501 | - |
502 | >>> print user_webservice.get( |
503 | ... '/~cprov/+archive/ppa/dependencies') |
504 | HTTP/1.1 200 Ok |
505 | @@ -40,18 +45,11 @@ |
506 | HTTP/1.1 200 Ok |
507 | ... |
508 | |
509 | -The dependencies of a private archive are private. Let's make |
510 | -Celso's PPA private. |
511 | - |
512 | - >>> login('foo.bar@canonical.com') |
513 | - >>> cprov_ppa_db.private = True |
514 | - >>> cprov_ppa_db.buildd_secret = 'foobar' |
515 | - >>> logout() |
516 | - |
517 | -Now our unprivileged user can't get a list of the dependencies. |
518 | +The dependencies of a private archive are private. Unprivileged users |
519 | +can't get a list of the dependencies. |
520 | |
521 | >>> print user_webservice.get( |
522 | - ... '/~cprov/+archive/ppa/dependencies') |
523 | + ... '/~cprov/+archive/p3a/dependencies') |
524 | HTTP/1.1 401 Unauthorized |
525 | ... |
526 | Unauthorized: (<Archive at ...>, 'dependencies', 'launchpad.View') |
527 | @@ -60,31 +58,27 @@ |
528 | Nor can said user craft a URL to a dependency. |
529 | |
530 | >>> print user_webservice.get( |
531 | - ... '/~cprov/+archive/ppa/+dependency/1') |
532 | + ... '/~cprov/+archive/p3a/+dependency/1') |
533 | HTTP/1.1 401 Unauthorized |
534 | ... |
535 | Unauthorized: (<Archive at ...>, 'getArchiveDependency', 'launchpad.View') |
536 | <BLANKLINE> |
537 | |
538 | -Celso can still see them if we grant private permissions, of course. |
539 | +Celso can see them if we grant private permissions, of course. |
540 | |
541 | >>> from canonical.launchpad.testing.pages import webservice_for_person |
542 | >>> from canonical.launchpad.webapp.interfaces import OAuthPermission |
543 | >>> cprov_webservice = webservice_for_person( |
544 | ... cprov_db, permission=OAuthPermission.WRITE_PRIVATE) |
545 | >>> print cprov_webservice.get( |
546 | - ... '/~cprov/+archive/ppa/dependencies') |
547 | + ... '/~cprov/+archive/p3a/dependencies') |
548 | HTTP/1.1 200 Ok |
549 | ... |
550 | >>> print cprov_webservice.get( |
551 | - ... '/~cprov/+archive/ppa/+dependency/1') |
552 | + ... '/~cprov/+archive/p3a/+dependency/1') |
553 | HTTP/1.1 200 Ok |
554 | ... |
555 | |
556 | - >>> login('foo.bar@canonical.com') |
557 | - >>> cprov_ppa_db.private = False |
558 | - >>> logout() |
559 | - |
560 | But even he can't write to a dependency. |
561 | |
562 | >>> mark_ppa = cprov_webservice.get( |
563 | |
564 | === modified file 'lib/lp/soyuz/stories/webservice/xx-binary-package-publishing.txt' |
565 | --- lib/lp/soyuz/stories/webservice/xx-binary-package-publishing.txt 2009-08-20 04:46:48 +0000 |
566 | +++ lib/lp/soyuz/stories/webservice/xx-binary-package-publishing.txt 2010-02-26 15:44:20 +0000 |
567 | @@ -90,26 +90,36 @@ |
568 | Security |
569 | ======== |
570 | |
571 | -When Celso's PPA becomes private ... |
572 | +Create a private PPA for Celso with some binaries. |
573 | |
574 | >>> login("foo.bar@canonical.com") |
575 | |
576 | >>> from zope.component import getUtility |
577 | >>> from lp.registry.interfaces.person import IPersonSet |
578 | - |
579 | - >>> cprov = getUtility(IPersonSet).getByName('cprov') |
580 | - >>> cprov.archive.buildd_secret = 'boing' |
581 | - >>> cprov.archive.private = True |
582 | - |
583 | - >>> transaction.commit() |
584 | - |
585 | + >>> from lp.registry.interfaces.distribution import IDistributionSet |
586 | + >>> from lp.soyuz.tests.test_publishing import ( |
587 | + ... SoyuzTestPublisher) |
588 | + >>> from lp.soyuz.interfaces.publishing import ( |
589 | + ... PackagePublishingStatus) |
590 | + >>> cprov_db = getUtility(IPersonSet).getByName('cprov') |
591 | + >>> ubuntu_db = getUtility(IDistributionSet).getByName('ubuntu') |
592 | + >>> cprov_private_ppa_db = factory.makeArchive( |
593 | + ... private=True, owner=cprov_db, name="p3a", |
594 | + ... distribution=ubuntu_db) |
595 | + >>> test_publisher = SoyuzTestPublisher() |
596 | + >>> test_publisher.prepareBreezyAutotest() |
597 | + >>> private_source_pub = test_publisher.getPubBinaries( |
598 | + ... status=PackagePublishingStatus.PUBLISHED, |
599 | + ... binaryname='privacy-test-bin', |
600 | + ... archive=cprov_private_ppa_db) |
601 | >>> logout() |
602 | |
603 | Only Celso (or anyone who participates on the PPA owner team) has |
604 | access to the PPA publications. |
605 | |
606 | + >>> cprov_private_ppa = webservice.get("/~cprov/+archive/p3a").jsonBody() |
607 | >>> cprov_bins_response = webservice.named_get( |
608 | - ... cprov_archive['self_link'], 'getPublishedBinaries') |
609 | + ... cprov_private_ppa['self_link'], 'getPublishedBinaries') |
610 | >>> print cprov_bins_response |
611 | HTTP/1.1 200 Ok |
612 | ... |
613 | @@ -117,7 +127,7 @@ |
614 | Any other user attempt would result in a 401 error. |
615 | |
616 | >>> response = user_webservice.named_get( |
617 | - ... cprov_archive['self_link'], 'getPublishedBinaries') |
618 | + ... cprov_private_ppa['self_link'], 'getPublishedBinaries') |
619 | >>> print response |
620 | HTTP/1.1 401 Unauthorized |
621 | ... |
622 | @@ -125,6 +135,7 @@ |
623 | If the user attempts to access the publication URL directly they will |
624 | also fail in their quest. |
625 | |
626 | + >>> pubs = cprov_bins_response.jsonBody() |
627 | >>> private_publication_url = pubs['entries'][0]['self_link'] |
628 | >>> response = user_webservice.get(private_publication_url) |
629 | >>> print response |
630 | |
631 | === modified file 'lib/lp/soyuz/stories/webservice/xx-source-package-publishing.txt' |
632 | --- lib/lp/soyuz/stories/webservice/xx-source-package-publishing.txt 2010-01-13 05:18:26 +0000 |
633 | +++ lib/lp/soyuz/stories/webservice/xx-source-package-publishing.txt 2010-02-26 15:44:20 +0000 |
634 | @@ -21,12 +21,12 @@ |
635 | >>> for pub in ppa.getPublishedSources(): |
636 | ... pub = removeSecurityProxy(pub) |
637 | ... pub.sourcepackagerelease.dscsigningkey = fake_signer |
638 | - >>> transaction.commit() |
639 | >>> logout() |
640 | |
641 | >>> cprov_archive = webservice.get("/~cprov/+archive/ppa").jsonBody() |
642 | - >>> pubs = webservice.named_get( |
643 | - ... cprov_archive['self_link'], 'getPublishedSources').jsonBody() |
644 | + >>> cprov_srcs_response = pubs = webservice.named_get( |
645 | + ... cprov_archive['self_link'], 'getPublishedSources') |
646 | + >>> pubs = cprov_srcs_response.jsonBody() |
647 | |
648 | >>> def print_publications(pubs): |
649 | ... for display_name in sorted( |
650 | @@ -150,7 +150,6 @@ |
651 | >>> for pub in ppa.getPublishedSources(): |
652 | ... pub = removeSecurityProxy(pub) |
653 | ... pub.sourcepackagerelease.dscsigningkey = None |
654 | - >>> transaction.commit() |
655 | >>> logout() |
656 | |
657 | Query the source again: |
658 | @@ -181,9 +180,9 @@ |
659 | Anonymous users can't remove packages. |
660 | |
661 | >>> response = webservice.named_post( |
662 | - ... package, 'requestDeletion', |
663 | + ... package, 'requestDeletion', |
664 | ... removal_comment="No longer needed") |
665 | - >>> print response |
666 | + >>> print response |
667 | HTTP/1.1 401 Unauthorized |
668 | ... |
669 | |
670 | @@ -194,12 +193,12 @@ |
671 | >>> logout() |
672 | >>> from canonical.launchpad.testing.pages import webservice_for_person |
673 | >>> from canonical.launchpad.webapp.interfaces import OAuthPermission |
674 | - >>> cprov_webservice = webservice_for_person(cprov, |
675 | + >>> cprov_webservice = webservice_for_person(cprov, |
676 | ... permission=OAuthPermission.WRITE_PUBLIC) |
677 | >>> response = cprov_webservice.named_post( |
678 | - ... package, 'requestDeletion', |
679 | + ... package, 'requestDeletion', |
680 | ... removal_comment="No longer needed") |
681 | - >>> print response |
682 | + >>> print response |
683 | HTTP/1.1 200 Ok |
684 | ... |
685 | |
686 | @@ -215,30 +214,46 @@ |
687 | Privacy |
688 | ======= |
689 | |
690 | -When Celso's PPA becomes private ... |
691 | +Create a private PPA for Celso with some binaries. |
692 | |
693 | >>> login("foo.bar@canonical.com") |
694 | |
695 | - >>> cprov_ppa.buildd_secret = 'boing' |
696 | - >>> cprov_ppa.private = True |
697 | - |
698 | - >>> transaction.commit() |
699 | - |
700 | + >>> from zope.component import getUtility |
701 | + >>> from lp.registry.interfaces.person import IPersonSet |
702 | + >>> from lp.registry.interfaces.distribution import IDistributionSet |
703 | + >>> from lp.soyuz.tests.test_publishing import ( |
704 | + ... SoyuzTestPublisher) |
705 | + >>> from lp.soyuz.interfaces.publishing import ( |
706 | + ... PackagePublishingStatus) |
707 | + >>> cprov_db = getUtility(IPersonSet).getByName('cprov') |
708 | + >>> ubuntu_db = getUtility(IDistributionSet).getByName('ubuntu') |
709 | + >>> cprov_private_ppa_db = factory.makeArchive( |
710 | + ... private=True, owner=cprov_db, name="p3a", |
711 | + ... distribution=ubuntu_db) |
712 | + >>> test_publisher = SoyuzTestPublisher() |
713 | + >>> test_publisher.prepareBreezyAutotest() |
714 | + >>> private_source_pub = test_publisher.getPubBinaries( |
715 | + ... status=PackagePublishingStatus.PUBLISHED, |
716 | + ... binaryname='privacy-test-bin', |
717 | + ... archive=cprov_private_ppa_db) |
718 | >>> logout() |
719 | |
720 | + |
721 | Only Celso (or anyone who participates on the PPA owner team) has |
722 | access to the PPA publications. |
723 | |
724 | - >>> cprov_srcs_response = webservice.named_get( |
725 | - ... cprov_archive['self_link'], 'getPublishedSources') |
726 | - >>> print cprov_srcs_response |
727 | + >>> cprov_private_ppa = webservice.get( |
728 | + ... "/~cprov/+archive/p3a").jsonBody() |
729 | + >>> cprov_srcs_response_private = webservice.named_get( |
730 | + ... cprov_private_ppa['self_link'], 'getPublishedSources') |
731 | + >>> print cprov_srcs_response_private |
732 | HTTP/1.1 200 Ok |
733 | ... |
734 | |
735 | Any other user attempt would result in a 401 error. |
736 | |
737 | >>> response = user_webservice.named_get( |
738 | - ... cprov_archive['self_link'], 'getPublishedSources') |
739 | + ... cprov_private_ppa['self_link'], 'getPublishedSources') |
740 | >>> print response |
741 | HTTP/1.1 401 Unauthorized |
742 | ... |
743 | @@ -246,6 +261,7 @@ |
744 | If the user attempts to access the publication URL directly they will |
745 | also fail in their quest. |
746 | |
747 | + >>> pubs = cprov_srcs_response_private.jsonBody() |
748 | >>> private_publication_url = pubs['entries'][0]['self_link'] |
749 | >>> response = user_webservice.get(private_publication_url) |
750 | >>> print response |
This is the sixth (and final!) branch in a series to refactor soyuz tests after fixing bug 506203.
The MP for the branch that actually fixed the bug is at:
https:/ /code.edge. launchpad. net/~michael. nelson/ launchpad/ 506203- ppa-privatisati on-check/ +merge/ 19415
The original fix ensures that the privacy of a PPA cannot be altered once it has packages published. Unfortunately most of our test infrastructure does exactly that (switches the privacy to do a few tests and then switches it back).
The complete test breakages are as follows: pastebin. ubuntu. com/378292/
http://
This branch fixes: builds. txt -t xx-queue- pages-delayed- copies. txt -t webservice/ xx-archive. txt -t xx-archivedepen dency.txt -t xx-binary- package- publishing. txt -t xx-source- package- publishing. txt
bin/test -vv -t xx-private-
Thanks.