Merge lp:~sinzui/launchpad/entitle-branch-sharing into lp:launchpad

Proposed by Curtis Hovey
Status: Merged
Merged at revision: 15846
Proposed branch: lp:~sinzui/launchpad/entitle-branch-sharing
Merge into: lp:launchpad
Prerequisite: lp:~sinzui/launchpad/project-branch-permissions
Diff against target: 473 lines (+27/-99)
13 files modified
lib/lp/bugs/browser/tests/test_bugs.py (+2/-6)
lib/lp/bugs/browser/tests/test_bugtarget_filebug.py (+4/-10)
lib/lp/bugs/mail/tests/test_handler.py (+2/-4)
lib/lp/bugs/tests/test_bugs_webservice.py (+1/-5)
lib/lp/code/browser/tests/test_branch.py (+4/-8)
lib/lp/code/browser/tests/test_branchlisting.py (+3/-3)
lib/lp/code/model/tests/test_branch.py (+4/-8)
lib/lp/code/model/tests/test_branchnamespace.py (+1/-4)
lib/lp/registry/model/product.py (+0/-8)
lib/lp/registry/tests/test_product.py (+1/-4)
lib/lp/registry/tests/test_product_webservice.py (+2/-32)
lib/lp/soyuz/tests/test_archive.py (+3/-4)
lib/lp/testing/sampledata.py (+0/-3)
To merge this branch: bzr merge lp:~sinzui/launchpad/entitle-branch-sharing
Reviewer Review Type Date Requested Status
William Grant (community) code Approve
Review via email: mp+120225@code.launchpad.net

Commit message

Allow project maintainers to call setBranchSharingPolicy().

Description of the change

Launchpad must let users reconfigure their projects to use sharing
which enters beta next week.

--------------------------------------------------------------------

RULES

    Pre-implementation: wgrant
    * Remove the guard in setBranchSharingPolicy() that enforces the
      deprecated rule that restricts branch policies to be set by a
      commercial admin.
    * Simplify tests that use a commmercial admin to setup the conditions.

QA

    As a non-commercial admin
    * Visit http://qastaging.launchpad.net/lp-dev-utils/+sharing
    * Verify you can change the branch sharing policy.

LINT

    lib/lp/code/browser/tests/test_branch.py
    lib/lp/code/model/tests/test_branch.py
    lib/lp/code/model/tests/test_branchnamespace.py
    lib/lp/registry/model/product.py

TEST

    ./bin/test -vvc -t transitionToInformationType -t methods_smoketest lp.code.model.tests.test_branch
    ./bin/test -vvc -t WithInformationType lp.code.model.tests.test_branchnamespace
    ./bin/test -vvc -t EditViewInformationTypes lp.code.browser.tests.test_branch

IMPLEMENTATION

Remove the commerncial admin guard from setBranchSharingPolicy().
    lib/lp/registry/model/product.py

Update tests to use the project owner instead of a commecial admin to
setup the test conditions.
    lib/lp/code/browser/tests/test_branch.py
    lib/lp/code/model/tests/test_branch.py
    lib/lp/code/model/tests/test_branchnamespace.py

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) wrote :

This can't land before <https://code.launchpad.net/~sinzui/launchpad/commercial-admin-sharing/+merge/120464>, as in this branch there's no access check at all on setBugSharingPolicy or setBranchSharingPolicy. If your new permission from the other branch is sufficient, perhaps remove the unused user argument from setFooSharingPolicy.

review: Approve (code)
Revision history for this message
Curtis Hovey (sinzui) wrote :

I agree it needs to land with the other branch. I noticed the user arg and pondered if we wanted to keep it to either log or queue a notification to the project maintainer to inform who made the change. Cody is very concerned that several oh his projects had policy changes he would not permit. A might have helped him close the potential hole before something went through it. What do you think?

Revision history for this message
William Grant (wgrant) wrote :

