~adeuring/launchpad/api-export-bug-linked-branches

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/stories/ppa/xx-private-ppa-subscription-stories.txt

  • Committer: Abel Deuring
  • Date: 2010-03-02 11:23:10 UTC
  • mfrom: (10206.1.219 launchpad)
  • Revision ID: abel.deuring@canonical.com-20100302112310-ye6e715pyjta4474
devel merged

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
 
32
32
Given a private PPA for Celso,
33
33
 
34
 
    >>> admin_browser.open("http://launchpad.dev/~cprov/+archive/ppa")
35
 
    >>> admin_browser.getLink("Administer archive").click()
36
 
    >>> admin_browser.getControl(name="field.private").value = True
37
 
    >>> admin_browser.getControl(name="field.buildd_secret").value = "secret"
38
 
    >>> admin_browser.getControl("Save").click()
 
34
    >>> from zope.component import getUtility
 
35
    >>> from lp.registry.interfaces.person import IPersonSet
 
36
    >>> login('admin@canonical.com')
 
37
    >>> cprov = getUtility(IPersonSet).getByName('cprov')
 
38
    >>> from lp.registry.interfaces.distribution import IDistributionSet
 
39
    >>> ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
 
40
    >>> private_ppa = factory.makeArchive(
 
41
    ...     owner=cprov, name="p3a", distribution=ubuntu, private=True)
 
42
    >>> logout()
39
43
 
40
44
and a browser for Celso currently navigated to the Manage Subscriptions page,
41
45
 
42
46
    >>> cprov_browser = setupBrowser(
43
47
    ...     auth="Basic celso.providelo@canonical.com:cprov")
44
48
    >>> cprov_browser.open(
45
 
    ...     "http://launchpad.dev/~cprov/+archive/ppa/+subscriptions")
 
49
    ...     "http://launchpad.dev/~cprov/+archive/p3a/+subscriptions")
46
50
 
47
51
and a client of Celso's who has a launchpad name of 'joesmith'
48
52
 
51
55
    ...     password="test", email="joe@example.com")
52
56
    >>> logout()
53
57
 
54
 
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,
 
58
When Celso fills in the form with 'joesmith' as the subscriber, a blank
 
59
subscription expiry, a description of "Joe is my friend" and clicks on the
 
60
"Add subscriber" button,
55
61
 
56
62
    >>> cprov_browser.getControl(name='field.subscriber').value = 'joesmith'
57
63
    >>> cprov_browser.getControl(
75
81
    >>> for msg in get_feedback_messages(cprov_browser.contents):
76
82
    ...     print msg
77
83
    You have granted access for Joe Smith to install software from
78
 
    PPA for Celso Providelo. Joe Smith will be notified of the
 
84
    PPA named p3a for Celso Providelo. Joe Smith will be notified of the
79
85
    access via email.
80
86
 
81
87
 
88
94
"Add subscriber" button,
89
95
 
90
96
    >>> cprov_browser.open(
91
 
    ...     "http://launchpad.dev/~cprov/+archive/ppa/+subscriptions")
 
97
    ...     "http://launchpad.dev/~cprov/+archive/p3a/+subscriptions")
92
98
    >>> cprov_browser.getControl(name='field.subscriber').value = 'launchpad'
93
99
    >>> cprov_browser.getControl(
94
100
    ...     name='field.date_expires').value = '2200-08-01'
108
114
    >>> for msg in get_feedback_messages(cprov_browser.contents):
109
115
    ...     print msg
110
116
    You have granted access for Launchpad Developers to install software
111
 
    from PPA for Celso Providelo. Members of Launchpad Developers
 
117
    from PPA named p3a for Celso Providelo. Members of Launchpad Developers
112
118
    will be notified of the access via email.
113
119
 
114
120
== Story 2: An owner edits a subscription for his private archive ==
124
130
navigated to the Manage Subscriptions page,
125
131
 
126
132
    >>> cprov_browser.open(
127
 
    ...     "http://launchpad.dev/~cprov/+archive/ppa/+subscriptions")
 
133
    ...     "http://launchpad.dev/~cprov/+archive/p3a/+subscriptions")
128
134
 
129
135
when Celso clicks 'Edit/Cancel' for the Launchpad Developers subscription,
130
136
modifies the description field and clicks Update,
131
137
 
