Merge lp:~michael.nelson/launchpad/ppa-privatisation-test-refactor4 into lp:launchpad

Proposed by Michael Nelson
Status: Merged
Merged at revision: not available
Proposed branch: lp:~michael.nelson/launchpad/ppa-privatisation-test-refactor4
Merge into: lp:launchpad
Prerequisite: lp:~michael.nelson/launchpad/ppa-privatisation-test-refactor3
Diff against target: 891 lines (+159/-151)
8 files modified
lib/lp/soyuz/doc/archiveauthtoken.txt (+25/-25)
lib/lp/soyuz/doc/archivesubscriber.txt (+37/-34)
lib/lp/soyuz/doc/build.txt (+42/-50)
lib/lp/soyuz/doc/package-diff.txt (+5/-4)
lib/lp/soyuz/doc/sourcepackagerelease.txt (+3/-3)
lib/lp/soyuz/stories/ppa/xx-ppa-files.txt (+41/-30)
lib/lp/soyuz/tests/test_publishing.py (+3/-3)
lib/lp/testing/factory.py (+3/-2)
To merge this branch: bzr merge lp:~michael.nelson/launchpad/ppa-privatisation-test-refactor4
Reviewer Review Type Date Requested Status
Graham Binns (community) code Approve
Review via email: mp+19961@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Michael Nelson (michael.nelson) wrote :

This is the fourth 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-privatisation-check/+merge/19415

The 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:
http://pastebin.ubuntu.com/378292/

This branch fixes:

bin/test -vv -t archiveauthtoken.txt -t archivesubscriber.txt -t doc/build.txt -t package-diff.txt -t sourcepackagerelease.txt -t xx-ppa-files.txt

Thanks.