We should certainly hook it into an auditing mechanism at some point, but it's relatively easy to readd the argument later. I don't have a strong opinion either way.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/browser/tests/test_bugs.py'
2--- lib/lp/bugs/browser/tests/test_bugs.py 2012-08-20 13:12:45 +0000
3+++ lib/lp/bugs/browser/tests/test_bugs.py 2012-08-21 15:01:20 +0000
4@@ -16,7 +16,6 @@
5 BugSharingPolicy,
6 InformationType,
7 )
8-from lp.registry.interfaces.person import IPersonSet
9 from lp.registry.interfaces.product import License
10 from lp.services.webapp.publisher import canonical_url
11 from lp.testing import (
12@@ -28,7 +27,6 @@
13 )
14 from lp.testing.layers import DatabaseFunctionalLayer
15 from lp.testing.pages import find_tag_by_id
16-from lp.testing.sampledata import COMMERCIAL_ADMIN_EMAIL
17 from lp.testing.views import create_initialized_view
18
19
20@@ -184,9 +182,8 @@
21 # createBug() does not adapt the default kwargs when they are none.
22 project = self.factory.makeProduct(
23 licenses=[License.OTHER_PROPRIETARY])
24- comadmin = getUtility(IPersonSet).getByEmail(COMMERCIAL_ADMIN_EMAIL)
25 project.setBugSharingPolicy(
26- BugSharingPolicy.PROPRIETARY_OR_PUBLIC, comadmin)
27+ BugSharingPolicy.PROPRIETARY_OR_PUBLIC, project.owner)
28 bug = self.application.createBug(
29 project.owner, 'title', 'description', project)
30 self.assertEqual(InformationType.PROPRIETARY, bug.information_type)
31@@ -195,9 +192,8 @@
32 # createBug() adapts a kwarg to InformationType if one is is not None.
33 project = self.factory.makeProduct(
34 licenses=[License.OTHER_PROPRIETARY])
35- comadmin = getUtility(IPersonSet).getByEmail(COMMERCIAL_ADMIN_EMAIL)
36 project.setBugSharingPolicy(
37- BugSharingPolicy.PROPRIETARY_OR_PUBLIC, comadmin)
38+ BugSharingPolicy.PROPRIETARY_OR_PUBLIC, project.owner)
39 bug = self.application.createBug(
40 project.owner, 'title', 'description', project, private=False)
41 self.assertEqual(InformationType.PUBLIC, bug.information_type)
42
43=== modified file 'lib/lp/bugs/browser/tests/test_bugtarget_filebug.py'
44--- lib/lp/bugs/browser/tests/test_bugtarget_filebug.py 2012-08-20 13:26:21 +0000
45+++ lib/lp/bugs/browser/tests/test_bugtarget_filebug.py 2012-08-21 15:01:20 +0000
46@@ -29,7 +29,6 @@
47 InformationType,
48 PRIVATE_INFORMATION_TYPES,
49 )
50-from lp.registry.interfaces.person import IPersonSet
51 from lp.registry.interfaces.projectgroup import IProjectGroup
52 from lp.services.webapp.servers import LaunchpadTestRequest
53 from lp.testing import (
54@@ -43,7 +42,6 @@
55 find_main_content,
56 find_tag_by_id,
57 )
58-from lp.testing.sampledata import COMMERCIAL_ADMIN_EMAIL
59 from lp.testing.views import (
60 create_initialized_view,
61 create_view,
62@@ -369,9 +367,7 @@
63 removeSecurityProxy(product).private_bugs = True
64 if bug_sharing_policy:
65 self.factory.makeCommercialSubscription(product=product)
66- comadmin = getUtility(IPersonSet).getByEmail(
67- COMMERCIAL_ADMIN_EMAIL)
68- product.setBugSharingPolicy(bug_sharing_policy, comadmin)
69+ product.setBugSharingPolicy(bug_sharing_policy, product.owner)
70 with person_logged_in(product.owner):
71 view = create_view(
72 product, '+filebug', method='POST', form=form,
73@@ -447,8 +443,8 @@
74 # correctly for a project with a proprietary sharing policy.
75 product = self.factory.makeProduct(official_malone=True)
76 self.factory.makeCommercialSubscription(product=product)
77- comadmin = getUtility(IPersonSet).getByEmail(COMMERCIAL_ADMIN_EMAIL)
78- product.setBugSharingPolicy(BugSharingPolicy.PROPRIETARY, comadmin)
79+ product.setBugSharingPolicy(
80+ BugSharingPolicy.PROPRIETARY, product.owner)
81 with person_logged_in(product.owner):
82 view = create_initialized_view(
83 product, '+filebug', principal=product.owner)
84@@ -499,9 +495,7 @@
85 removeSecurityProxy(product).private_bugs = True
86 if bug_sharing_policy:
87 self.factory.makeCommercialSubscription(product=product)
88- comadmin = getUtility(IPersonSet).getByEmail(
89- COMMERCIAL_ADMIN_EMAIL)
90- product.setBugSharingPolicy(bug_sharing_policy, comadmin)
91+ product.setBugSharingPolicy(bug_sharing_policy, product.owner)
92 anyone = self.factory.makePerson()
93 with person_logged_in(anyone):
94 view = create_initialized_view(
95
96=== modified file 'lib/lp/bugs/mail/tests/test_handler.py'
97--- lib/lp/bugs/mail/tests/test_handler.py 2012-08-20 13:12:45 +0000
98+++ lib/lp/bugs/mail/tests/test_handler.py 2012-08-21 15:01:20 +0000
99@@ -32,7 +32,6 @@
100 BugSharingPolicy,
101 InformationType,
102 )
103-from lp.registry.interfaces.person import IPersonSet
104 from lp.services.config import config
105 from lp.services.identity.interfaces.emailaddress import EmailAddressStatus
106 from lp.services.mail import stub
107@@ -52,7 +51,6 @@
108 LaunchpadZopelessLayer,
109 )
110 from lp.testing.mail_helpers import pop_notifications
111-from lp.testing.sampledata import COMMERCIAL_ADMIN_EMAIL
112
113
114 class TestMaloneHandler(TestCaseWithFactory):
115@@ -261,8 +259,8 @@
116 def test_new_bug_with_sharing_policy_proprietary(self):
117 project = self.factory.makeProduct(name='fnord')
118 self.factory.makeCommercialSubscription(product=project)
119- comadmin = getUtility(IPersonSet).getByEmail(COMMERCIAL_ADMIN_EMAIL)
120- project.setBugSharingPolicy(BugSharingPolicy.PROPRIETARY, comadmin)
121+ project.setBugSharingPolicy(
122+ BugSharingPolicy.PROPRIETARY, project.owner)
123 transaction.commit()
124 handler = MaloneHandler()
125 with person_logged_in(project.owner):
126
127=== modified file 'lib/lp/bugs/tests/test_bugs_webservice.py'
128--- lib/lp/bugs/tests/test_bugs_webservice.py 2012-08-20 13:12:45 +0000
129+++ lib/lp/bugs/tests/test_bugs_webservice.py 2012-08-21 15:01:20 +0000
130@@ -21,7 +21,6 @@
131 )
132 from zope.component import (
133 getMultiAdapter,
134- getUtility,
135 )
136
137 from lp.bugs.browser.bugtask import get_comments_for_bugtask
138@@ -30,7 +29,6 @@
139 BugSharingPolicy,
140 InformationType,
141 )
142-from lp.registry.interfaces.person import IPersonSet
143 from lp.registry.interfaces.product import License
144 from lp.services.webapp import snapshot
145 from lp.services.webapp.servers import LaunchpadTestRequest
146@@ -52,7 +50,6 @@
147 from lp.testing.pages import LaunchpadWebServiceCaller
148 from lp.testing.sampledata import (
149 ADMIN_EMAIL,
150- COMMERCIAL_ADMIN_EMAIL,
151 USER_EMAIL,
152 )
153
154@@ -414,9 +411,8 @@
155 # to the project's bug sharing policy.
156 project = self.factory.makeProduct(
157 licenses=[License.OTHER_PROPRIETARY])
158- comadmin = getUtility(IPersonSet).getByEmail(COMMERCIAL_ADMIN_EMAIL)
159 project.setBugSharingPolicy(
160- BugSharingPolicy.PROPRIETARY_OR_PUBLIC, comadmin)
161+ BugSharingPolicy.PROPRIETARY_OR_PUBLIC, project.owner)
162 webservice = launchpadlib_for('test', 'salgado')
163 bugs_collection = webservice.load('/bugs')
164 bug = bugs_collection.createBug(
165
166=== modified file 'lib/lp/code/browser/tests/test_branch.py'
167--- lib/lp/code/browser/tests/test_branch.py 2012-08-16 06:24:32 +0000
168+++ lib/lp/code/browser/tests/test_branch.py 2012-08-21 15:01:20 +0000
169@@ -41,7 +41,6 @@
170 )
171 from lp.registry.interfaces.accesspolicy import IAccessPolicySource
172 from lp.registry.interfaces.person import (
173- IPersonSet,
174 PersonVisibility,
175 )
176 from lp.services.config import config
177@@ -72,7 +71,6 @@
178 setupBrowser,
179 setupBrowserForUser,
180 )
181-from lp.testing.sampledata import COMMERCIAL_ADMIN_EMAIL
182 from lp.testing.views import create_initialized_view
183
184
185@@ -1086,10 +1084,9 @@
186 owner = self.factory.makePerson()
187 product = self.factory.makeProduct(owner=owner)
188 self.factory.makeCommercialSubscription(product=product)
189- comadmin = getUtility(IPersonSet).getByEmail(COMMERCIAL_ADMIN_EMAIL)
190- product.setBranchSharingPolicy(
191- BranchSharingPolicy.EMBARGOED_OR_PROPRIETARY, comadmin)
192 with person_logged_in(owner):
193+ product.setBranchSharingPolicy(
194+ BranchSharingPolicy.EMBARGOED_OR_PROPRIETARY, owner)
195 branch = self.factory.makeBranch(
196 product=product, owner=owner,
197 information_type=InformationType.PROPRIETARY)
198@@ -1102,10 +1099,9 @@
199 owner = self.factory.makePerson()
200 product = self.factory.makeProduct(owner=owner)
201 self.factory.makeCommercialSubscription(product=product)
202- comadmin = getUtility(IPersonSet).getByEmail(COMMERCIAL_ADMIN_EMAIL)
203- product.setBranchSharingPolicy(
204- BranchSharingPolicy.PROPRIETARY, comadmin)
205 with person_logged_in(owner):
206+ product.setBranchSharingPolicy(
207+ BranchSharingPolicy.PROPRIETARY, owner)
208 branch = self.factory.makeBranch(
209 product=product, owner=owner,
210 information_type=InformationType.PROPRIETARY)
211
212=== modified file 'lib/lp/code/browser/tests/test_branchlisting.py'
213--- lib/lp/code/browser/tests/test_branchlisting.py 2012-08-14 23:27:07 +0000
214+++ lib/lp/code/browser/tests/test_branchlisting.py 2012-08-21 15:01:20 +0000
215@@ -46,6 +46,7 @@
216 from lp.services.webapp.servers import LaunchpadTestRequest
217 from lp.testing import (
218 BrowserTestCase,
219+ celebrity_logged_in,
220 login_person,
221 normalize_whitespace,
222 person_logged_in,
223@@ -66,7 +67,6 @@
224 )
225 from lp.testing.sampledata import (
226 ADMIN_EMAIL,
227- COMMERCIAL_ADMIN_EMAIL,
228 )
229 from lp.testing.views import (
230 create_initialized_view,
231@@ -752,8 +752,8 @@
232 def test_branch_visibility_link_commercial_admin(self):
233 # A commercial admin will be displayed a link to define branch
234 # visibility in the action portlet.
235- admin = getUtility(IPersonSet).getByEmail(COMMERCIAL_ADMIN_EMAIL)
236- self._testBranchVisibilityLink(admin)
237+ with celebrity_logged_in('commercial_admin') as admin:
238+ self._testBranchVisibilityLink(admin)
239
240 def test_branch_visibility_link_non_admin(self):
241 # A non-admin will not see the action portlet.
242
243=== modified file 'lib/lp/code/model/tests/test_branch.py'
244--- lib/lp/code/model/tests/test_branch.py 2012-08-20 14:03:01 +0000
245+++ lib/lp/code/model/tests/test_branch.py 2012-08-21 15:01:20 +0000
246@@ -2601,10 +2601,9 @@
247 def test_methods_smoketest(self):
248 # Users with launchpad.Moderate can call transitionToInformationType.
249 branch = self.factory.makeProductBranch()
250- with celebrity_logged_in('commercial_admin') as admin:
251+ with person_logged_in(branch.product.owner):
252 branch.product.setBranchSharingPolicy(
253- BranchSharingPolicy.PUBLIC, admin)
254- with person_logged_in(branch.product.owner):
255+ BranchSharingPolicy.PUBLIC, branch.product.owner)
256 branch.transitionToInformationType(
257 InformationType.PRIVATESECURITY, branch.product.owner)
258 self.assertEqual(
259@@ -3283,12 +3282,9 @@
260 """Test transitionToInformationType() API arguments."""
261 product = self.factory.makeProduct()
262 self.factory.makeCommercialSubscription(product)
263- with celebrity_logged_in('commercial_admin') as admin:
264- # XXX sinzui 2012-08-16: setBranchSharingPolicy() is guarded
265- # at this moment.
266+ with person_logged_in(product.owner):
267 product.setBranchSharingPolicy(
268- BranchSharingPolicy.PUBLIC_OR_PROPRIETARY, admin)
269- with person_logged_in(product.owner):
270+ BranchSharingPolicy.PUBLIC_OR_PROPRIETARY, product.owner)
271 db_branch = self.factory.makeBranch(product=product)
272 launchpad = launchpadlib_for('test', db_branch.owner,
273 service_root=self.layer.appserver_root_url('api'))
274
275=== modified file 'lib/lp/code/model/tests/test_branchnamespace.py'
276--- lib/lp/code/model/tests/test_branchnamespace.py 2012-08-20 13:26:21 +0000
277+++ lib/lp/code/model/tests/test_branchnamespace.py 2012-08-21 15:01:20 +0000
278@@ -53,7 +53,6 @@
279 )
280 from lp.registry.interfaces.distribution import NoSuchDistribution
281 from lp.registry.interfaces.person import (
282- IPersonSet,
283 NoSuchPerson,
284 )
285 from lp.registry.interfaces.product import NoSuchProduct
286@@ -64,7 +63,6 @@
287 TestCaseWithFactory,
288 )
289 from lp.testing.layers import DatabaseFunctionalLayer
290-from lp.testing.sampledata import COMMERCIAL_ADMIN_EMAIL
291
292
293 class NamespaceMixin:
294@@ -470,8 +468,7 @@
295 person = self.factory.makePerson()
296 product = self.factory.makeProduct()
297 self.factory.makeCommercialSubscription(product=product)
298- comadmin = getUtility(IPersonSet).getByEmail(COMMERCIAL_ADMIN_EMAIL)
299- product.setBranchSharingPolicy(sharing_policy, comadmin)
300+ product.setBranchSharingPolicy(sharing_policy, product.owner)
301 namespace = ProductNamespace(person, product)
302 return namespace
303
304
305=== modified file 'lib/lp/registry/model/product.py'
306--- lib/lp/registry/model/product.py 2012-08-20 13:26:21 +0000
307+++ lib/lp/registry/model/product.py 2012-08-21 15:01:20 +0000
308@@ -567,10 +567,6 @@
309
310 def setBranchSharingPolicy(self, branch_sharing_policy, user):
311 """See `IProductPublic`."""
312- if not user or not IPersonRoles(user).in_commercial_admin:
313- raise Unauthorized(
314- "Only commercial admins can configure sharing policies right "
315- "now.")
316 if branch_sharing_policy != BranchSharingPolicy.PUBLIC:
317 if not self.has_current_commercial_subscription:
318 raise CommercialSubscribersOnly(
319@@ -585,10 +581,6 @@
320
321 def setBugSharingPolicy(self, bug_sharing_policy, user):
322 """See `IProductPublic`."""
323- if not user or not IPersonRoles(user).in_commercial_admin:
324- raise Unauthorized(
325- "Only commercial admins can configure sharing policies right "
326- "now.")
327 if bug_sharing_policy != BugSharingPolicy.PUBLIC:
328 if not self.has_current_commercial_subscription:
329 raise CommercialSubscribersOnly(
330
331=== modified file 'lib/lp/registry/tests/test_product.py'
332--- lib/lp/registry/tests/test_product.py 2012-08-20 13:26:21 +0000
333+++ lib/lp/registry/tests/test_product.py 2012-08-21 15:01:20 +0000
334@@ -45,7 +45,6 @@
335 IAccessPolicySource,
336 )
337 from lp.registry.interfaces.oopsreferences import IHasOOPSReferences
338-from lp.registry.interfaces.person import IPersonSet
339 from lp.registry.interfaces.product import (
340 IProduct,
341 IProductSet,
342@@ -81,7 +80,6 @@
343 get_feedback_messages,
344 setupBrowser,
345 )
346-from lp.testing.sampledata import COMMERCIAL_ADMIN_EMAIL
347 from lp.translations.enums import TranslationPermission
348 from lp.translations.interfaces.customlanguagecode import (
349 IHasCustomLanguageCodes,
350@@ -388,8 +386,7 @@
351 def makeProductWithPolicy(self, bug_sharing_policy, private_bugs=False):
352 product = self.factory.makeProduct(private_bugs=private_bugs)
353 self.factory.makeCommercialSubscription(product=product)
354- comadmin = getUtility(IPersonSet).getByEmail(COMMERCIAL_ADMIN_EMAIL)
355- product.setBugSharingPolicy(bug_sharing_policy, comadmin)
356+ product.setBugSharingPolicy(bug_sharing_policy, product.owner)
357 return product
358
359 def test_no_policy(self):
360
361=== modified file 'lib/lp/registry/tests/test_product_webservice.py'
362--- lib/lp/registry/tests/test_product_webservice.py 2012-08-10 06:40:08 +0000
363+++ lib/lp/registry/tests/test_product_webservice.py 2012-08-21 15:01:20 +0000
364@@ -57,8 +57,7 @@
365 product = self.factory.makeProduct()
366 self.factory.makeCommercialSubscription(product=product)
367 webservice = webservice_for_person(
368- self.factory.makeCommercialAdmin(),
369- permission=OAuthPermission.WRITE_PRIVATE)
370+ product.owner, permission=OAuthPermission.WRITE_PRIVATE)
371 response = self.patch(
372 webservice, product, branch_sharing_policy='Proprietary')
373 self.assertEqual(209, response.status)
374@@ -80,27 +79,12 @@
375 'proprietary branches.')))
376 self.assertIs(None, product.branch_sharing_policy)
377
378- def test_branch_sharing_policy_random_user(self):
379- # Arbitrary users can't set branch_sharing_policy.
380- product = self.factory.makeProduct()
381- webservice = webservice_for_person(
382- self.factory.makePerson(),
383- permission=OAuthPermission.WRITE_PRIVATE)
384- response = self.patch(
385- webservice, product, branch_sharing_policy='Proprietary')
386- self.assertThat(response, MatchesStructure.byEquality(
387- status=401,
388- body=('Only commercial admins can configure sharing policies '
389- 'right now.')))
390- self.assertIs(None, product.branch_sharing_policy)
391-
392 def test_bug_sharing_policy_can_be_set(self):
393 # bug_sharing_policy can be set via the API.
394 product = self.factory.makeProduct()
395 self.factory.makeCommercialSubscription(product=product)
396 webservice = webservice_for_person(
397- self.factory.makeCommercialAdmin(),
398- permission=OAuthPermission.WRITE_PRIVATE)
399+ product.owner, permission=OAuthPermission.WRITE_PRIVATE)
400 response = self.patch(
401 webservice, product, bug_sharing_policy='Proprietary')
402 self.assertEqual(209, response.status)
403@@ -121,17 +105,3 @@
404 body=('A current commercial subscription is required to use '
405 'proprietary bugs.')))
406 self.assertIs(None, product.bug_sharing_policy)
407-
408- def test_bug_sharing_policy_random_user(self):
409- # Arbitrary users can't set bug_sharing_policy.
410- product = self.factory.makeProduct()
411- webservice = webservice_for_person(
412- self.factory.makePerson(),
413- permission=OAuthPermission.WRITE_PRIVATE)
414- response = self.patch(
415- webservice, product, bug_sharing_policy='Proprietary')
416- self.assertThat(response, MatchesStructure.byEquality(
417- status=401,
418- body=('Only commercial admins can configure sharing policies '
419- 'right now.')))
420- self.assertIs(None, product.bug_sharing_policy)
421
422=== modified file 'lib/lp/soyuz/tests/test_archive.py'
423--- lib/lp/soyuz/tests/test_archive.py 2012-08-20 14:31:11 +0000
424+++ lib/lp/soyuz/tests/test_archive.py 2012-08-21 15:01:20 +0000
425@@ -98,7 +98,6 @@
426 LaunchpadFunctionalLayer,
427 LaunchpadZopelessLayer,
428 )
429-from lp.testing.sampledata import COMMERCIAL_ADMIN_EMAIL
430
431
432 class TestGetPublicationsInArchive(TestCaseWithFactory):
433@@ -1405,9 +1404,9 @@
434
435 def test_commercial_admin_can_set_build_debug_symbols(self):
436 # A commercial admin can set it.
437- login(COMMERCIAL_ADMIN_EMAIL)
438- self.setBuildDebugSymbols(self.archive, True)
439- self.assertTrue(self.archive.build_debug_symbols)
440+ with celebrity_logged_in('commercial_admin'):
441+ self.setBuildDebugSymbols(self.archive, True)
442+ self.assertTrue(self.archive.build_debug_symbols)
443
444
445 class TestAddArchiveDependencies(TestCaseWithFactory):
446
447=== modified file 'lib/lp/testing/sampledata.py'
448--- lib/lp/testing/sampledata.py 2010-10-18 10:24:38 +0000
449+++ lib/lp/testing/sampledata.py 2012-08-21 15:01:20 +0000
450@@ -13,7 +13,6 @@
451 'BOB_THE_BUILDER_NAME',
452 'BUILDD_ADMIN_USERNAME',
453 'CHROOT_LIBRARYFILEALIAS',
454- 'COMMERCIAL_ADMIN_EMAIL',
455 'FROG_THE_BUILDER_NAME',
456 'HOARY_DISTROSERIES_NAME',
457 'I386_ARCHITECTURE_NAME',
458@@ -25,7 +24,6 @@
459 'UBUNTU_DEVELOPER_ADMIN_NAME',
460 'UBUNTU_DISTRIBUTION_NAME',
461 'UBUNTU_UPLOAD_TEAM_NAME',
462- 'UBUNTUTEST_DISTRIBUTION_NAME',
463 'USER_EMAIL',
464 'WARTY_DISTROSERIES_NAME',
465 'WARTY_ONLY_SOURCEPACKAGENAME',
466@@ -57,7 +55,6 @@
467 NO_PRIVILEGE_EMAIL = 'no-priv@canonical.com'
468 USER_EMAIL = 'test@canonical.com'
469 VCS_IMPORTS_MEMBER_EMAIL = 'david.allouche@canonical.com'
470-COMMERCIAL_ADMIN_EMAIL = 'commercial-member@canonical.com'
471 SAMPLE_PERSON_EMAIL = USER_EMAIL
472 # A user that is an admin of ubuntu-team, which has upload rights
473 # to Ubuntu.