132
138
    >>> cprov_browser.getLink(
133
 
    ...     url='/~cprov/+archive/ppa/+subscriptions/launchpad/+edit').click()
 
139
    ...     url='/~cprov/+archive/p3a/+subscriptions/launchpad/+edit').click()
134
140
    >>> cprov_browser.getControl(name="field.description").value = (
135
141
    ...     "a different description")
136
142
    >>> cprov_browser.getControl(name="field.actions.update").click()
139
145
about the update.
140
146
 
141
147
    >>> print cprov_browser.url
142
 
    http://launchpad.dev/~cprov/+archive/ppa/+subscriptions
 
148
    http://launchpad.dev/~cprov/+archive/p3a/+subscriptions
143
149
    >>> print_archive_subscriptions(cprov_browser.contents)
144
150
    Name                    Expires       Comment
145
151
    Launchpad Developers    2200-08-01    a different description
155
161
to the Manage Subscriptions page,
156
162
 
157
163
    >>> cprov_browser.open(
158
 
    ...     "http://launchpad.dev/~cprov/+archive/ppa/+subscriptions")
 
164
    ...     "http://launchpad.dev/~cprov/+archive/p3a/+subscriptions")
159
165
 
160
166
when Celso clicks 'Edit/Cancel' for the Launchpad Developers subscription
161
167
and clicks Cancel,
162
168
 
163
169
    >>> cprov_browser.getLink(
164
 
    ...     url='/~cprov/+archive/ppa/+subscriptions/launchpad/+edit').click()
 
170
    ...     url='/~cprov/+archive/p3a/+subscriptions/launchpad/+edit').click()
165
171
    >>> cprov_browser.getControl(name="field.actions.cancel").click()
166
172
 
167
173
then the browser is redirected back to the subscriptions page, the canceled
169
175
cancellation is displayed.
170
176
 
171
177
    >>> print cprov_browser.url
172
 
    http://launchpad.dev/~cprov/+archive/ppa/+subscriptions
 
178
    http://launchpad.dev/~cprov/+archive/p3a/+subscriptions
173
179
    >>> print_archive_subscriptions(cprov_browser.contents)
174
180
    Name                    Expires       Comment
175
181
    Joe Smith                             Joe is my friend    Edit/Cancel
177
183
    >>> for msg in get_feedback_messages(cprov_browser.contents):
178
184
    ...     print msg
179
185
    You have revoked Launchpad Developers's access to PPA
180
 
    for Celso Providelo.
 
186
    named p3a for Celso Providelo.
181
187
 
182
188
 
183
189
== Story 3: A subscriber activates a subscription ==
197
203
    >>> joe_browser.open("http://launchpad.dev/~joesmith")
198
204
    >>> joe_browser.getLink('View your private PPA subscriptions').click()
199
205
    >>> print_subscriptions_for_person(joe_browser.contents)
200
 
    Archive      Owner
201
 
    PPA for ...  Celso Providelo  View
 
206
    Archive        Owner
 
207
    PPA named ...  Celso Providelo  View
202
208
 
203
209
When Joe clicks on the View button for Celso's PPA then the
204
210
details of the subscription are displayed with the newly created
209
215
    >>> print(extract_text(sources_list))
210
216
    Custom sources.list entries
211
217
    ...
212
 
    deb http://joesmith:...@private-ppa.launchpad.dev/cprov/ppa/ubuntu
213
 
        YOUR_UBUNTU_VERSION_HERE main #Personal access of Joe Smith
214
 
        to PPA for Celso Providelo
215
 
    deb-src http://joesmith:...@private-ppa.launchpad.dev/cprov/ppa/ubuntu
216
 
        YOUR_UBUNTU_VERSION_HERE main #Personal access of Joe Smith
217
 
        to PPA for Celso Providelo
 
218
    deb http://joesmith:...@private-ppa.launchpad.dev/cprov/p3a/ubuntu
 
219
        hoary main #Personal access of Joe Smith
 
220
        to PPA named p3a for Celso Providelo
 
221
    deb-src http://joesmith:...@private-ppa.launchpad.dev/cprov/p3a/ubuntu
 
222
        hoary main #Personal access of Joe Smith
 
223
        to PPA named p3a for Celso Providelo
218
224
 
