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

Proposed by Michael Nelson
Status: Merged
Merged at revision: not available
Proposed branch: lp:~michael.nelson/launchpad/ppa-privatisation-test-refactor5
Merge into: lp:launchpad
Prerequisite: lp:~michael.nelson/launchpad/ppa-privatisation-test-refactor4
Diff against target: 821 lines (+218/-170)
6 files modified
lib/lp/soyuz/stories/ppa/xx-ppa-packages.txt (+56/-24)
lib/lp/soyuz/stories/ppa/xx-private-ppa-presentation.txt (+14/-11)
lib/lp/soyuz/stories/ppa/xx-private-ppa-subscription-stories.txt (+47/-41)
lib/lp/soyuz/stories/ppa/xx-private-ppa-subscriptions.txt (+32/-30)
lib/lp/soyuz/stories/ppa/xx-private-ppas.txt (+20/-14)
lib/lp/soyuz/stories/soyuz/xx-person-packages.txt (+49/-50)
To merge this branch: bzr merge lp:~michael.nelson/launchpad/ppa-privatisation-test-refactor5
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+20207@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Michael Nelson (michael.nelson) wrote :

This is the fifth 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 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:
http://pastebin.ubuntu.com/378292/

This branch fixes:

bin/test -vv -t xx-ppa-packages -t xx-private-ppa-presentation.txt -t xx-private-ppa-subscription-stories.txt -t xx-private-ppa-subscriptions.txt -t xx-private-ppas.txt -t xx-person-packages.txt

Thanks.