Revision history for this message
Graham Binns (gmb) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/soyuz/doc/archiveauthtoken.txt'
--- lib/lp/soyuz/doc/archiveauthtoken.txt 2009-05-06 20:53:05 +0000
+++ lib/lp/soyuz/doc/archiveauthtoken.txt 2010-02-26 15:38:20 +0000
@@ -7,13 +7,12 @@
77
8See also ArchiveSubscriber.txt.8See also ArchiveSubscriber.txt.
99
10Set cprov's PPA to be a private one:10First we create a private PPA for Joe.
1111
12 >>> login("foo.bar@canonical.com")12 >>> login("admin@canonical.com")
13 >>> from lp.registry.interfaces.person import IPersonSet13 >>> joe = factory.makePerson(name="joe", displayname="Joe Smith")
14 >>> cprov = getUtility(IPersonSet).getByName("cprov")14 >>> joe_private_ppa = factory.makeArchive(
15 >>> cprov.archive.buildd_secret = "secret"15 ... owner=joe, private=True)
16 >>> cprov.archive.private = True
17 >>> logout()16 >>> logout()
1817
19== Creating new tokens ==18== Creating new tokens ==
@@ -26,23 +25,24 @@
26though we do not yet have a subscription:25though we do not yet have a subscription:
2726
28 >>> login("test@canonical.com")27 >>> login("test@canonical.com")
28 >>> from lp.registry.interfaces.person import IPersonSet
29 >>> name12 = getUtility(IPersonSet).getByName("name12")29 >>> name12 = getUtility(IPersonSet).getByName("name12")
30 >>> new_token = cprov.archive.newAuthToken(name12)30 >>> new_token = joe_private_ppa.newAuthToken(name12)
31 Traceback (most recent call last):31 Traceback (most recent call last):
32 ...32 ...
33 Unauthorized: You do not have a subscription for33 Unauthorized: You do not have a subscription for
34 PPA for Celso Providelo.34 PPA for Joe Smith.
3535
36Create a subscription for name12 to cprov's archive:36Create a subscription for name12 to joe's archive:
3737
38 >>> login("celso.providelo@canonical.com")38 >>> login_person(joe)
39 >>> subscription_to_cprov_archive = cprov.archive.newSubscription(39 >>> subscription_to_joe_private_ppa = joe_private_ppa.newSubscription(
40 ... name12, cprov)40 ... name12, joe)
41 >>> login("test@canonical.com")41 >>> login("test@canonical.com")
4242
43Now try again to create a token as name12 - this time it works:43Now try again to create a token as name12 - this time it works:
4444
45 >>> token_with_random_string = cprov.archive.newAuthToken(name12)45 >>> token_with_random_string = joe_private_ppa.newAuthToken(name12)
4646
47By default the tokens are 20 characters long.47By default the tokens are 20 characters long.
4848
@@ -51,26 +51,26 @@
5151
52It is not possible to create a second token when one already exists:52It is not possible to create a second token when one already exists:
5353
54 >>> new_token = cprov.archive.newAuthToken(name12)54 >>> new_token = joe_private_ppa.newAuthToken(name12)
55 Traceback (most recent call last):55 Traceback (most recent call last):
56 ...56 ...
57 ArchiveSubscriptionError: Sample Person already has a token for57 ArchiveSubscriptionError: Sample Person already has a token for
58 PPA for Celso Providelo.58 PPA for Joe Smith.
5959
60So deactivate the old token so that we can create a new token:60So deactivate the old token so that we can create a new token:
6161
62 >>> login("celso.providelo@canonical.com")62 >>> login_person(joe)
63 >>> token_with_random_string.deactivate()63 >>> token_with_random_string.deactivate()
64 >>> login("test@canonical.com")64 >>> login("test@canonical.com")
6565
66We can also specify our own token for testing purposes:66We can also specify our own token for testing purposes:
6767
68 >>> new_token = cprov.archive.newAuthToken(name12, u"testtoken")68 >>> new_token = joe_private_ppa.newAuthToken(name12, u"testtoken")
6969
70The new token is returned and reflects the data:70The new token is returned and reflects the data:
7171
72 >>> print new_token.archive.displayname72 >>> print new_token.archive.displayname
73 PPA for Celso Providelo73 PPA for Joe Smith
7474
75 >>> print new_token.person.name75 >>> print new_token.person.name
76 name1276 name12
@@ -79,7 +79,7 @@
79 testtoken79 testtoken
8080
81 >>> print new_token.archive_url81 >>> print new_token.archive_url
82 http://name12:testtoken@private-ppa.launchpad.dev/cprov/ppa/ubuntu82 http://name12:testtoken@private-ppa.launchpad.dev/joe/ppa/...
8383
84Commit the new token to the database.84Commit the new token to the database.
8585
@@ -126,7 +126,7 @@
126126
127It's also possible to retrieve a set of all the tokens for an archive.127It's also possible to retrieve a set of all the tokens for an archive.
128128
129 >>> tokens = token_set.getByArchive(cprov.archive)129 >>> tokens = token_set.getByArchive(joe_private_ppa)
130 >>> print tokens.count()130 >>> print tokens.count()
131 1131 1
132132
@@ -153,7 +153,7 @@
153 ...153 ...
154 Unauthorized:...154 Unauthorized:...
155155
156 >>> login("celso.providelo@canonical.com")156 >>> login_person(joe)
157 >>> new_token.deactivate()157 >>> new_token.deactivate()
158158
159Deactivating sets the date_deactivated value.159Deactivating sets the date_deactivated value.
@@ -163,14 +163,14 @@
163163
164We can do this as an admin too:164We can do this as an admin too:
165165
166 >>> new_token = cprov.archive.newAuthToken(name12)166 >>> new_token = joe_private_ppa.newAuthToken(name12)
167 >>> login("admin@canonical.com")167 >>> login("admin@canonical.com")
168 >>> new_token.deactivate()168 >>> new_token.deactivate()
169169
170Deactivating a token stops it being returned from getByArchive(). The170Deactivating a token stops it being returned from getByArchive(). The
171previous count of 1 is now reduced to 0.171previous count of 1 is now reduced to 0.
172172
173 >>> token_set.getByArchive(cprov.archive).count()173 >>> token_set.getByArchive(joe_private_ppa).count()
174 0174 0
175175
176The IArchiveAuthTokenSet.getActiveTokenForArchiveAndPerson() method will176The IArchiveAuthTokenSet.getActiveTokenForArchiveAndPerson() method will
177177
=== modified file 'lib/lp/soyuz/doc/archivesubscriber.txt'
--- lib/lp/soyuz/doc/archivesubscriber.txt 2010-02-11 09:14:17 +0000
+++ lib/lp/soyuz/doc/archivesubscriber.txt 2010-02-26 15:38:20 +0000
@@ -61,7 +61,7 @@
61 Unauthorized:...61 Unauthorized:...
6262
63If we log in as cprov it will still not work because his archive is63If we log in as cprov it will still not work because his archive is
64currently public:64public:
6565
66 >>> login("celso.providelo@canonical.com")66 >>> login("celso.providelo@canonical.com")
67 >>> new_sub = cprov.archive.newSubscription(67 >>> new_sub = cprov.archive.newSubscription(
@@ -70,20 +70,22 @@
70 ...70 ...
71 ArchiveNotPrivate: Only private archives can have subscriptions.71 ArchiveNotPrivate: Only private archives can have subscriptions.
7272
73After ensuring cprov's archive is private, cprov can create a73If we create a private ppa for Celso, then he can create a
74subscription for joesmith:74subscription for joesmith:
7575
76 >>> login('foo.bar@canonical.com')76 >>> login('foo.bar@canonical.com')
77 >>> cprov.archive.buildd_secret = 'really secret'77 >>> cprov_private_ppa = factory.makeArchive(
78 >>> cprov.archive.private = True78 ... owner=cprov, distribution=cprov.archive.distribution,
79 ... private=True, name='p3a',
80 ... description="packages to help my friends.")
79 >>> login("celso.providelo@canonical.com")81 >>> login("celso.providelo@canonical.com")
80 >>> new_sub = cprov.archive.newSubscription(82 >>> new_sub = cprov_private_ppa.newSubscription(
81 ... joesmith, cprov, description=u"subscription for joesmith")83 ... joesmith, cprov, description=u"subscription for joesmith")
8284
83The new subscription is returned and reflects the data:85The new subscription is returned and reflects the data:
8486
85 >>> print new_sub.displayname87 >>> print new_sub.displayname
86 Joe Smith's access to PPA for Celso Providelo88 Joe Smith's access to PPA named p3a for Celso Providelo
8789
88 >>> print new_sub.registrant.name90 >>> print new_sub.registrant.name
89 cprov91 cprov
@@ -109,15 +111,15 @@
109 From: Celso Providelo <noreply@launchpad.net>111 From: Celso Providelo <noreply@launchpad.net>
110 To: joe@example.com112 To: joe@example.com
111 Reply-To: Celso Providelo <celso.providelo@canonical.com>113 Reply-To: Celso Providelo <celso.providelo@canonical.com>
112 Subject: PPA access granted for PPA for Celso Providelo114 Subject: PPA access granted for PPA named p3a for Celso Providelo
113 Hello Joe Smith,115 Hello Joe Smith,
114 <BLANKLINE>116 <BLANKLINE>
115 Launchpad: access to a private archive117 Launchpad: access to a private archive
116 --------------------------------------118 --------------------------------------
117 <BLANKLINE>119 <BLANKLINE>
118 Celso Providelo has granted you access to a private software archive120 Celso Providelo has granted you access to a private software archive
119 "PPA for Celso Providelo" (ppa:cprov/ppa), which is hosted by Launchpad121 "PPA named p3a for Celso Providelo" (ppa:cprov/p3a), which is hosted
120 and has the following description:122 by Launchpad and has the following description:
121 <BLANKLINE>123 <BLANKLINE>
122 packages to help my friends.124 packages to help my friends.
123 <BLANKLINE>125 <BLANKLINE>
@@ -143,21 +145,22 @@
143A subscription for a subscriber who already has a current subscription145A subscription for a subscriber who already has a current subscription
144cannot be created:146cannot be created:
145147
146 >>> new_sub = cprov.archive.newSubscription(148 >>> new_sub = cprov_private_ppa.newSubscription(
147 ... joesmith, cprov, description=u"subscription for joesmith")149 ... joesmith, cprov, description=u"subscription for joesmith")
148 Traceback (most recent call last):150 Traceback (most recent call last):
149 ...151 ...
150 AlreadySubscribed: Joe Smith already has a current subscription for152 AlreadySubscribed: Joe Smith already has a current subscription for
151 'PPA for Celso Providelo'.153 'PPA named p3a for Celso Providelo'.
152154
153155
154Add another subscription for the test user, this time to mark's ppa:156Add another subscription for the test user, this time to mark's ppa:
155157
156 >>> login("mark@example.com")158 >>> login("mark@example.com")
157 >>> mark = getUtility(IPersonSet).getByName("mark")159 >>> mark = getUtility(IPersonSet).getByName("mark")
158 >>> mark.archive.buildd_secret = "really secret"160 >>> mark_private_ppa = factory.makeArchive(
159 >>> mark.archive.private = True161 ... owner=mark, distribution=mark.archive.distribution,
160 >>> new_sub_to_mark_ppa = mark.archive.newSubscription(162 ... private=True, name='p3a')
163 >>> new_sub_to_mark_ppa = mark_private_ppa.newSubscription(
161 ... joesmith, mark, description=u"subscription for joesmith")164 ... joesmith, mark, description=u"subscription for joesmith")
162165
163 >>> print_emails()166 >>> print_emails()
@@ -167,7 +170,7 @@
167170
168And also a subscription for a Team:171And also a subscription for a Team:
169172
170 >>> new_team_sub_to_mark_ppa = mark.archive.newSubscription(173 >>> new_team_sub_to_mark_ppa = mark_private_ppa.newSubscription(
171 ... team_cprov, mark, description=u"Access for cprov team")174 ... team_cprov, mark, description=u"Access for cprov team")
172175
173 >>> print_emails()176 >>> print_emails()
@@ -219,7 +222,7 @@
219222
220 >>> print sub_set.getBySubscriber(223 >>> print sub_set.getBySubscriber(
221 ... new_sub.subscriber)[0].archive.displayname224 ... new_sub.subscriber)[0].archive.displayname
222 PPA for Celso Providelo225 PPA named p3a for Celso Providelo
223226
224 >>> print sub_set.getByArchive(new_sub.archive)[0].subscriber.name227 >>> print sub_set.getByArchive(new_sub.archive)[0].subscriber.name
225 joesmith228 joesmith
@@ -229,7 +232,7 @@
229232
230 >>> print sub_set.getBySubscriber(233 >>> print sub_set.getBySubscriber(
231 ... new_sub.subscriber, new_sub.archive)[0].archive.displayname234 ... new_sub.subscriber, new_sub.archive)[0].archive.displayname
232 PPA for Celso Providelo235 PPA named p3a for Celso Providelo
233236
234By default the getBySubscriber() and getByArchive() methods return237By default the getBySubscriber() and getByArchive() methods return
235all current subscriptions, most recently created first:238all current subscriptions, most recently created first:
@@ -238,10 +241,10 @@
238 >>> for subscription in sub_set.getBySubscriber(new_sub.subscriber):241 >>> for subscription in sub_set.getBySubscriber(new_sub.subscriber):
239 ... print subscription.archive.displayname242 ... print subscription.archive.displayname
240 ... print subscription.date_created.date()243 ... print subscription.date_created.date()
241 PPA for Celso Providelo 2009-02-26244 PPA named p3a for Celso Providelo 2009-02-26
242 PPA for Mark Shuttleworth 2009-02-22245 PPA named p3a for Mark Shuttleworth 2009-02-22
243246
244 >>> for subscription in sub_set.getByArchive(mark.archive):247 >>> for subscription in sub_set.getByArchive(mark_private_ppa):
245 ... print subscription.subscriber.displayname248 ... print subscription.subscriber.displayname
246 ... print subscription.date_created.date()249 ... print subscription.date_created.date()
247 Team Cprov 2009-02-24250 Team Cprov 2009-02-24
@@ -258,7 +261,7 @@
258261
259 >>> sub_set.getBySubscriber(new_sub.subscriber).count()262 >>> sub_set.getBySubscriber(new_sub.subscriber).count()
260 1263 1
261 >>> sub_set.getByArchive(mark.archive).count()264 >>> sub_set.getByArchive(mark_private_ppa).count()
262 1265 1
263266
264Unless we explicitly ask for all subscriptions - not just the current ones:267Unless we explicitly ask for all subscriptions - not just the current ones:
@@ -266,7 +269,7 @@
266 >>> sub_set.getBySubscriber(269 >>> sub_set.getBySubscriber(
267 ... new_sub.subscriber, current_only=False).count()270 ... new_sub.subscriber, current_only=False).count()
268 2271 2
269 >>> sub_set.getByArchive(mark.archive, current_only=False).count()272 >>> sub_set.getByArchive(mark_private_ppa, current_only=False).count()
270 2273 2
271274
272The getBySubscriber() method includes by default subscriptions for teams275The getBySubscriber() method includes by default subscriptions for teams
@@ -276,8 +279,8 @@
276 >>> for subscription in sub_set.getBySubscriber(joesmith):279 >>> for subscription in sub_set.getBySubscriber(joesmith):
277 ... print subscription.archive.displayname280 ... print subscription.archive.displayname
278 ... print subscription.description281 ... print subscription.description
279 PPA for Celso Providelo subscription for joesmith282 PPA named p3a for Celso Providelo subscription for joesmith
280 PPA for Mark Shuttleworth Access for cprov team283 PPA named p3a for Mark Shuttleworth Access for cprov team
281284
282Finally, many callsites of getBySubscriber() will be interested not only285Finally, many callsites of getBySubscriber() will be interested not only
283in each subscription of the subscriber, but also the generated286in each subscription of the subscriber, but also the generated
@@ -286,7 +289,7 @@
286289
287First create a token for joesmith's subscription for cprov's archive:290First create a token for joesmith's subscription for cprov's archive:
288291
289 >>> joesmith_token = cprov.archive.newAuthToken(joesmith, u"test_token")292 >>> joesmith_token = cprov_private_ppa.newAuthToken(joesmith, u"test_token")
290293
291Now print out all subscriptions with their tokens for joesmith:294Now print out all subscriptions with their tokens for joesmith:
292295
@@ -300,8 +303,8 @@
300 ... print token_text303 ... print token_text
301 >>> print_subscriptions_with_tokens(304 >>> print_subscriptions_with_tokens(
302 ... sub_set.getBySubscriberWithActiveToken(joesmith))305 ... sub_set.getBySubscriberWithActiveToken(joesmith))
303 PPA for Celso Providelo test_token306 PPA named p3a for Celso Providelo test_token
304 PPA for Mark Shuttleworth None307 PPA named p3a for Mark Shuttleworth None
305308
306Deactivated tokens are not included with the returned token for a309Deactivated tokens are not included with the returned token for a
307subscription:310subscription:
@@ -312,8 +315,8 @@
312315
313 >>> print_subscriptions_with_tokens(316 >>> print_subscriptions_with_tokens(
314 ... sub_set.getBySubscriberWithActiveToken(joesmith))317 ... sub_set.getBySubscriberWithActiveToken(joesmith))
315 PPA for Celso Providelo None318 PPA named p3a for Celso Providelo None
316 PPA for Mark Shuttleworth None319 PPA named p3a for Mark Shuttleworth None
317320
318== Amending Subscriptions ==321== Amending Subscriptions ==
319322
@@ -402,7 +405,7 @@
402 >>> for subscription in sub_set.getBySubscriber(joesmith):405 >>> for subscription in sub_set.getBySubscriber(joesmith):
403 ... print subscription.archive.displayname406 ... print subscription.archive.displayname
404 ... print subscription.description407 ... print subscription.description
405 PPA for Mark Shuttleworth Access for cprov team408 PPA named p3a for Mark Shuttleworth Access for cprov team
406409
407 >>> subscription = sub_set.getBySubscriber(joesmith).first()410 >>> subscription = sub_set.getBySubscriber(joesmith).first()
408411
@@ -419,7 +422,7 @@
419a separate subscription), then he will no longer be listed as a non-active422a separate subscription), then he will no longer be listed as a non-active
420subscriber for this subscription:423subscriber for this subscription:
421424
422 >>> joesmith_token = mark.archive.newAuthToken(joesmith)425 >>> joesmith_token = mark_private_ppa.newAuthToken(joesmith)
423 >>> for person in subscription.getNonActiveSubscribers():426 >>> for person in subscription.getNonActiveSubscribers():
424 ... print person.displayname427 ... print person.displayname
425 Celso Providelo428 Celso Providelo
@@ -433,7 +436,7 @@
433 ... displayname="Harry Smith",436 ... displayname="Harry Smith",
434 ... password="test",437 ... password="test",
435 ... email="harry@example.com")438 ... email="harry@example.com")
436 >>> subscription = mark.archive.newSubscription(439 >>> subscription = mark_private_ppa.newSubscription(
437 ... harrysmith, mark, description=u"subscription for joesmith")440 ... harrysmith, mark, description=u"subscription for joesmith")
438 >>> for person in subscription.getNonActiveSubscribers():441 >>> for person in subscription.getNonActiveSubscribers():
439 ... print person.displayname442 ... print person.displayname
@@ -443,7 +446,7 @@
443getNonActiveSubscribers will return an empty result set as he is now446getNonActiveSubscribers will return an empty result set as he is now
444"active".447"active".
445448
446 >>> harry_token = mark.archive.newAuthToken(harrysmith)449 >>> harry_token = mark_private_ppa.newAuthToken(harrysmith)
447 >>> print subscription.getNonActiveSubscribers().count()450 >>> print subscription.getNonActiveSubscribers().count()
448 0451 0
449452
@@ -453,7 +456,7 @@
453 >>> launchpad_devs = getUtility(IPersonSet).getByName('launchpad')456 >>> launchpad_devs = getUtility(IPersonSet).getByName('launchpad')
454 >>> ignored = launchpad_devs.addMember(457 >>> ignored = launchpad_devs.addMember(
455 ... team_cprov, mark, force_team_add=True)458 ... team_cprov, mark, force_team_add=True)
456 >>> subscription = mark.archive.newSubscription(459 >>> subscription = mark_private_ppa.newSubscription(
457 ... launchpad_devs, mark, description=u"LP team too")460 ... launchpad_devs, mark, description=u"LP team too")
458 >>> for person in subscription.getNonActiveSubscribers():461 >>> for person in subscription.getNonActiveSubscribers():
459 ... print person.displayname462 ... print person.displayname
460463
=== modified file 'lib/lp/soyuz/doc/build.txt'
--- lib/lp/soyuz/doc/build.txt 2010-02-10 11:21:41 +0000
+++ lib/lp/soyuz/doc/build.txt 2010-02-26 15:38:20 +0000
@@ -220,8 +220,9 @@
220storeUploadLog() upload the given content as a restricted file.220storeUploadLog() upload the given content as a restricted file.
221221
222 >>> login('foo.bar@canonical.com')222 >>> login('foo.bar@canonical.com')
223 >>> active_build.archive.buildd_secret = "secret"223 >>> original_archive = active_build.archive
224 >>> active_build.archive.private = True224 >>> private_ppa = factory.makeArchive(private=True)
225 >>> removeSecurityProxy(active_build).archive = private_ppa
225 >>> login(ANONYMOUS)226 >>> login(ANONYMOUS)
226227
227Simply changing the archive privacy after the 'upload_log' is stored228Simply changing the archive privacy after the 'upload_log' is stored
@@ -249,11 +250,11 @@
249 >>> print active_build.upload_log.restricted250 >>> print active_build.upload_log.restricted
250 True251 True
251252
252Restore ubuntu main archive state to not affect the rest of the tests.253Restore ubuntu main archive as the target to not affect the rest of the
254tests.
253255
254 >>> login('foo.bar@canonical.com')256 >>> login('foo.bar@canonical.com')
255 >>> active_build.archive.buildd_secret = ''257 >>> removeSecurityProxy(active_build).archive = original_archive
256 >>> active_build.archive.private = False
257 >>> login(ANONYMOUS)258 >>> login(ANONYMOUS)
258259
259Since ubuntu/warty is already released the failed build can't be260Since ubuntu/warty is already released the failed build can't be
@@ -770,38 +771,46 @@
770771
771 >>> login('foo.bar@canonical.com')772 >>> login('foo.bar@canonical.com')
772773
773Let's make cprov's archive private (and hence its builds become private):774Let's create a private PPA for cprov (and hence its builds become private):
774775
775 >>> from canonical.launchpad.interfaces import IPersonSet776 >>> from canonical.launchpad.interfaces import IPersonSet
776 >>> cprov = removeSecurityProxy(getUtility(IPersonSet).getByName('cprov'))777 >>> cprov = removeSecurityProxy(getUtility(IPersonSet).getByName('cprov'))
777 >>> cprov.archive.buildd_secret = "secret"778 >>> cprov_private_ppa = factory.makeArchive(
778 >>> cprov.archive.private = True779 ... owner=cprov, private=True, name='p3a',
779 >>> flush_database_updates()780 ... distribution=cprov.archive.distribution)
780
781The default set of builds with no user specified excludes private builds:
782
783 >>> from canonical.launchpad.interfaces import IBuilderSet781 >>> from canonical.launchpad.interfaces import IBuilderSet
784 >>> bob = getUtility(IBuilderSet)['bob']782 >>> bob = getUtility(IBuilderSet)['bob']
783 >>> binaries = test_publisher.getPubBinaries(
784 ... archive=cprov_private_ppa, builder=bob,
785 ... binaryname='privacycheck-bin')
786 >>> flush_database_updates()
787
788The default set of builds with no user specified excludes private builds:
789
785 >>> bob_builds = bob.getBuildRecords()790 >>> bob_builds = bob.getBuildRecords()
786 >>> print_build_details(bob_builds)791 >>> print_build_details(bob_builds)
787 ubuntu-team: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE792 ubuntu-team: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
793 cprov: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
794 cprov: i386 build of pmount 0.1-1 in ubuntu warty RELEASE
795 cprov: i386 build of cdrkit 1.0 in ubuntu breezy-autotest RELEASE
788 no-priv: i386 build of cdrkit 1.0 in ubuntu warty RELEASE796 no-priv: i386 build of cdrkit 1.0 in ubuntu warty RELEASE
789 ubuntu-team: i386 build of cdrkit 1.0 in ubuntu breezy-autotest RELEASE797 ubuntu-team: i386 build of cdrkit 1.0 in ubuntu breezy-autotest RELEASE
790 ...798 ...
791 ubuntu-team: i386 build of mozilla-firefox 0.9 in ubuntu warty RELEASE799 ubuntu-team: i386 build of mozilla-firefox 0.9 in ubuntu warty RELEASE
792 ubuntu-team: i386 build of mozilla-firefox 0.9 in ubuntu breezy-autotest 800 ubuntu-team: i386 build of mozilla-firefox 0.9 in ubuntu breezy-autotest
793 RELEASE801 RELEASE
794 802
795 >>> bob_builds.count()803 >>> bob_builds.count()
796 13804 16
797805
798If we include an admin user, we can see all the builds. Here, we get806If we include an admin user, we can see all the builds. Here, we get
799three additional private builds for cprov:807an additional private build for cprov:
800808
801 >>> from canonical.launchpad.interfaces import ILaunchpadCelebrities809 >>> from canonical.launchpad.interfaces import ILaunchpadCelebrities
802 >>> admin = getUtility(ILaunchpadCelebrities).admin810 >>> admin = getUtility(ILaunchpadCelebrities).admin
803 >>> bob_builds = bob.getBuildRecords(user=admin)811 >>> bob_builds = bob.getBuildRecords(user=admin)
804 >>> print_build_details(bob_builds)812 >>> print_build_details(bob_builds)
813 cprov: i386 build of privacycheck 666 in ubuntutest breezy-autotest...
805 ubuntu-team: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE814 ubuntu-team: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
806 cprov: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE815 cprov: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
807 cprov: i386 build of pmount 0.1-1 in ubuntu warty RELEASE816 cprov: i386 build of pmount 0.1-1 in ubuntu warty RELEASE
@@ -812,14 +821,15 @@
812 ubuntu-team: i386 build of mozilla-firefox 0.9 in ubuntu warty RELEASE821 ubuntu-team: i386 build of mozilla-firefox 0.9 in ubuntu warty RELEASE
813 ubuntu-team: i386 build of mozilla-firefox 0.9 in ubuntu breezy-autotest822 ubuntu-team: i386 build of mozilla-firefox 0.9 in ubuntu breezy-autotest
814 RELEASE823 RELEASE
815 824
816 >>> bob_builds.count()825 >>> bob_builds.count()
817 16826 17
818827
819Cprov can also see his own builds of course:828Cprov can also see his own builds of course:
820829
821 >>> bob_builds = bob.getBuildRecords(user=cprov)830 >>> bob_builds = bob.getBuildRecords(user=cprov)
822 >>> print_build_details(bob_builds)831 >>> print_build_details(bob_builds)
832 cprov: i386 build of privacycheck 666 in ubuntutest breezy-autotest...
823 ubuntu-team: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE833 ubuntu-team: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
824 cprov: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE834 cprov: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
825 cprov: i386 build of pmount 0.1-1 in ubuntu warty RELEASE835 cprov: i386 build of pmount 0.1-1 in ubuntu warty RELEASE
@@ -832,7 +842,7 @@
832 RELEASE842 RELEASE
833843
834 >>> bob_builds.count()844 >>> bob_builds.count()
835 16845 17
836846
837Buildd admins specifically are not allowed to see private builds, which will847Buildd admins specifically are not allowed to see private builds, which will
838be filtered from the list returned:848be filtered from the list returned:
@@ -844,6 +854,9 @@
844 >>> bob_builds = bob.getBuildRecords(user=buildd_admin)854 >>> bob_builds = bob.getBuildRecords(user=buildd_admin)
845 >>> print_build_details(bob_builds)855 >>> print_build_details(bob_builds)
846 ubuntu-team: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE856 ubuntu-team: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
857 cprov: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
858 cprov: i386 build of pmount 0.1-1 in ubuntu warty RELEASE
859 cprov: i386 build of cdrkit 1.0 in ubuntu breezy-autotest RELEASE
847 no-priv: i386 build of cdrkit 1.0 in ubuntu warty RELEASE860 no-priv: i386 build of cdrkit 1.0 in ubuntu warty RELEASE
848 ubuntu-team: i386 build of cdrkit 1.0 in ubuntu breezy-autotest RELEASE861 ubuntu-team: i386 build of cdrkit 1.0 in ubuntu breezy-autotest RELEASE
849 ...862 ...
@@ -852,7 +865,7 @@
852 RELEASE865 RELEASE
853866
854 >>> bob_builds.count()867 >>> bob_builds.count()
855 13868 16
856869
857You can filter on build state:870You can filter on build state:
858871
@@ -874,13 +887,6 @@
874 >>> bob_pmount_ok_builds.count()887 >>> bob_pmount_ok_builds.count()
875 4888 4
876889
877Restore cprov to non-private:
878
879 >>> login('foo.bar@canonical.com')
880 >>> removeSecurityProxy(cprov).archive.private = False
881 >>> flush_database_updates()
882 >>> login(ANONYMOUS)
883
884890
885== AssertionErrors in IBuild ==891== AssertionErrors in IBuild ==
886892
@@ -1169,26 +1175,12 @@
1169IBuild's content class is wrapped in a Zope security wrapper that prevents1175IBuild's content class is wrapped in a Zope security wrapper that prevents
1170access to private builds for unauthorised users.1176access to private builds for unauthorised users.
11711177
1172cprov's archive is private which makes its builds private. We'll add
1173an extra build that is not published anywhere but in his PPA.
1174
1175 >>> login('foo.bar@canonical.com')
1176 >>> test_publisher.prepareBreezyAutotest()
1177 >>> removeSecurityProxy(cprov).archive.private = True
1178 >>> private_source_pub = test_publisher.getPubSource(
1179 ... status=PackagePublishingStatus.PUBLISHED,
1180 ... sourcename='privacy-test',
1181 ... architecturehintlist='i386',
1182 ... archive=cprov.archive)
1183 >>> [private_build] = private_source_pub.createMissingBuilds()
1184 >>> private_build.builder = bob
1185 >>> flush_database_updates()
1186
1187Accessing the cprov builds when logged in as admin will see the records:1178Accessing the cprov builds when logged in as admin will see the records:
11881179
1180 >>> login('admin@canonical.com')
1189 >>> bob_builds = bob.getBuildRecords(user=admin)1181 >>> bob_builds = bob.getBuildRecords(user=admin)
1190 >>> print_build_details(bob_builds)1182 >>> print_build_details(bob_builds)
1191 cprov: i386 build of privacy-test 666 in ubuntutest breezy-autotest...1183 cprov: i386 build of privacycheck 666 in ubuntutest breezy-autotest...
1192 ubuntu-team: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE1184 ubuntu-team: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
1193 cprov: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE1185 cprov: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
1194 cprov: i386 build of pmount 0.1-1 in ubuntu warty RELEASE1186 cprov: i386 build of pmount 0.1-1 in ubuntu warty RELEASE
@@ -1200,7 +1192,7 @@
1200 >>> login('celso.providelo@canonical.com')1192 >>> login('celso.providelo@canonical.com')
1201 >>> bob_builds = bob.getBuildRecords(user=admin)1193 >>> bob_builds = bob.getBuildRecords(user=admin)
1202 >>> print_build_details(bob_builds)1194 >>> print_build_details(bob_builds)
1203 cprov: i386 build of privacy-test 666 in ubuntutest breezy-autotest...1195 cprov: i386 build of privacycheck 666 in ubuntutest breezy-autotest...
1204 ubuntu-team: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE1196 ubuntu-team: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
1205 cprov: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE1197 cprov: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
1206 cprov: i386 build of pmount 0.1-1 in ubuntu warty RELEASE1198 cprov: i386 build of pmount 0.1-1 in ubuntu warty RELEASE
@@ -1446,10 +1438,10 @@
14461438
1447== Getting the build records for a particular builder ==1439== Getting the build records for a particular builder ==
14481440
1449The getBuildsForBuilder method returns all the builds for the 1441The getBuildsForBuilder method returns all the builds for the
1450specified builder ID, ordered from most-recently built.1442specified builder ID, ordered from most-recently built.
14511443
1452 Create some source packages with which to test the 1444 Create some source packages with which to test the
1453 getBuildsForBuilder method:1445 getBuildsForBuilder method:
14541446
1455 >>> src_pkg_earlier = test_publisher.getPubSource(1447 >>> src_pkg_earlier = test_publisher.getPubSource(
@@ -1459,7 +1451,7 @@
1459 ... status=PackagePublishingStatus.PUBLISHED,1451 ... status=PackagePublishingStatus.PUBLISHED,
1460 ... sourcename='laterbuildsrc',1452 ... sourcename='laterbuildsrc',
1461 ... architecturehintlist='hppa i386')1453 ... architecturehintlist='hppa i386')
1462 1454
1463 Create the builds based on the source packages, with the builds1455 Create the builds based on the source packages, with the builds
1464 for 'earlierbuildsrc' built one day before the 'laterbuildsrc':1456 for 'earlierbuildsrc' built one day before the 'laterbuildsrc':
14651457
@@ -1474,10 +1466,10 @@
1474 >>> later_builds = src_pkg_later.createMissingBuilds()1466 >>> later_builds = src_pkg_later.createMissingBuilds()
1475 >>> for build in later_builds:1467 >>> for build in later_builds:
1476 ... build.datebuilt = eg_build_date1468 ... build.datebuilt = eg_build_date
1477 1469
1478 Ensure that the i386 builds are created by the 'frog' builder,1470 Ensure that the i386 builds are created by the 'frog' builder,
1479 while the hppa builds are created by 'bob' the builder:1471 while the hppa builds are created by 'bob' the builder:
1480 1472
1481 >>> builds = earlier_builds + later_builds1473 >>> builds = earlier_builds + later_builds
1482 >>> for build in builds:1474 >>> for build in builds:
1483 ... if build.processor.name == u'386':1475 ... if build.processor.name == u'386':
@@ -1487,7 +1479,7 @@
14871479
1488 A call to getBuildsForBuilder returns only those builds that were1480 A call to getBuildsForBuilder returns only those builds that were
1489 built by the specified builder, ordered by datebuilt DESC:1481 built by the specified builder, ordered by datebuilt DESC:
1490 1482
1491 >>> frog_builds = getUtility(IBuildSet).getBuildsForBuilder(1483 >>> frog_builds = getUtility(IBuildSet).getBuildsForBuilder(
1492 ... frog_builder.id)1484 ... frog_builder.id)
1493 >>> print_build_details(frog_builds)1485 >>> print_build_details(frog_builds)
14941486
=== modified file 'lib/lp/soyuz/doc/package-diff.txt'
--- lib/lp/soyuz/doc/package-diff.txt 2009-12-13 11:55:40 +0000
+++ lib/lp/soyuz/doc/package-diff.txt 2010-02-26 15:38:20 +0000
@@ -732,11 +732,12 @@
732 >>> print diff.diff_content.restricted732 >>> print diff.diff_content.restricted
733 False733 False
734734
735When we make FooBar's PPA private, the diff becomes 'private' and the735If the diff is attached to a private PPA, the diff becomes 'private' and
736new 'diff_content' is stored in the restricted librarian instance.736the new 'diff_content' is stored in the restricted librarian instance.
737737
738 >>> diff.to_source.upload_archive.buildd_secret = 'nhack!'738 >>> private_ppa = factory.makeArchive(private=True)
739 >>> diff.to_source.upload_archive.private = True739 >>> from zope.security.proxy import removeSecurityProxy
740 >>> removeSecurityProxy(diff.to_source).upload_archive = private_ppa
740741
741 >>> print diff.private742 >>> print diff.private
742 True743 True
743744
=== modified file 'lib/lp/soyuz/doc/sourcepackagerelease.txt'
--- lib/lp/soyuz/doc/sourcepackagerelease.txt 2009-12-10 11:42:07 +0000
+++ lib/lp/soyuz/doc/sourcepackagerelease.txt 2010-02-26 15:38:20 +0000
@@ -265,11 +265,11 @@
265 >>> cprov = getUtility(IPersonSet).getByName('cprov')265 >>> cprov = getUtility(IPersonSet).getByName('cprov')
266266
267 >>> login('foo.bar@canonical.com')267 >>> login('foo.bar@canonical.com')
268 >>> cprov.archive.buildd_secret = 'boing'268 >>> cprov_private_ppa = factory.makeArchive(
269 >>> cprov.archive.private = True269 ... owner=cprov, private=True)
270270
271 >>> private_publication = test_publisher.getPubSource(271 >>> private_publication = test_publisher.getPubSource(
272 ... archive=cprov.archive)272 ... archive=cprov_private_ppa)
273273
274 >>> test_sourcepackagerelease = private_publication.sourcepackagerelease274 >>> test_sourcepackagerelease = private_publication.sourcepackagerelease
275 >>> print test_sourcepackagerelease.title275 >>> print test_sourcepackagerelease.title
276276
=== modified file 'lib/lp/soyuz/stories/ppa/xx-ppa-files.txt'
--- lib/lp/soyuz/stories/ppa/xx-ppa-files.txt 2010-01-20 14:29:59 +0000
+++ lib/lp/soyuz/stories/ppa/xx-ppa-files.txt 2010-02-26 15:38:20 +0000
@@ -15,12 +15,15 @@
15 ... SoyuzTestPublisher)15 ... SoyuzTestPublisher)
16 >>> from lp.registry.interfaces.person import IPersonSet16 >>> from lp.registry.interfaces.person import IPersonSet
1717
18Make the PPA private.18Create a private PPA for no-priv.
1919
20 >>> login('foo.bar@canonical.com')20 >>> login('foo.bar@canonical.com')
21 >>> no_priv = getUtility(IPersonSet).getByName('no-priv')21 >>> no_priv = getUtility(IPersonSet).getByName('no-priv')
22 >>> no_priv.archive.buildd_secret = 'x'22 >>> from lp.registry.interfaces.distribution import IDistributionSet
23 >>> no_priv.archive.private = True23 >>> ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
24 >>> no_priv_private_ppa = factory.makeArchive(
25 ... owner=no_priv, private=True, name='p3a',
26 ... distribution=ubuntu)
2427
25Initialise SoyuzTestPublisher.28Initialise SoyuzTestPublisher.
2629
@@ -31,7 +34,7 @@
31Publish a source.34Publish a source.
3235
33 >>> test_source = test_publisher.getPubSource(36 >>> test_source = test_publisher.getPubSource(
34 ... archive=no_priv.archive, sourcename='test-pkg',37 ... archive=no_priv_private_ppa, sourcename='test-pkg',
35 ... version='1.0')38 ... version='1.0')
36 >>> dsc_file = test_source.sourcepackagerelease.files[0].libraryfile39 >>> dsc_file = test_source.sourcepackagerelease.files[0].libraryfile
3740
@@ -68,10 +71,12 @@
68Create a subsequent source publication so a package diff can be provided.71Create a subsequent source publication so a package diff can be provided.
6972
70 >>> another_test_source = test_publisher.getPubSource(73 >>> another_test_source = test_publisher.getPubSource(
71 ... archive=no_priv.archive, sourcename='test-pkg',74 ... archive=no_priv_private_ppa, sourcename='test-pkg',
72 ... version='1.1')75 ... version='1.1')
73 >>> another_dsc_file = (76 >>> another_dsc_file = (
74 ... another_test_source.sourcepackagerelease.files[0].libraryfile)77 ... another_test_source.sourcepackagerelease.files[0].libraryfile)
78 >>> other_binary_pubs = test_publisher.getPubBinaries(
79 ... binaryname='test-bin', pub_source=another_test_source)
7580
76 >>> package_diff = test_source.sourcepackagerelease.requestDiffTo(81 >>> package_diff = test_source.sourcepackagerelease.requestDiffTo(
77 ... no_priv, another_test_source.sourcepackagerelease)82 ... no_priv, another_test_source.sourcepackagerelease)
@@ -145,26 +150,26 @@
145 >>> no_priv_browser = setupBrowser(150 >>> no_priv_browser = setupBrowser(
146 ... auth='Basic no-priv@canonical.com:test')151 ... auth='Basic no-priv@canonical.com:test')
147 >>> no_priv_browser.open(152 >>> no_priv_browser.open(
148 ... "http://launchpad.dev/~no-priv/+archive/ppa/+packages")153 ... "http://launchpad.dev/~no-priv/+archive/p3a/+packages")
149154
150 >>> print no_priv_browser.title155 >>> print no_priv_browser.title
151 Packages in “PPA for No Privileges Person”...156 Packages in “PPA named p3a for No Privileges Person”...
152157
153Source changesfiles are served on the PPA '+files' traversal.158Source changesfiles are served on the PPA '+files' traversal.
154159
155 >>> check_urls(no_priv_browser, ppa_links,160 >>> check_urls(no_priv_browser, ppa_links,
156 ... 'http://launchpad.dev/~no-priv/+archive/ppa')161 ... 'http://launchpad.dev/~no-priv/+archive/p3a')
157 test-pkg_1.1_source.changes: OK162 test-pkg_1.1_source.changes: OK
158163
159 >>> no_priv_browser.getLink('Copy packages').click()164 >>> no_priv_browser.getLink('Copy packages').click()
160 >>> check_urls(no_priv_browser, ppa_links,165 >>> check_urls(no_priv_browser, ppa_links,
161 ... 'http://launchpad.dev/~no-priv/+archive/ppa')166 ... 'http://launchpad.dev/~no-priv/+archive/p3a')
162 test-pkg_1.1_source.changes: OK167 test-pkg_1.1_source.changes: OK
163168
164 >>> no_priv_browser.getLink('Cancel').click()169 >>> no_priv_browser.getLink('Cancel').click()
165 >>> no_priv_browser.getLink('Delete packages').click()170 >>> no_priv_browser.getLink('Delete packages').click()
166 >>> check_urls(no_priv_browser, ppa_links,171 >>> check_urls(no_priv_browser, ppa_links,
167 ... 'http://launchpad.dev/~no-priv/+archive/ppa')172 ... 'http://launchpad.dev/~no-priv/+archive/p3a')
168 test-pkg_1.1_source.changes: OK173 test-pkg_1.1_source.changes: OK
169174
170Buildlogs are served on the Build '+files' traversal, when the PPA175Buildlogs are served on the Build '+files' traversal, when the PPA
@@ -176,11 +181,11 @@
176 >>> no_priv_browser.getControl("Filter").click()181 >>> no_priv_browser.getControl("Filter").click()
177182
178 >>> check_urls(no_priv_browser, builds_links,183 >>> check_urls(no_priv_browser, builds_links,
179 ... 'http://launchpad.dev/~no-priv/+archive/ppa/+build/31')184 ... 'http://launchpad.dev/~no-priv/+archive/p3a/+build/31')
180 buildlog_ubuntu-breezy-autotest-i386.test-pkg_1.0_FULLYBUILT.txt.gz: OK185 buildlog_ubuntu-breezy-autotest-i386.test-pkg_1.0_FULLYBUILT.txt.gz: OK
181186
182 >>> no_priv_browser.open(187 >>> no_priv_browser.open(
183 ... 'http://launchpad.dev/~no-priv/+archive/ppa/+packages')188 ... 'http://launchpad.dev/~no-priv/+archive/p3a/+packages')
184189
185Source and binary files, in the expandable-row area, are served via190Source and binary files, in the expandable-row area, are served via
186the PPA '+files' traversal.191the PPA '+files' traversal.
@@ -190,7 +195,7 @@
190 >>> no_priv_browser.getLink(id=expander_id).click()195 >>> no_priv_browser.getLink(id=expander_id).click()
191196
192 >>> check_urls(no_priv_browser, ppa_1_0_links,197 >>> check_urls(no_priv_browser, ppa_1_0_links,
193 ... 'http://launchpad.dev/~no-priv/+archive/ppa')198 ... 'http://launchpad.dev/~no-priv/+archive/p3a')
194 test-pkg_1.0.dsc: OK199 test-pkg_1.0.dsc: OK
195 test-pkg_1.0.tar.gz: OK200 test-pkg_1.0.tar.gz: OK
196 test-bin_1.0_all.deb: OK201 test-bin_1.0_all.deb: OK
@@ -200,10 +205,10 @@
200205
201 >>> no_priv_browser.getLink('i386').click()206 >>> no_priv_browser.getLink('i386').click()
202 >>> print no_priv_browser.title207 >>> print no_priv_browser.title
203 PPA for No Privileges Person : No Privileges Person208 PPA named p3a for No Privileges Person : No Privileges Person
204209
205 >>> check_urls(no_priv_browser, build_links,210 >>> check_urls(no_priv_browser, build_links,
206 ... 'http://launchpad.dev/~no-priv/+archive/ppa/+build/31')211 ... 'http://launchpad.dev/~no-priv/+archive/p3a/+build/31')
207 test-bin_1.0_i386.changes: OK212 test-bin_1.0_i386.changes: OK
208 buildlog_...txt.gz: OK213 buildlog_...txt.gz: OK
209 upload_..._log.txt: OK214 upload_..._log.txt: OK
@@ -212,14 +217,14 @@
212'+files' traversal.217'+files' traversal.
213218
214 >>> no_priv_browser.open(219 >>> no_priv_browser.open(
215 ... "http://launchpad.dev/~no-priv/+archive/ppa/+packages")220 ... "http://launchpad.dev/~no-priv/+archive/p3a/+packages")
216221
217 >>> expander_id = find_tags_by_class(222 >>> expander_id = find_tags_by_class(
218 ... no_priv_browser.contents, 'expander')[0]['id']223 ... no_priv_browser.contents, 'expander')[0]['id']
219 >>> no_priv_browser.getLink(id=expander_id).click()224 >>> no_priv_browser.getLink(id=expander_id).click()
220225
221 >>> check_urls(no_priv_browser, ppa_1_1_links,226 >>> check_urls(no_priv_browser, ppa_1_1_links,
222 ... 'http://launchpad.dev/~no-priv/+archive/ppa')227 ... 'http://launchpad.dev/~no-priv/+archive/p3a')
223 test-pkg_1.1.dsc: OK228 test-pkg_1.1.dsc: OK
224 test-pkg_1.0_1.1.diff.gz: OK229 test-pkg_1.0_1.1.diff.gz: OK
225230
@@ -230,7 +235,7 @@
230 >>> file_size = str(dsc_file.content.filesize)235 >>> file_size = str(dsc_file.content.filesize)
231 >>> file_mimetype = dsc_file.mimetype236 >>> file_mimetype = dsc_file.mimetype
232 >>> file_lp_url = str(237 >>> file_lp_url = str(
233 ... 'http://launchpad.dev/~no-priv/+archive/ppa/+files/%s' %238 ... 'http://launchpad.dev/~no-priv/+archive/p3a/+files/%s' %
234 ... dsc_file.filename)239 ... dsc_file.filename)
235 >>> logout()240 >>> logout()
236241
@@ -271,13 +276,13 @@
271 >>> buildlog_content = buildlog.read()276 >>> buildlog_content = buildlog.read()
272 >>> buildlog_size = str(buildlog.content.filesize)277 >>> buildlog_size = str(buildlog.content.filesize)
273 >>> buildlog_lp_url = str(278 >>> buildlog_lp_url = str(
274 ... 'http://launchpad.dev/~no-priv/+archive/ppa/+build/%d/+files/%s' %279 ... 'http://launchpad.dev/~no-priv/+archive/p3a/+build/%d/+files/%s' %
275 ... (build.id, buildlog.filename))280 ... (build.id, buildlog.filename))
276281
277 >>> diff_content = package_diff.diff_content.read()282 >>> diff_content = package_diff.diff_content.read()
278 >>> diff_size = str(package_diff.diff_content.content.filesize)283 >>> diff_size = str(package_diff.diff_content.content.filesize)
279 >>> diff_lp_url = str(284 >>> diff_lp_url = str(
280 ... 'http://launchpad.dev/~no-priv/+archive/ppa/+files/%s' %285 ... 'http://launchpad.dev/~no-priv/+archive/p3a/+files/%s' %
281 ... package_diff.diff_content.filename)286 ... package_diff.diff_content.filename)
282287
283 >>> logout()288 >>> logout()
@@ -321,19 +326,25 @@
321 >>> print no_priv_browser.headers['content-encoding']326 >>> print no_priv_browser.headers['content-encoding']
322 gzip327 gzip
323328
324When the PPA and the `LibraryFileAlias` become public, the +files/329If the associated PPA and the `LibraryFileAlias` are public, the +files/
325proxy redirects to the public http url.330proxy redirects to the public http url. We'll copy the test sources and
326331binaries across to no-priv's public ppa.
327 >>> login('foo.bar@canonical.com')332
328333 >>> login_person(no_priv)
329 >>> no_priv = getUtility(IPersonSet).getByName('no-priv')334 >>> from lp.soyuz.scripts.packagecopier import do_copy
330 >>> no_priv.archive.buildd_secret = ''335 >>> from lp.soyuz.interfaces.publishing import PackagePublishingPocket
331 >>> no_priv.archive.private = False336 >>> copies = do_copy(
337 ... no_priv_private_ppa.getPublishedSources(name='test-pkg'),
338 ... no_priv.archive, series=ubuntu['warty'],
339 ... pocket=PackagePublishingPocket.RELEASE,
340 ... include_binaries=True, allow_delayed_copies=False)
332341
333 >>> from zope.security.proxy import removeSecurityProxy342 >>> from zope.security.proxy import removeSecurityProxy
334 >>> removeSecurityProxy(dsc_file).restricted = False343 >>> removeSecurityProxy(dsc_file).restricted = False
335
336 >>> file_librarian_url = dsc_file.http_url344 >>> file_librarian_url = dsc_file.http_url
345 >>> file_lp_url = str(
346 ... 'http://launchpad.dev/~no-priv/+archive/ppa/+files/%s' %
347 ... dsc_file.filename)
337348
338 >>> commit()349 >>> commit()
339 >>> logout()350 >>> logout()
@@ -372,7 +383,7 @@
372The same redirection happens for +archive/+build/blah urls:383The same redirection happens for +archive/+build/blah urls:
373384
374 >>> buildlog_lp_url_without_ppa_name = buildlog_lp_url.replace(385 >>> buildlog_lp_url_without_ppa_name = buildlog_lp_url.replace(
375 ... '/ppa', '')386 ... '/p3a', '')
376 >>> print buildlog_lp_url_without_ppa_name387 >>> print buildlog_lp_url_without_ppa_name
377 http://.../~no-priv/+archive/+build/31/+files/...388 http://.../~no-priv/+archive/+build/31/+files/...
378389
379390
=== modified file 'lib/lp/soyuz/tests/test_publishing.py'
--- lib/lp/soyuz/tests/test_publishing.py 2010-02-23 11:53:08 +0000
+++ lib/lp/soyuz/tests/test_publishing.py 2010-02-26 15:38:20 +0000
@@ -263,9 +263,8 @@
263 pocket=PackagePublishingPocket.RELEASE,263 pocket=PackagePublishingPocket.RELEASE,
264 format=BinaryPackageFormat.DEB,264 format=BinaryPackageFormat.DEB,
265 scheduleddeletiondate=None, dateremoved=None,265 scheduleddeletiondate=None, dateremoved=None,
266 distroseries=None,266 distroseries=None, archive=None,
267 archive=None,267 pub_source=None, builder=None):
268 pub_source=None):
269 """Return a list of binary publishing records."""268 """Return a list of binary publishing records."""
270 if distroseries is None:269 if distroseries is None:
271 distroseries = self.distroseries270 distroseries = self.distroseries
@@ -284,6 +283,7 @@
284 builds = pub_source.createMissingBuilds()283 builds = pub_source.createMissingBuilds()
285 published_binaries = []284 published_binaries = []
286 for build in builds:285 for build in builds:
286 build.builder = builder
287 binarypackagerelease = self.uploadBinaryForBuild(287 binarypackagerelease = self.uploadBinaryForBuild(
288 build, binaryname, filecontent, summary, description,288 build, binaryname, filecontent, summary, description,
289 shlibdep, depends, recommends, suggests, conflicts, replaces,289 shlibdep, depends, recommends, suggests, conflicts, replaces,
290290
=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py 2010-02-26 15:38:18 +0000
+++ lib/lp/testing/factory.py 2010-02-26 15:38:20 +0000
@@ -1559,7 +1559,7 @@
15591559
1560 def makeArchive(self, distribution=None, owner=None, name=None,1560 def makeArchive(self, distribution=None, owner=None, name=None,
1561 purpose=None, enabled=True, private=False,1561 purpose=None, enabled=True, private=False,
1562 virtualized=True):1562 virtualized=True, description=None):
1563 """Create and return a new arbitrary archive.1563 """Create and return a new arbitrary archive.
15641564
1565 :param distribution: Supply IDistribution, defaults to a new one1565 :param distribution: Supply IDistribution, defaults to a new one
@@ -1571,6 +1571,7 @@
1571 :param enabled: Whether the archive is enabled.1571 :param enabled: Whether the archive is enabled.
1572 :param private: Whether the archive is created private.1572 :param private: Whether the archive is created private.
1573 :param virtualized: Whether the archive is virtualized.1573 :param virtualized: Whether the archive is virtualized.
1574 :param description: A description of the archive.
1574 """1575 """
1575 if distribution is None:1576 if distribution is None:
1576 distribution = self.makeDistribution()1577 distribution = self.makeDistribution()
@@ -1592,7 +1593,7 @@
1592 archive = getUtility(IArchiveSet).new(1593 archive = getUtility(IArchiveSet).new(
1593 owner=owner, purpose=purpose,1594 owner=owner, purpose=purpose,
1594 distribution=distribution, name=name, enabled=enabled,1595 distribution=distribution, name=name, enabled=enabled,
1595 require_virtualized=virtualized)1596 require_virtualized=virtualized, description=description)
15961597
1597 if private:1598 if private:
1598 archive.private = True1599 archive.private = True