219
225
When Joe navigates back to his current archive subscriptions then the list of
220
226
subscriptions reflects the confirmed subscription, providing a normal
223
229
    >>> joe_browser.open(
224
230
    ...     "http://launchpad.dev/~joesmith/+archivesubscriptions")
225
231
    >>> print_subscriptions_for_person(joe_browser.contents)
226
 
    Archive      Owner
227
 
    PPA for ...  Celso Providelo  View
 
232
    Archive        Owner
 
233
    PPA named ...  Celso Providelo  View
228
234
 
229
235
    >>> joe_browser.getLink('View').click()
230
236
    >>> print(extract_text(joe_browser.contents))
231
 
    Access to PPA for Celso Providelo...
 
237
    Access to PPA named p3a for Celso Providelo...
232
238
 
233
239
=== Scenario 2: A user re-generates the token for a subscription ===
234
240
 
254
260
    >>> for msg in get_feedback_messages(joe_browser.contents):
255
261
    ...     print msg
256
262
    Launchpad has generated the new password you requested for your
257
 
    access to the archive PPA for Celso Providelo. Please
 
263
    access to the archive PPA named p3a for Celso Providelo. Please
258
264
    follow the instructions below to update your custom "sources.list".
259
265
 
260
266
 
268
274
    >>> from lp.registry.interfaces.person import IPersonSet
269
275
    >>> cprov = getUtility(IPersonSet).getByName('cprov')
270
276
    >>> launchpad = getUtility(IPersonSet).getByName('launchpad')
271
 
    >>> ignore = cprov.archive.newSubscription(launchpad, cprov)
 
277
    >>> ignore = private_ppa.newSubscription(launchpad, cprov)
272
278
    >>> logout()
273
279
    >>> login('foo.bar@canonical.com')
274
280
    >>> foobar = getUtility(IPersonSet).getByName('name16')
288
294
 
289
295
    >>> mark_browser.getLink('View your private PPA subscriptions').click()
290
296
    >>> print_subscriptions_for_person(mark_browser.contents)
291
 
    Archive      Owner
292
 
    PPA for ...  Celso Providelo  View
 
297
    Archive        Owner
 
298
    PPA named ...  Celso Providelo  View
293
299
 
294
300
When Mark clicks on the view button, then he is taken to the page for
295
301
his personal subscription for Celso's private PPA and the newly-created
300
306
    >>> print(extract_text(sources_list))
301
307
    Custom sources.list entries
302
308
    ...
303
 
    deb http://mark:...@private-ppa.launchpad.dev/cprov/ppa/ubuntu
304
 
        YOUR_UBUNTU_VERSION_HERE main #Personal access of
305
 
        Mark Shuttleworth to PPA for Celso Providelo
306
 
    deb-src http://mark:...@private-ppa.launchpad.dev/cprov/ppa/ubuntu
307
 
        YOUR_UBUNTU_VERSION_HERE main #Personal access of
308
 
        Mark Shuttleworth to PPA for Celso Providelo
 
309
    deb http://mark:...@private-ppa.launchpad.dev/cprov/p3a/ubuntu
 
310
        hoary main #Personal access of
 
311
        Mark Shuttleworth to PPA named p3a for Celso Providelo
 
312
    deb-src http://mark:...@private-ppa.launchpad.dev/cprov/p3a/ubuntu
 
313
        hoary main #Personal access of
 
314
        Mark Shuttleworth to PPA named p3a for Celso Providelo
309
315
 
310
316
When Mark navigates back to his current archive subscriptions then the list of
311
317
subscriptions reflects the confirmed subscription, providing a normal
314
320
    >>> mark_browser.open(
315
321
    ...     "http://launchpad.dev/~mark/+archivesubscriptions")
316
322
    >>> print_subscriptions_for_person(mark_browser.contents)
317
 
    Archive      Owner
318
 
    PPA for ...  Celso Providelo  View
 
323
    Archive        Owner
 
324
    PPA named ...  Celso Providelo  View
319
325
 
320
326
    >>> mark_browser.getLink('View').click()
321
327
    >>> print(extract_text(mark_browser.contents))
322
 
    Access to PPA for Celso Providelo...
 
328
    Access to PPA named p3a for Celso Providelo...
323
329
 
324
330
 
325
331
== Story 4: A user's subscription expires or is cancelled ==