Revision history for this message
Abel Deuring (adeuring) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/soyuz/stories/ppa/xx-ppa-packages.txt'
2--- lib/lp/soyuz/stories/ppa/xx-ppa-packages.txt 2010-01-20 14:29:59 +0000
3+++ lib/lp/soyuz/stories/ppa/xx-ppa-packages.txt 2010-02-26 15:48:21 +0000
4@@ -134,7 +134,8 @@
5 >>> login('foo.bar@canonical.com')
6 >>> from zope.component import getUtility
7 >>> from lp.registry.interfaces.person import IPersonSet
8- >>> cprov_ppa = getUtility(IPersonSet).getByName('cprov').archive
9+ >>> cprov = getUtility(IPersonSet).getByName('cprov')
10+ >>> cprov_ppa = cprov.archive
11 >>> pmount_i386_pub = cprov_ppa.getAllPublishedBinaries(
12 ... name='pmount', version='0.1-1')[1]
13 >>> print pmount_i386_pub.displayname
14@@ -178,39 +179,70 @@
15 'http://launchpad.dev/~mark/+archive/ppa'
16
17 This link is not present if the user does not have permission to view
18-the PPA. If we make mark's PPA private and then browse back as
19-an anonymous user, the link will be gone.
20-
21- >>> admin_browser.open("http://launchpad.dev/~mark/+archive/ppa/+admin")
22- >>> admin_browser.getControl(name="field.private").value = True
23- >>> admin_browser.getControl(name="field.buildd_secret").value = "secret"
24- >>> admin_browser.getControl("Save").click()
25+the PPA. We create a private PPA with a published source and then copy
26+the source into a public PPA to demonstrate this.
27+
28+ >>> login('foo.bar@canonical.com')
29+ >>> from lp.registry.interfaces.distribution import IDistributionSet
30+ >>> ubuntu = getUtility(IDistributionSet).getByName(
31+ ... 'ubuntu')
32+ >>> warty = ubuntu.getSeries('warty')
33+ >>> private_ppa = factory.makeArchive(
34+ ... name='p3a', private=True, owner=cprov,
35+ ... distribution=ubuntu)
36+ >>> joe = factory.makePerson(name="joe")
37+ >>> public_ppa = factory.makeArchive(
38+ ... owner=joe, distribution=ubuntu)
39+ >>> from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
40+ >>> test_publisher = SoyuzTestPublisher()
41+ >>> test_publisher.prepareBreezyAutotest()
42+ >>> source = test_publisher.getPubSource(
43+ ... sourcename='foo', archive=private_ppa, distroseries=warty)
44+ >>> copied_source = source.copyTo(
45+ ... source.distroseries, source.pocket, public_ppa)
46+ >>> expander_link_id = "pub%s-expander" % copied_source.id
47+ >>> logout()
48+
49+
50+We can view the link on the public PPA to Celso's private PPA when logged
51+in as Celso.
52+
53+ >>> cprov_browser = setupBrowser(
54+ ... auth="Basic celso.providelo@canonical.com:cprov")
55+ >>> cprov_browser.open(
56+ ... "http://launchpad.dev/~joe/+archive/ppa/+packages")
57+ >>> expander_url = cprov_browser.getLink(id=expander_link_id).url
58+ >>> cprov_browser.open(expander_url)
59+ >>> print cprov_browser.getLink("PPA named p3a for Celso Providelo").url
60+ http://launchpad.dev/~cprov/+archive/p3a
61+
62+But Joe himself will not see the link.
63+
64+ >>> joe_browser = setupBrowser(
65+ ... auth="Basic joe@example.com:test")
66+ >>> joe_browser.open(expander_url)
67+ >>> joe_browser.getLink("PPA named p3a for Celso Providelo")
68+ Traceback (most recent call last):
69+ ...
70+ LinkNotFoundError
71+
72+And neither can an anonymous user.
73
74 >>> anon_browser.open(expander_url)
75- >>> anon_browser.getLink("PPA for Mark Shuttleworth")
76+ >>> anon_browser.getLink("PPA named p3a for Celso Providelo")
77 Traceback (most recent call last):
78 ...
79 LinkNotFoundError
80
81-While we are there, we can also see that Mark's PPA 'repository-size'
82-pagelet isn't publicly available once the PPA was marked private.
83+While we are there, we can also see that the private PPA's 'repository-size'
84+pagelet isn't publicly available.
85
86 >>> anon_browser.open(
87- ... "http://launchpad.dev/~mark/+archive/ppa/+repository-size")
88+ ... "http://launchpad.dev/~cprov/+archive/p3a/+repository-size")
89 Traceback (most recent call last):
90 ...
91 Unauthorized: (..., 'launchpad.View')
92
93- >>> anon_browser.open(
94- ... "http://launchpad.dev/~cprov/+archive/ppa/+packages")
95-
96-Set mark's archive back to public before continuing.
97-
98- >>> admin_browser.open("http://launchpad.dev/~mark/+archive/ppa/+admin")
99- >>> admin_browser.getControl(name="field.private").value = False
100- >>> admin_browser.getControl(name="field.buildd_secret").value = ""
101- >>> admin_browser.getControl("Save").click()
102-
103
104 Searching the packages list
105 ===========================
106@@ -218,6 +250,8 @@
107 We can search a PPA for a particular package. A non-existent package shows
108 no results.
109
110+ >>> anon_browser.open(
111+ ... "http://launchpad.dev/~cprov/+archive/ppa/+packages")
112 >>> field = anon_browser.getControl(name='field.name_filter')
113 >>> field.value = 'nonexistentpackage'
114 >>> anon_browser.getControl('Filter', index=0).click()
115@@ -244,8 +278,6 @@
116 >>> cprov = getUtility(IPersonSet).getByName('cprov')
117 >>> iceweasel_pub = cprov.archive.getPublishedSources(
118 ... name='iceweasel')[0]
119- >>> from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
120- >>> test_publisher = SoyuzTestPublisher()
121 >>> bpr = test_publisher.uploadBinaryForBuild(
122 ... iceweasel_pub.getBuilds()[0], 'bar-bin')
123 >>> pub_bins = test_publisher.publishBinaryInArchive(
124
125=== modified file 'lib/lp/soyuz/stories/ppa/xx-private-ppa-presentation.txt'
126--- lib/lp/soyuz/stories/ppa/xx-private-ppa-presentation.txt 2009-09-09 20:39:52 +0000
127+++ lib/lp/soyuz/stories/ppa/xx-private-ppa-presentation.txt 2010-02-26 15:48:21 +0000
128@@ -15,21 +15,24 @@
129
130 == Private presentation ==
131
132-Let's make "cprov's" PPA private. To do this we need to be an
133-admin, and go to his admin page.
134-
135- >>> admin_browser.open("http://launchpad.dev/~cprov/+archive")
136- >>> admin_browser.getLink("Administer archive").click()
137- >>> admin_browser.getControl(name="field.private").value = True
138- >>> admin_browser.getControl(name="field.buildd_secret").value = "secret"
139- >>> admin_browser.getControl("Save").click()
140-
141-When the PPA is marked private it gains the standard Launchpad
142+Let's create a private PPA for Celso and see what it looks like.
143+
144+ >>> from zope.component import getUtility
145+ >>> from lp.registry.interfaces.person import IPersonSet
146+ >>> login('admin@canonical.com')
147+ >>> cprov = getUtility(IPersonSet).getByName('cprov')
148+ >>> from lp.registry.interfaces.distribution import IDistributionSet
149+ >>> ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
150+ >>> private_ppa = factory.makeArchive(
151+ ... owner=cprov, name="p3a", distribution=ubuntu, private=True)
152+ >>> logout()
153+
154+When the PPA is private it gains the standard Launchpad
155 presentation for private items.
156
157 >>> cprov_browser = setupBrowser(
158 ... auth='Basic celso.providelo@canonical.com:cprov')
159- >>> cprov_browser.open("http://launchpad.dev/~cprov/+archive")
160+ >>> cprov_browser.open("http://launchpad.dev/~cprov/+archive/p3a")
161 >>> from BeautifulSoup import BeautifulSoup, SoupStrainer
162 >>> body_el = BeautifulSoup(cprov_browser.contents).first('body')
163 >>> 'private' in body_el['class']
164
165=== modified file 'lib/lp/soyuz/stories/ppa/xx-private-ppa-subscription-stories.txt'
166--- lib/lp/soyuz/stories/ppa/xx-private-ppa-subscription-stories.txt 2010-02-12 12:39:24 +0000
167+++ lib/lp/soyuz/stories/ppa/xx-private-ppa-subscription-stories.txt 2010-02-26 15:48:21 +0000
168@@ -31,18 +31,22 @@
169
170 Given a private PPA for Celso,
171
172- >>> admin_browser.open("http://launchpad.dev/~cprov/+archive/ppa")
173- >>> admin_browser.getLink("Administer archive").click()
174- >>> admin_browser.getControl(name="field.private").value = True
175- >>> admin_browser.getControl(name="field.buildd_secret").value = "secret"
176- >>> admin_browser.getControl("Save").click()
177+ >>> from zope.component import getUtility
178+ >>> from lp.registry.interfaces.person import IPersonSet
179+ >>> login('admin@canonical.com')
180+ >>> cprov = getUtility(IPersonSet).getByName('cprov')
181+ >>> from lp.registry.interfaces.distribution import IDistributionSet
182+ >>> ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
183+ >>> private_ppa = factory.makeArchive(
184+ ... owner=cprov, name="p3a", distribution=ubuntu, private=True)
185+ >>> logout()
186
187 and a browser for Celso currently navigated to the Manage Subscriptions page,
188
189 >>> cprov_browser = setupBrowser(
190 ... auth="Basic celso.providelo@canonical.com:cprov")
191 >>> cprov_browser.open(
192- ... "http://launchpad.dev/~cprov/+archive/ppa/+subscriptions")
193+ ... "http://launchpad.dev/~cprov/+archive/p3a/+subscriptions")
194
195 and a client of Celso's who has a launchpad name of 'joesmith'
196
197@@ -51,7 +55,9 @@
198 ... password="test", email="joe@example.com")
199 >>> logout()
200
201-When Celso fills in the form with 'joesmith' as the subscriber, a blank subscription expiry, a description of "Joe is my friend" and clicks on the "Add subscriber" button,
202+When Celso fills in the form with 'joesmith' as the subscriber, a blank
203+subscription expiry, a description of "Joe is my friend" and clicks on the
204+"Add subscriber" button,
205
206 >>> cprov_browser.getControl(name='field.subscriber').value = 'joesmith'
207 >>> cprov_browser.getControl(
208@@ -75,7 +81,7 @@
209 >>> for msg in get_feedback_messages(cprov_browser.contents):
210 ... print msg
211 You have granted access for Joe Smith to install software from
212- PPA for Celso Providelo. Joe Smith will be notified of the
213+ PPA named p3a for Celso Providelo. Joe Smith will be notified of the
214 access via email.
215
216
217@@ -88,7 +94,7 @@
218 "Add subscriber" button,
219
220 >>> cprov_browser.open(
221- ... "http://launchpad.dev/~cprov/+archive/ppa/+subscriptions")
222+ ... "http://launchpad.dev/~cprov/+archive/p3a/+subscriptions")
223 >>> cprov_browser.getControl(name='field.subscriber').value = 'launchpad'
224 >>> cprov_browser.getControl(
225 ... name='field.date_expires').value = '2200-08-01'
226@@ -108,7 +114,7 @@
227 >>> for msg in get_feedback_messages(cprov_browser.contents):
228 ... print msg
229 You have granted access for Launchpad Developers to install software
230- from PPA for Celso Providelo. Members of Launchpad Developers
231+ from PPA named p3a for Celso Providelo. Members of Launchpad Developers
232 will be notified of the access via email.
233
234 == Story 2: An owner edits a subscription for his private archive ==
235@@ -124,13 +130,13 @@
236 navigated to the Manage Subscriptions page,
237
238 >>> cprov_browser.open(
239- ... "http://launchpad.dev/~cprov/+archive/ppa/+subscriptions")
240+ ... "http://launchpad.dev/~cprov/+archive/p3a/+subscriptions")
241
242 when Celso clicks 'Edit/Cancel' for the Launchpad Developers subscription,
243 modifies the description field and clicks Update,
244
245 >>> cprov_browser.getLink(
246- ... url='/~cprov/+archive/ppa/+subscriptions/launchpad/+edit').click()
247+ ... url='/~cprov/+archive/p3a/+subscriptions/launchpad/+edit').click()
248 >>> cprov_browser.getControl(name="field.description").value = (
249 ... "a different description")
250 >>> cprov_browser.getControl(name="field.actions.update").click()
251@@ -139,7 +145,7 @@
252 about the update.
253
254 >>> print cprov_browser.url
255- http://launchpad.dev/~cprov/+archive/ppa/+subscriptions
256+ http://launchpad.dev/~cprov/+archive/p3a/+subscriptions
257 >>> print_archive_subscriptions(cprov_browser.contents)
258 Name Expires Comment
259 Launchpad Developers 2200-08-01 a different description
260@@ -155,13 +161,13 @@
261 to the Manage Subscriptions page,
262
263 >>> cprov_browser.open(
264- ... "http://launchpad.dev/~cprov/+archive/ppa/+subscriptions")
265+ ... "http://launchpad.dev/~cprov/+archive/p3a/+subscriptions")
266
267 when Celso clicks 'Edit/Cancel' for the Launchpad Developers subscription
268 and clicks Cancel,
269
270 >>> cprov_browser.getLink(
271- ... url='/~cprov/+archive/ppa/+subscriptions/launchpad/+edit').click()
272+ ... url='/~cprov/+archive/p3a/+subscriptions/launchpad/+edit').click()
273 >>> cprov_browser.getControl(name="field.actions.cancel").click()
274
275 then the browser is redirected back to the subscriptions page, the canceled
276@@ -169,7 +175,7 @@
277 cancellation is displayed.
278
279 >>> print cprov_browser.url
280- http://launchpad.dev/~cprov/+archive/ppa/+subscriptions
281+ http://launchpad.dev/~cprov/+archive/p3a/+subscriptions
282 >>> print_archive_subscriptions(cprov_browser.contents)
283 Name Expires Comment
284 Joe Smith Joe is my friend Edit/Cancel
285@@ -177,7 +183,7 @@
286 >>> for msg in get_feedback_messages(cprov_browser.contents):
287 ... print msg
288 You have revoked Launchpad Developers's access to PPA
289- for Celso Providelo.
290+ named p3a for Celso Providelo.
291
292
293 == Story 3: A subscriber activates a subscription ==
294@@ -197,8 +203,8 @@
295 >>> joe_browser.open("http://launchpad.dev/~joesmith")
296 >>> joe_browser.getLink('View your private PPA subscriptions').click()
297 >>> print_subscriptions_for_person(joe_browser.contents)
298- Archive Owner
299- PPA for ... Celso Providelo View
300+ Archive Owner
301+ PPA named ... Celso Providelo View
302
303 When Joe clicks on the View button for Celso's PPA then the
304 details of the subscription are displayed with the newly created
305@@ -209,12 +215,12 @@
306 >>> print(extract_text(sources_list))
307 Custom sources.list entries
308 ...
309- deb http://joesmith:...@private-ppa.launchpad.dev/cprov/ppa/ubuntu
310- YOUR_UBUNTU_VERSION_HERE main #Personal access of Joe Smith
311- to PPA for Celso Providelo
312- deb-src http://joesmith:...@private-ppa.launchpad.dev/cprov/ppa/ubuntu
313- YOUR_UBUNTU_VERSION_HERE main #Personal access of Joe Smith
314- to PPA for Celso Providelo
315+ deb http://joesmith:...@private-ppa.launchpad.dev/cprov/p3a/ubuntu
316+ hoary main #Personal access of Joe Smith
317+ to PPA named p3a for Celso Providelo
318+ deb-src http://joesmith:...@private-ppa.launchpad.dev/cprov/p3a/ubuntu
319+ hoary main #Personal access of Joe Smith
320+ to PPA named p3a for Celso Providelo
321
322 When Joe navigates back to his current archive subscriptions then the list of
323 subscriptions reflects the confirmed subscription, providing a normal
324@@ -223,12 +229,12 @@
325 >>> joe_browser.open(
326 ... "http://launchpad.dev/~joesmith/+archivesubscriptions")
327 >>> print_subscriptions_for_person(joe_browser.contents)
328- Archive Owner
329- PPA for ... Celso Providelo View
330+ Archive Owner
331+ PPA named ... Celso Providelo View
332
333 >>> joe_browser.getLink('View').click()
334 >>> print(extract_text(joe_browser.contents))
335- Access to PPA for Celso Providelo...
336+ Access to PPA named p3a for Celso Providelo...
337
338 === Scenario 2: A user re-generates the token for a subscription ===
339
340@@ -254,7 +260,7 @@
341 >>> for msg in get_feedback_messages(joe_browser.contents):
342 ... print msg
343 Launchpad has generated the new password you requested for your
344- access to the archive PPA for Celso Providelo. Please
345+ access to the archive PPA named p3a for Celso Providelo. Please
346 follow the instructions below to update your custom "sources.list".
347
348
349@@ -268,7 +274,7 @@
350 >>> from lp.registry.interfaces.person import IPersonSet
351 >>> cprov = getUtility(IPersonSet).getByName('cprov')
352 >>> launchpad = getUtility(IPersonSet).getByName('launchpad')
353- >>> ignore = cprov.archive.newSubscription(launchpad, cprov)
354+ >>> ignore = private_ppa.newSubscription(launchpad, cprov)
355 >>> logout()
356 >>> login('foo.bar@canonical.com')
357 >>> foobar = getUtility(IPersonSet).getByName('name16')
358@@ -288,8 +294,8 @@
359
360 >>> mark_browser.getLink('View your private PPA subscriptions').click()
361 >>> print_subscriptions_for_person(mark_browser.contents)
362- Archive Owner
363- PPA for ... Celso Providelo View
364+ Archive Owner
365+ PPA named ... Celso Providelo View
366
367 When Mark clicks on the view button, then he is taken to the page for
368 his personal subscription for Celso's private PPA and the newly-created
369@@ -300,12 +306,12 @@
370 >>> print(extract_text(sources_list))
371 Custom sources.list entries
372 ...
373- deb http://mark:...@private-ppa.launchpad.dev/cprov/ppa/ubuntu
374- YOUR_UBUNTU_VERSION_HERE main #Personal access of
375- Mark Shuttleworth to PPA for Celso Providelo
376- deb-src http://mark:...@private-ppa.launchpad.dev/cprov/ppa/ubuntu
377- YOUR_UBUNTU_VERSION_HERE main #Personal access of
378- Mark Shuttleworth to PPA for Celso Providelo
379+ deb http://mark:...@private-ppa.launchpad.dev/cprov/p3a/ubuntu
380+ hoary main #Personal access of
381+ Mark Shuttleworth to PPA named p3a for Celso Providelo
382+ deb-src http://mark:...@private-ppa.launchpad.dev/cprov/p3a/ubuntu
383+ hoary main #Personal access of
384+ Mark Shuttleworth to PPA named p3a for Celso Providelo
385
386 When Mark navigates back to his current archive subscriptions then the list of
387 subscriptions reflects the confirmed subscription, providing a normal
388@@ -314,12 +320,12 @@
389 >>> mark_browser.open(
390 ... "http://launchpad.dev/~mark/+archivesubscriptions")
391 >>> print_subscriptions_for_person(mark_browser.contents)
392- Archive Owner
393- PPA for ... Celso Providelo View
394+ Archive Owner
395+ PPA named ... Celso Providelo View
396
397 >>> mark_browser.getLink('View').click()
398 >>> print(extract_text(mark_browser.contents))
399- Access to PPA for Celso Providelo...
400+ Access to PPA named p3a for Celso Providelo...
401
402
403 == Story 4: A user's subscription expires or is cancelled ==
404
405=== modified file 'lib/lp/soyuz/stories/ppa/xx-private-ppa-subscriptions.txt'
406--- lib/lp/soyuz/stories/ppa/xx-private-ppa-subscriptions.txt 2010-02-11 13:15:30 +0000
407+++ lib/lp/soyuz/stories/ppa/xx-private-ppa-subscriptions.txt 2010-02-26 15:48:21 +0000
408@@ -28,22 +28,24 @@
409 ... print msg
410 Only private archives can have subscribers.
411
412-Setup both cprov's and mark's PPAs as a private one:
413+Setup private PPAs for both Celso and Mark:
414
415- >>> admin_browser.open("http://launchpad.dev/~cprov/+archive/ppa")
416- >>> admin_browser.getLink("Administer archive").click()
417- >>> admin_browser.getControl(name="field.private").value = True
418- >>> admin_browser.getControl(name="field.buildd_secret").value = "secret"
419- >>> admin_browser.getControl("Save").click()
420- >>> admin_browser.open("http://launchpad.dev/~mark/+archive/ppa")
421- >>> admin_browser.getLink("Administer archive").click()
422- >>> admin_browser.getControl(name="field.private").value = True
423- >>> admin_browser.getControl(name="field.buildd_secret").value = "secret"
424- >>> admin_browser.getControl("Save").click()
425+ >>> from zope.component import getUtility
426+ >>> from lp.registry.interfaces.person import IPersonSet
427+ >>> login('admin@canonical.com')
428+ >>> cprov = getUtility(IPersonSet).getByName('cprov')
429+ >>> mark = getUtility(IPersonSet).getByName('mark')
430+ >>> from lp.registry.interfaces.distribution import IDistributionSet
431+ >>> ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
432+ >>> cprov_private_ppa = factory.makeArchive(
433+ ... owner=cprov, name="p3a", distribution=ubuntu, private=True)
434+ >>> mark_private_ppa = factory.makeArchive(
435+ ... owner=mark, name="p3a", distribution=ubuntu, private=True)
436+ >>> logout()
437
438 The PPA page includes a link to manage subscriptions:
439
440- >>> cprov_browser.open("http://launchpad.dev/~cprov/+archive/ppa")
441+ >>> cprov_browser.open("http://launchpad.dev/~cprov/+archive/p3a")
442 >>> cprov_browser.getLink("Manage access").click()
443
444 The page includes the required dependencies for the yui2-based date
445@@ -62,7 +64,7 @@
446
447 >>> main_content = find_main_content(cprov_browser.contents)
448 >>> print extract_text(main_content.find('h1'))
449- Manage access to PPA for Celso Providelo
450+ Manage access to PPA named p3a for Celso Providelo
451
452 >>> print extract_text(find_tag_by_id(cprov_browser.contents,
453 ... 'no-subscribers'))
454@@ -123,7 +125,7 @@
455
456 >>> mark_browser = setupBrowser(
457 ... auth="Basic mark@example.com:test")
458- >>> mark_browser.open("http://launchpad.dev/~mark/+archive/ppa/+subscriptions")
459+ >>> mark_browser.open("http://launchpad.dev/~mark/+archive/p3a/+subscriptions")
460 >>> mark_browser.getControl(name='field.subscriber').value = 'joesmith'
461 >>> mark_browser.getControl(
462 ... name='field.description').value = "Joe is also my friend"
463@@ -138,9 +140,9 @@
464 >>> for row in find_tags_by_class(joe_browser.contents,
465 ... 'archive-subscription-row'):
466 ... print extract_text(row)
467- Archive Owner
468- PPA for Mark Shuttleworth (ppa:mark/ppa) Mark Shuttleworth View
469- PPA for Celso Providelo (ppa:cprov/ppa) Celso Providelo View
470+ Archive Owner
471+ PPA named... (ppa:mark/p3a) Mark Shuttleworth View
472+ PPA named... (ppa:cprov/p3a) Celso Providelo View
473
474 == Confirming a subscription ==
475
476@@ -153,12 +155,12 @@
477 >>> print(extract_text(sources_list))
478 Custom sources.list entries
479 ...
480- deb http://joesmith:...@private-ppa.launchpad.dev/mark/ppa/ubuntu
481- breezy-autotest main #Personal access of Joe Smith
482- to PPA for Mark Shuttleworth
483- deb-src http://joesmith:...@private-ppa.launchpad.dev/mark/ppa/ubuntu
484- breezy-autotest main #Personal access of Joe Smith
485- to PPA for Mark Shuttleworth
486+ deb http://joesmith:...@private-ppa.launchpad.dev/mark/p3a/ubuntu
487+ hoary main #Personal access of Joe Smith
488+ to PPA named p3a for Mark Shuttleworth
489+ deb-src http://joesmith:...@private-ppa.launchpad.dev/mark/p3a/ubuntu
490+ hoary main #Personal access of Joe Smith
491+ to PPA named p3a for Mark Shuttleworth
492
493 This page will include information about the signing key, if the archive
494 has a signing key:
495@@ -169,7 +171,7 @@
496 >>> login('foo.bar@canonical.com')
497 >>> mark = getUtility(IPersonSet).getByName('mark')
498 >>> a_key = getUtility(IGPGKeySet).get(1)
499- >>> mark.archive.signing_key = a_key
500+ >>> mark_private_ppa.signing_key = a_key
501 >>> logout()
502
503 >>> joe_browser.reload()
504@@ -177,11 +179,11 @@
505 >>> print(extract_text(sources_list))
506 Custom sources.list entries
507 ...
508- deb http://joesmith:...@private-ppa.launchpad.dev/mark/ppa/ubuntu
509- breezy-autotest main #Personal access of Joe Smith
510- to PPA for Mark Shuttleworth
511- deb-src http://joesmith:...@private-ppa.launchpad.dev/mark/ppa/ubuntu
512- breezy-autotest main #Personal access of Joe Smith
513- to PPA for Mark Shuttleworth
514+ deb http://joesmith:...@private-ppa.launchpad.dev/mark/p3a/ubuntu
515+ hoary main #Personal access of Joe Smith
516+ to PPA named p3a for Mark Shuttleworth
517+ deb-src http://joesmith:...@private-ppa.launchpad.dev/mark/p3a/ubuntu
518+ hoary main #Personal access of Joe Smith
519+ to PPA named p3a for Mark Shuttleworth
520 This repository is signed ...
521
522
523=== modified file 'lib/lp/soyuz/stories/ppa/xx-private-ppas.txt'
524--- lib/lp/soyuz/stories/ppa/xx-private-ppas.txt 2009-09-16 22:57:42 +0000
525+++ lib/lp/soyuz/stories/ppa/xx-private-ppas.txt 2010-02-26 15:48:21 +0000
526@@ -16,15 +16,17 @@
527
528 == Set Up a Private PPA ==
529
530-Let's make "cprov's" PPA private. To do this we need to be an
531-admin, and go to his admin page.
532-
533- >>> admin_browser.open("http://launchpad.dev/~cprov/+archive")
534- >>> admin_browser.getLink("Administer archive").click()
535- >>> admin_browser.getControl(name="field.private").value = True
536- >>> admin_browser.getControl(name="field.buildd_secret").value = "secret"
537- >>> admin_browser.getControl("Save").click()
538-
539+First we'll create a private PPA for Celso.
540+
541+ >>> from zope.component import getUtility
542+ >>> from lp.registry.interfaces.person import IPersonSet
543+ >>> login('admin@canonical.com')
544+ >>> cprov = getUtility(IPersonSet).getByName('cprov')
545+ >>> from lp.registry.interfaces.distribution import IDistributionSet
546+ >>> ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
547+ >>> cprov_private_ppa = factory.makeArchive(
548+ ... owner=cprov, name="p3a", distribution=ubuntu, private=True)
549+ >>> logout()
550
551 == PPA Listing Page ==
552
553@@ -35,6 +37,7 @@
554 >>> browser.getControl(name="show_inactive").value = True
555 >>> browser.getControl('Search', index=0).click()
556 >>> list_ppas_in_browser_page(browser)
557+ PPA for Celso Providelo...
558 PPA for Mark Shuttleworth...
559 PPA for No Privileges Person...
560
561@@ -46,6 +49,7 @@
562 >>> cprov_browser.getControl(name="show_inactive").value = True
563 >>> cprov_browser.getControl('Search', index=0).click()
564 >>> list_ppas_in_browser_page(cprov_browser)
565+ PPA named p3a for Celso Providelo...
566 PPA for Celso Providelo...
567 PPA for Mark Shuttleworth...
568 PPA for No Privileges Person...
569@@ -75,6 +79,7 @@
570 >>> name12_browser.getControl(name="show_inactive").value = True
571 >>> name12_browser.getControl('Search', index=0).click()
572 >>> list_ppas_in_browser_page(name12_browser)
573+ PPA for Celso Providelo...
574 PPA for Landscape Developers...
575 PPA for Mark Shuttleworth...
576 PPA for No Privileges Person...
577@@ -95,7 +100,7 @@
578
579 A non-privileged user cannot access the private PPA pages.
580
581- >>> browser.open("http://launchpad.dev/~cprov/+archive")
582+ >>> browser.open("http://launchpad.dev/~cprov/+archive/p3a")
583 Traceback (most recent call last):
584 ...
585 Unauthorized...
586@@ -111,13 +116,14 @@
587 >>> cprov_browser.open("http://launchpad.dev/~cprov/")
588 >>> print_tag_with_id(cprov_browser.contents, 'ppas')
589 Personal package archives
590+ PPA named p3a for Celso Providelo
591 PPA for Celso Providelo
592 Create a new PPA
593
594- >>> cprov_browser.getLink("PPA for Celso Providelo").click()
595+ >>> cprov_browser.getLink("PPA named p3a for Celso Providelo").click()
596
597 >>> print cprov_browser.title
598- PPA for Celso Providelo : Celso Providelo
599+ PPA named p3a for Celso Providelo : Celso Providelo
600
601 When a non-privileged user browses to a profile page for a person or
602 team that has a private PPA for which he is not authorised to see, the
603@@ -149,9 +155,9 @@
604 Administrators can access all private PPAs.
605
606 >>> admin_browser.open("http://launchpad.dev/~cprov")
607- >>> admin_browser.getLink("PPA for Celso Providelo").click()
608+ >>> admin_browser.getLink("PPA named p3a for Celso Providelo").click()
609 >>> admin_browser.url
610- 'http://launchpad.dev/~cprov/+archive/ppa'
611+ 'http://launchpad.dev/~cprov/+archive/p3a'
612
613 >>> admin_browser.open("http://launchpad.dev/~landscape-developers")
614 >>> admin_browser.getLink("PPA for Landscape Developers").click()
615
616=== modified file 'lib/lp/soyuz/stories/soyuz/xx-person-packages.txt'
617--- lib/lp/soyuz/stories/soyuz/xx-person-packages.txt 2009-11-09 17:08:21 +0000
618+++ lib/lp/soyuz/stories/soyuz/xx-person-packages.txt 2010-02-26 15:48:21 +0000
619@@ -169,15 +169,6 @@
620 ... for row in rows:
621 ... print extract_text(row)
622
623-And another helper function to set the private flag on a PPA:
624-
625- >>> def set_private(name, private=True):
626- ... admin_browser.open("http://launchpad.dev/~%s/+archive/ppa" % (
627- ... name))
628- ... admin_browser.getLink("Administer archive").click()
629- ... admin_browser.getControl(name="field.private").value = private
630- ... admin_browser.getControl(name="field.buildd_secret").value = "x"
631- ... admin_browser.getControl("Save").click()
632
633 Create some new source packages, source1 and source2, both created by cprov
634 so that they appear in his +packages page.
635@@ -186,6 +177,7 @@
636 >>> from canonical.launchpad.ftests import login, logout
637 >>> from canonical.database.sqlbase import flush_database_updates
638 >>> from canonical.launchpad.interfaces import IPersonSet
639+ >>> from lp.registry.interfaces.distribution import IDistributionSet
640 >>> from lp.soyuz.tests.test_publishing import (
641 ... SoyuzTestPublisher)
642 >>> from lp.soyuz.interfaces.publishing import (
643@@ -194,6 +186,9 @@
644 >>> login("foo.bar@canonical.com")
645 >>> cprov = getUtility(IPersonSet).getByName('cprov')
646 >>> nopriv = getUtility(IPersonSet).getByName('no-priv')
647+ >>> ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
648+ >>> nopriv_private_ppa = factory.makeArchive(
649+ ... owner=nopriv, name="p3a", distribution=ubuntu, private=True)
650 >>> mark = getUtility(IPersonSet).getByName('mark')
651 >>> test_publisher = SoyuzTestPublisher()
652 >>> test_publisher.prepareBreezyAutotest()
653@@ -207,14 +202,14 @@
654 >>> source2 = test_publisher.getPubSource(
655 ... status=PackagePublishingStatus.PUBLISHED,
656 ... sourcename='source2',
657- ... archive=nopriv.archive)
658+ ... archive=nopriv_private_ppa)
659 >>> source2.sourcepackagerelease.creator=cprov
660
661 >>> flush_database_updates()
662 >>> logout()
663
664 "source1" is now published in cprov and mark's PPA. "source2" is only
665-published in no-priv's PPA.
666+published in no-priv's Private PPA.
667
668 Make user_browser a known user that does not conflict with "no-priv":
669
670@@ -222,23 +217,14 @@
671
672 === Cprov's +related-software page ===
673
674-So let's look at cprov's +related-software page which has two entries in
675-the PPA section:
676-
677- >>> user_browser.open("http://launchpad.dev/~cprov/+related-software")
678- >>> print_ppa_rows(user_browser)
679- source1 PPA for Celso Providelo - Ubuntutest Breezy-autotest 666
680- ...ago None - -
681- source2 PPA for No Privileges Person - Ubuntutest Breezy-autotest 666
682- ...ago None - -
683-
684-Now, let's make the PPA for "No Privileges Person" private:
685-
686- >>> set_private("no-priv")
687-
688-For unprivileged users, cprov's displayed PPA packages are now reduced
689-to the one in his own PPA because the other iceweasel is only published
690-in the newly-private PPA of the "no-priv" user.
691+For unprivileged users, cprov's displayed PPA packages only display
692+the one in his own public PPA because source2 is only published
693+in the private PPA of the "no-priv" user.
694+
695+XXX Michael Nelson 2010-02-26 bug=394276: The following should be
696+a view test of PersonPPAPAckagesView.filterPPAPackageList(). They
697+are not always testing what we think they are, as the lines match
698+more packages than intended.
699
700 The logged-in user's case:
701
702@@ -262,20 +248,26 @@
703 >>> print_ppa_rows(nopriv_browser)
704 source1 PPA for Celso Providelo - Ubuntutest Breezy-autotest 666
705 ...ago None - -
706- source2 PPA for No Priv... Person - Ubuntutest Breezy-autotest 666
707+ source2 PPA named p3a for No Priv... Ubuntutest Breezy-autotest 666
708 ...ago None - -
709
710 >>> admin_browser.open("http://launchpad.dev/~cprov/+related-software")
711 >>> print_ppa_rows(admin_browser)
712 source1 PPA for Celso Providelo - Ubuntutest Breezy-autotest 666
713 ...ago None - -
714- source2 PPA for No Priv... Person - Ubuntutest Breezy-autotest 666
715+ source2 PPA named p3a for No Priv... Ubuntutest Breezy-autotest 666
716 ...ago None - -
717
718-Let's make mark's archive private and view the page again.
719-
720- >>> set_private("mark")
721-
722+Let's move the publication of source1 from mark's public archive to his
723+private one and the view the page again.
724+
725+ >>> login('admin@canonical.com')
726+ >>> mark_private_ppa = factory.makeArchive(
727+ ... owner=mark, name="p3a", distribution=ubuntu, private=True)
728+ >>> from zope.security.proxy import removeSecurityProxy
729+ >>> removeSecurityProxy(source1_mark.secure_record).archive = (
730+ ... mark_private_ppa)
731+ >>> logout()
732 >>> user_browser.open("http://launchpad.dev/~cprov/+related-software")
733 >>> print_ppa_rows(user_browser)
734 source1 PPA for Celso Providelo - Ubuntutest Breezy-autotest 666
735@@ -286,13 +278,20 @@
736 source1 PPA for Celso Providelo - Ubuntutest Breezy-autotest 666
737 ...ago None - -
738
739-Notice that the source1 package in mark's PPA is still appearing
740-because it is also published in some non-private archives, which
741-override the private nature of mark's archive.
742-
743-Let's make cprov's archive private:
744-
745- >>> set_private("cprov")
746+Notice that the source1 package is still appearing because it is also
747+published in some non-private archives, which override the private nature
748+of mark's archive.
749+
750+Let's move the publication of source1 from cprov's public archive to
751+his private one:
752+
753+ >>> login('admin@canonical.com')
754+ >>> cprov_private_ppa = factory.makeArchive(
755+ ... owner=cprov, name="p3a", distribution=ubuntu, private=True)
756+ >>> removeSecurityProxy(source1.secure_record).archive = (
757+ ... cprov_private_ppa)
758+ >>> source1.sourcepackagerelease.upload_archive = cprov_private_ppa
759+ >>> logout()
760
761 It will now disppear from the listings because it's not published in any
762 public archives.
763@@ -320,12 +319,12 @@
764
765 >>> user_browser.open("http://launchpad.dev/~cprov/+related-software")
766 >>> print_ppa_rows(user_browser)
767- source1 PPA for Celso Providelo - Ubuntutest Breezy-autotest 666
768+ source1 PPA named p3a for Celso... - Ubuntutest Breezy-autotest 666
769 ...ago None - -
770
771 >>> anon_browser.open("http://launchpad.dev/~cprov/+related-software")
772 >>> print_ppa_rows(anon_browser)
773- source1 PPA for Celso Providelo - Ubuntutest Breezy-autotest 666
774+ source1 PPA named p3a for Celso... - Ubuntutest Breezy-autotest 666
775 ...ago None - -
776
777 Even after the package is superseded, the package remains visibile in
778@@ -338,12 +337,12 @@
779
780 >>> user_browser.open("http://launchpad.dev/~cprov/+related-software")
781 >>> print_ppa_rows(user_browser)
782- source1 PPA for Celso Providelo - Ubuntutest Breezy-autotest 666
783+ source1 PPA named p3a for Celso... - Ubuntutest Breezy-autotest 666
784 ...ago None - -
785
786 >>> anon_browser.open("http://launchpad.dev/~cprov/+related-software")
787 >>> print_ppa_rows(anon_browser)
788- source1 PPA for Celso Providelo - Ubuntutest Breezy-autotest 666
789+ source1 PPA named p3a for Celso... - Ubuntutest Breezy-autotest 666
790 ...ago None - -
791
792
793@@ -358,15 +357,15 @@
794
795 >>> admin_browser.open("http://launchpad.dev/~cprov/+related-software")
796 >>> print_ppa_rows(admin_browser)
797- source1 PPA for Celso Providelo - Ubuntutest Breezy-autotest 666
798+ source1 PPA named p3a for Celso... - Ubuntutest Breezy-autotest 666
799 ...ago None - -
800- source2 PPA for No Priv... Person - Ubuntutest Breezy-autotest 666
801+ source2 PPA named p3a for No Priv... - Ubuntutest Breezy-autotest 666
802 ...ago None - -
803
804 Then delete the 'source2' package.
805
806 >>> admin_browser.open(
807- ... "http://launchpad.dev/~no-priv/+archive/ppa/+delete-packages")
808+ ... "http://launchpad.dev/~no-priv/+archive/p3a/+delete-packages")
809 >>> admin_browser.getControl(
810 ... name='field.selected_sources').value = ['%s' % source2.id]
811 >>> admin_browser.getControl(
812@@ -394,8 +393,8 @@
813
814 >>> admin_browser.open("http://launchpad.dev/~cprov/+related-software")
815 >>> print_ppa_rows(admin_browser)
816- source1 PPA for Celso Providelo - Ubuntutest Breezy-autotest 666
817+ source1 PPA named p3a for Celso... - Ubuntutest Breezy-autotest 666
818 ...ago None - -
819- source2 PPA for No Priv... Person - Ubuntutest Breezy-autotest 666
820+ source2 PPA named p3a for No Priv... - Ubuntutest Breezy-autotest 666
821 ...ago None - -
822