Merge lp:~wgrant/launchpad/death-to-embargoed into lp:launchpad
- death-to-embargoed
- Merge into devel
Proposed by
William Grant
Status: | Merged |
---|---|
Merged at revision: | 17597 |
Proposed branch: | lp:~wgrant/launchpad/death-to-embargoed |
Merge into: | lp:launchpad |
Diff against target: |
1062 lines (+137/-249) 12 files modified
lib/lp/app/enums.py (+4/-1) lib/lp/registry/browser/product.py (+5/-9) lib/lp/registry/browser/tests/test_product.py (+15/-23) lib/lp/registry/javascript/tests/test_product_views.js (+6/-10) lib/lp/registry/model/product.py (+4/-7) lib/lp/registry/services/tests/test_sharingservice.py (+1/-1) lib/lp/registry/tests/test_packaging.py (+0/-14) lib/lp/registry/tests/test_person.py (+11/-11) lib/lp/registry/tests/test_product.py (+74/-137) lib/lp/registry/tests/test_product_vocabularies.py (+6/-10) lib/lp/registry/tests/test_productseries.py (+9/-24) lib/lp/translations/browser/tests/test_product_view.py (+2/-2) |
To merge this branch: | bzr merge lp:~wgrant/launchpad/death-to-embargoed |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Watson (community) | Approve | ||
Review via email: mp+263083@code.launchpad.net |
Commit message
Remove Embargoed as a legal value for Product.
Description of the change
Remove Embargoed as a legal value for Product.
InformationType
We should UPDATE Product SET information_type = 5 WHERE information_type = 6; before this is deployed.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'lib/lp/app/enums.py' |
2 | --- lib/lp/app/enums.py 2012-09-17 15:19:10 +0000 |
3 | +++ lib/lp/app/enums.py 2015-07-02 02:01:38 +0000 |
4 | @@ -11,6 +11,7 @@ |
5 | 'NON_EMBARGOED_INFORMATION_TYPES', |
6 | 'PRIVATE_INFORMATION_TYPES', |
7 | 'PROPRIETARY_INFORMATION_TYPES', |
8 | + 'PILLAR_INFORMATION_TYPES', |
9 | 'PUBLIC_INFORMATION_TYPES', |
10 | 'PUBLIC_PROPRIETARY_INFORMATION_TYPES', |
11 | 'SECURITY_INFORMATION_TYPES', |
12 | @@ -67,7 +68,6 @@ |
13 | Only shared with users permitted to see embargoed information. |
14 | """) |
15 | |
16 | - |
17 | PUBLIC_INFORMATION_TYPES = ( |
18 | InformationType.PUBLIC, InformationType.PUBLICSECURITY) |
19 | |
20 | @@ -97,6 +97,9 @@ |
21 | (InformationType.PUBLIC,) + PROPRIETARY_INFORMATION_TYPES |
22 | ) |
23 | |
24 | +PILLAR_INFORMATION_TYPES = ( |
25 | + InformationType.PUBLIC, InformationType.PROPRIETARY) |
26 | + |
27 | |
28 | class ServiceUsage(DBEnumeratedType): |
29 | """Launchpad application usages. |
30 | |
31 | === modified file 'lib/lp/registry/browser/product.py' |
32 | --- lib/lp/registry/browser/product.py 2015-07-01 09:31:48 +0000 |
33 | +++ lib/lp/registry/browser/product.py 2015-07-02 02:01:38 +0000 |
34 | @@ -106,7 +106,7 @@ |
35 | from lp.app.enums import ( |
36 | InformationType, |
37 | PROPRIETARY_INFORMATION_TYPES, |
38 | - PUBLIC_PROPRIETARY_INFORMATION_TYPES, |
39 | + PILLAR_INFORMATION_TYPES, |
40 | ServiceUsage, |
41 | ) |
42 | from lp.app.errors import ( |
43 | @@ -1376,8 +1376,7 @@ |
44 | custom_widget('license_info', GhostWidget) |
45 | custom_widget( |
46 | 'information_type', LaunchpadRadioWidgetWithDescription, |
47 | - vocabulary=InformationTypeVocabulary( |
48 | - types=PUBLIC_PROPRIETARY_INFORMATION_TYPES)) |
49 | + vocabulary=InformationTypeVocabulary(types=PILLAR_INFORMATION_TYPES)) |
50 | |
51 | @property |
52 | def next_url(self): |
53 | @@ -1401,8 +1400,7 @@ |
54 | # the form is rendered during LaunchpadFormView's initialize() |
55 | # when an action is invoked. |
56 | cache = IJSONRequestCache(self.request) |
57 | - json_dump_information_types( |
58 | - cache, PUBLIC_PROPRIETARY_INFORMATION_TYPES) |
59 | + json_dump_information_types(cache, PILLAR_INFORMATION_TYPES) |
60 | super(ProductEditView, self).initialize() |
61 | |
62 | def validate(self, data): |
63 | @@ -2279,8 +2277,7 @@ |
64 | custom_widget( |
65 | 'information_type', |
66 | LaunchpadRadioWidgetWithDescription, |
67 | - vocabulary=InformationTypeVocabulary( |
68 | - types=PUBLIC_PROPRIETARY_INFORMATION_TYPES)) |
69 | + vocabulary=InformationTypeVocabulary(types=PILLAR_INFORMATION_TYPES)) |
70 | |
71 | custom_widget( |
72 | 'owner', PersonPickerWidget, header="Select the maintainer", |
73 | @@ -2299,8 +2296,7 @@ |
74 | # the form is rendered during LaunchpadFormView's initialize() |
75 | # when an action is invoked. |
76 | cache = IJSONRequestCache(self.request) |
77 | - json_dump_information_types( |
78 | - cache, PUBLIC_PROPRIETARY_INFORMATION_TYPES) |
79 | + json_dump_information_types(cache, PILLAR_INFORMATION_TYPES) |
80 | super(ProjectAddStepTwo, self).initialize() |
81 | |
82 | @property |
83 | |
84 | === modified file 'lib/lp/registry/browser/tests/test_product.py' |
85 | --- lib/lp/registry/browser/tests/test_product.py 2015-06-29 02:00:53 +0000 |
86 | +++ lib/lp/registry/browser/tests/test_product.py 2015-07-02 02:01:38 +0000 |
87 | @@ -106,12 +106,12 @@ |
88 | |
89 | def test_configure_answers_skips_launchpad_for_proprietary(self): |
90 | # Proprietary projects forbid LAUNCHPAD for answers. |
91 | - for info_type in PROPRIETARY_INFORMATION_TYPES: |
92 | - product = self.factory.makeProduct(information_type=info_type) |
93 | - with person_logged_in(None): |
94 | - browser = self.getViewBrowser(product, '+configure-answers', |
95 | - user=removeSecurityProxy(product).owner) |
96 | - self.assertThat(browser.contents, Not(HTMLContains(self.lp_tag))) |
97 | + product = self.factory.makeProduct( |
98 | + information_type=InformationType.PROPRIETARY) |
99 | + with person_logged_in(None): |
100 | + browser = self.getViewBrowser(product, '+configure-answers', |
101 | + user=removeSecurityProxy(product).owner) |
102 | + self.assertThat(browser.contents, Not(HTMLContains(self.lp_tag))) |
103 | |
104 | |
105 | def make_product_form(person=None, action=1, proprietary=False): |
106 | @@ -482,14 +482,14 @@ |
107 | } |
108 | |
109 | def test_limited_information_types_allowed(self): |
110 | - """Products can only be PUBLIC_PROPRIETARY_INFORMATION_TYPES""" |
111 | + """Products can only be PILLAR_INFORMATION_TYPES""" |
112 | product = self.factory.makeProduct() |
113 | login_person(product.owner) |
114 | view = create_initialized_view( |
115 | product, '+edit', principal=product.owner) |
116 | vocabulary = view.widgets['information_type'].vocabulary |
117 | info_types = [t.name for t in vocabulary] |
118 | - expected = ['PUBLIC', 'PROPRIETARY', 'EMBARGOED'] |
119 | + expected = ['PUBLIC', 'PROPRIETARY'] |
120 | self.assertEqual(expected, info_types) |
121 | |
122 | def test_change_information_type_proprietary(self): |
123 | @@ -683,52 +683,46 @@ |
124 | information_type=InformationType.PUBLIC, owner=owner) |
125 | proprietary = self.factory.makeProduct( |
126 | information_type=InformationType.PROPRIETARY, owner=owner) |
127 | - embargoed = self.factory.makeProduct( |
128 | - information_type=InformationType.EMBARGOED, owner=owner) |
129 | - return owner, public, proprietary, embargoed |
130 | + return owner, public, proprietary |
131 | |
132 | def test_proprietary_products_skipped(self): |
133 | # Ignore proprietary products for anonymous users |
134 | - owner, public, proprietary, embargoed = self.makeAllInformationTypes() |
135 | + owner, public, proprietary = self.makeAllInformationTypes() |
136 | browser = self.getViewBrowser(getUtility(IProductSet)) |
137 | with person_logged_in(owner): |
138 | self.assertIn(public.name, browser.contents) |
139 | self.assertNotIn(proprietary.name, browser.contents) |
140 | - self.assertNotIn(embargoed.name, browser.contents) |
141 | |
142 | def test_proprietary_products_shown_to_owners(self): |
143 | # Owners will see their proprietary products listed |
144 | - owner, public, proprietary, embargoed = self.makeAllInformationTypes() |
145 | + owner, public, proprietary = self.makeAllInformationTypes() |
146 | transaction.commit() |
147 | browser = self.getViewBrowser(getUtility(IProductSet), user=owner) |
148 | with person_logged_in(owner): |
149 | self.assertIn(public.name, browser.contents) |
150 | self.assertIn(proprietary.name, browser.contents) |
151 | - self.assertIn(embargoed.name, browser.contents) |
152 | |
153 | def test_proprietary_products_skipped_all(self): |
154 | # Ignore proprietary products for anonymous users |
155 | - owner, public, proprietary, embargoed = self.makeAllInformationTypes() |
156 | + owner, public, proprietary = self.makeAllInformationTypes() |
157 | product_set = getUtility(IProductSet) |
158 | browser = self.getViewBrowser(product_set, view_name='+all') |
159 | with person_logged_in(owner): |
160 | self.assertIn(public.name, browser.contents) |
161 | self.assertNotIn(proprietary.name, browser.contents) |
162 | - self.assertNotIn(embargoed.name, browser.contents) |
163 | |
164 | def test_proprietary_products_shown_to_owners_all(self): |
165 | # Owners will see their proprietary products listed |
166 | - owner, public, proprietary, embargoed = self.makeAllInformationTypes() |
167 | + owner, public, proprietary = self.makeAllInformationTypes() |
168 | transaction.commit() |
169 | browser = self.getViewBrowser(getUtility(IProductSet), user=owner, |
170 | view_name='+all') |
171 | with person_logged_in(owner): |
172 | self.assertIn(public.name, browser.contents) |
173 | self.assertIn(proprietary.name, browser.contents) |
174 | - self.assertIn(embargoed.name, browser.contents) |
175 | |
176 | def test_review_exclude_proprietary_for_expert(self): |
177 | - owner, public, proprietary, embargoed = self.makeAllInformationTypes() |
178 | + owner, public, proprietary = self.makeAllInformationTypes() |
179 | transaction.commit() |
180 | expert = self.factory.makeRegistryExpert() |
181 | browser = self.getViewBrowser(getUtility(IProductSet), |
182 | @@ -737,10 +731,9 @@ |
183 | with person_logged_in(owner): |
184 | self.assertIn(public.name, browser.contents) |
185 | self.assertNotIn(proprietary.name, browser.contents) |
186 | - self.assertNotIn(embargoed.name, browser.contents) |
187 | |
188 | def test_review_include_proprietary_for_admin(self): |
189 | - owner, public, proprietary, embargoed = self.makeAllInformationTypes() |
190 | + owner, public, proprietary = self.makeAllInformationTypes() |
191 | transaction.commit() |
192 | admin = self.factory.makeAdministrator() |
193 | browser = self.getViewBrowser(getUtility(IProductSet), |
194 | @@ -749,4 +742,3 @@ |
195 | with person_logged_in(owner): |
196 | self.assertIn(public.name, browser.contents) |
197 | self.assertIn(proprietary.name, browser.contents) |
198 | - self.assertIn(embargoed.name, browser.contents) |
199 | |
200 | === modified file 'lib/lp/registry/javascript/tests/test_product_views.js' |
201 | --- lib/lp/registry/javascript/tests/test_product_views.js 2013-03-20 03:41:40 +0000 |
202 | +++ lib/lp/registry/javascript/tests/test_product_views.js 2015-07-02 02:01:38 +0000 |
203 | @@ -21,11 +21,6 @@ |
204 | is_private: false, order: 1, |
205 | description: 'Public Description' |
206 | }, |
207 | - EMBARGOED: { |
208 | - value: 'EMBARGOED', name: 'Embargoed', |
209 | - is_private: true, order: 2, |
210 | - description: 'Something embargoed' |
211 | - }, |
212 | PROPRIETARY: { |
213 | value: 'PROPRIETARY', name: 'Proprietary', |
214 | is_private: true, order: 3, |
215 | @@ -50,7 +45,8 @@ |
216 | var licenses_cont = licenses.ancestor('td').ancestor('td'); |
217 | Y.Assert.areEqual('none', |
218 | licenses_cont.getComputedStyle('display'), |
219 | - 'License is hidden when EMBARGOED is selected.'); |
220 | + 'License is hidden when PROPRIETARY is ' + |
221 | + 'selected.'); |
222 | |
223 | var new_license = Y.one('input[name="field.licenses"]'); |
224 | Y.Assert.areEqual('OTHER_PROPRIETARY', new_license.get('value'), |
225 | @@ -133,7 +129,7 @@ |
226 | |
227 | // Force the value to change to a private value and make sure the |
228 | // UI is updated. |
229 | - widget._saveData('EMBARGOED'); |
230 | + widget._saveData('PROPRIETARY'); |
231 | shared.assert_license_updates(); |
232 | |
233 | var bug_super = Y.one('input[name="field.bug_supervisor"]'); |
234 | @@ -141,14 +137,14 @@ |
235 | Y.Assert.areNotEqual( |
236 | 'none', |
237 | bug_super_cont.getComputedStyle('display'), |
238 | - 'Bug Supervisor is shown when EMBARGOED is selected.'); |
239 | + 'Bug Supervisor is shown when PROPRIETARY is selected.'); |
240 | |
241 | var driver = Y.one('input[name="field.driver"]'); |
242 | var driver_cont = driver.ancestor('td'); |
243 | Y.Assert.areNotEqual( |
244 | 'none', |
245 | driver_cont.getComputedStyle('display'), |
246 | - 'Driver is shown when EMBARGOED is selected.'); |
247 | + 'Driver is shown when PROPRIETARY is selected.'); |
248 | } |
249 | })); |
250 | |
251 | @@ -180,7 +176,7 @@ |
252 | |
253 | // Force the value to change to a private value and make sure the |
254 | // UI is updated. |
255 | - widget._saveData('EMBARGOED'); |
256 | + widget._saveData('PROPRIETARY'); |
257 | shared.assert_license_updates(); |
258 | } |
259 | })); |
260 | |
261 | === modified file 'lib/lp/registry/model/product.py' |
262 | --- lib/lp/registry/model/product.py 2015-07-01 12:00:10 +0000 |
263 | +++ lib/lp/registry/model/product.py 2015-07-02 02:01:38 +0000 |
264 | @@ -70,10 +70,10 @@ |
265 | from lp.app.enums import ( |
266 | FREE_INFORMATION_TYPES, |
267 | InformationType, |
268 | + PILLAR_INFORMATION_TYPES, |
269 | PRIVATE_INFORMATION_TYPES, |
270 | PROPRIETARY_INFORMATION_TYPES, |
271 | PUBLIC_INFORMATION_TYPES, |
272 | - PUBLIC_PROPRIETARY_INFORMATION_TYPES, |
273 | service_uses_launchpad, |
274 | ServiceUsage, |
275 | ) |
276 | @@ -341,21 +341,17 @@ |
277 | bug_policy_default = { |
278 | InformationType.PUBLIC: BugSharingPolicy.PUBLIC, |
279 | InformationType.PROPRIETARY: BugSharingPolicy.PROPRIETARY, |
280 | - InformationType.EMBARGOED: BugSharingPolicy.EMBARGOED_OR_PROPRIETARY, |
281 | } |
282 | |
283 | |
284 | branch_policy_default = { |
285 | InformationType.PUBLIC: BranchSharingPolicy.PUBLIC, |
286 | - InformationType.EMBARGOED: BranchSharingPolicy.EMBARGOED_OR_PROPRIETARY, |
287 | InformationType.PROPRIETARY: BranchSharingPolicy.PROPRIETARY, |
288 | } |
289 | |
290 | |
291 | specification_policy_default = { |
292 | InformationType.PUBLIC: SpecificationSharingPolicy.PUBLIC, |
293 | - InformationType.EMBARGOED: |
294 | - SpecificationSharingPolicy.EMBARGOED_OR_PROPRIETARY, |
295 | InformationType.PROPRIETARY: SpecificationSharingPolicy.PROPRIETARY, |
296 | } |
297 | |
298 | @@ -484,7 +480,7 @@ |
299 | changed. Has the side-effect of creating a commercial subscription if |
300 | permitted. |
301 | """ |
302 | - if value not in PUBLIC_PROPRIETARY_INFORMATION_TYPES: |
303 | + if value not in PILLAR_INFORMATION_TYPES: |
304 | yield CannotChangeInformationType('Not supported for Projects.') |
305 | if value in PROPRIETARY_INFORMATION_TYPES: |
306 | if self.answers_usage == ServiceUsage.LAUNCHPAD: |
307 | @@ -1933,7 +1929,8 @@ |
308 | licenses = set() |
309 | if information_type is None: |
310 | information_type = InformationType.PUBLIC |
311 | - if information_type in PROPRIETARY_INFORMATION_TYPES: |
312 | + if (information_type in PILLAR_INFORMATION_TYPES |
313 | + and information_type in PROPRIETARY_INFORMATION_TYPES): |
314 | # This check is skipped in _valid_product_information_type during |
315 | # creation, so done here. It predicts whether a commercial |
316 | # subscription will be generated based on the selected license, |
317 | |
318 | === modified file 'lib/lp/registry/services/tests/test_sharingservice.py' |
319 | --- lib/lp/registry/services/tests/test_sharingservice.py 2015-06-26 06:32:03 +0000 |
320 | +++ lib/lp/registry/services/tests/test_sharingservice.py 2015-07-02 02:01:38 +0000 |
321 | @@ -248,7 +248,7 @@ |
322 | # proprietary. |
323 | owner = self.factory.makePerson() |
324 | product = self.factory.makeProduct( |
325 | - information_type=InformationType.EMBARGOED, |
326 | + information_type=InformationType.PROPRIETARY, |
327 | owner=owner, |
328 | branch_sharing_policy=BranchSharingPolicy.EMBARGOED_OR_PROPRIETARY) |
329 | with person_logged_in(owner): |
330 | |
331 | === modified file 'lib/lp/registry/tests/test_packaging.py' |
332 | --- lib/lp/registry/tests/test_packaging.py 2012-10-18 14:39:18 +0000 |
333 | +++ lib/lp/registry/tests/test_packaging.py 2015-07-02 02:01:38 +0000 |
334 | @@ -188,20 +188,6 @@ |
335 | series, self.sourcepackagename, self.distroseries, |
336 | PackagingType.PRIME, owner=self.owner) |
337 | |
338 | - def test_createPackaging_refuses_EMBARGOED(self): |
339 | - """Packaging cannot be created for EMBARGOED productseries""" |
340 | - owner = self.factory.makePerson() |
341 | - product = self.factory.makeProduct( |
342 | - owner=owner, |
343 | - information_type=InformationType.EMBARGOED) |
344 | - series = self.factory.makeProductSeries(product=product) |
345 | - with person_logged_in(owner): |
346 | - with ExpectedException(CannotPackageProprietaryProduct, |
347 | - 'Only Public project series can be packaged, not Embargoed.'): |
348 | - self.packaging_util.createPackaging( |
349 | - series, self.sourcepackagename, self.distroseries, |
350 | - PackagingType.PRIME, owner=self.owner) |
351 | - |
352 | |
353 | class TestPackagingEntryExists(PackagingUtilMixin, TestCaseWithFactory): |
354 | """Test PackagingUtil.packagingEntryExists.""" |
355 | |
356 | === modified file 'lib/lp/registry/tests/test_person.py' |
357 | --- lib/lp/registry/tests/test_person.py 2015-05-11 13:17:41 +0000 |
358 | +++ lib/lp/registry/tests/test_person.py 2015-07-02 02:01:38 +0000 |
359 | @@ -412,12 +412,12 @@ |
360 | user.getAffiliatedPillars(user)] |
361 | self.assertEqual(expected_pillars, received_pillars) |
362 | |
363 | - def test_getAffiliatedPillars_minus_embargoed(self): |
364 | + def test_getAffiliatedPillars_minus_proprietary(self): |
365 | # Skip non public products if not allowed to see them. |
366 | owner = self.factory.makePerson() |
367 | user = self.factory.makePerson() |
368 | self.factory.makeProduct( |
369 | - information_type=InformationType.EMBARGOED, |
370 | + information_type=InformationType.PROPRIETARY, |
371 | owner=owner) |
372 | public = self.factory.makeProduct( |
373 | information_type=InformationType.PUBLIC, |
374 | @@ -432,15 +432,15 @@ |
375 | # Users can see their own non-public affiliated products. |
376 | owner = self.factory.makePerson() |
377 | self.factory.makeProduct( |
378 | - name=u'embargoed', |
379 | - information_type=InformationType.EMBARGOED, |
380 | + name=u'proprietary', |
381 | + information_type=InformationType.PROPRIETARY, |
382 | owner=owner) |
383 | self.factory.makeProduct( |
384 | name=u'public', |
385 | information_type=InformationType.PUBLIC, |
386 | owner=owner) |
387 | |
388 | - expected_pillars = [u'embargoed', u'public'] |
389 | + expected_pillars = [u'proprietary', u'public'] |
390 | received_pillars = [pillar.name for pillar in |
391 | owner.getAffiliatedPillars(owner)] |
392 | self.assertEqual(expected_pillars, received_pillars) |
393 | @@ -450,15 +450,15 @@ |
394 | owner = self.factory.makePerson() |
395 | admin = self.factory.makeAdministrator() |
396 | self.factory.makeProduct( |
397 | - name=u'embargoed', |
398 | - information_type=InformationType.EMBARGOED, |
399 | + name=u'proprietary', |
400 | + information_type=InformationType.PROPRIETARY, |
401 | owner=owner) |
402 | self.factory.makeProduct( |
403 | name=u'public', |
404 | information_type=InformationType.PUBLIC, |
405 | owner=owner) |
406 | |
407 | - expected_pillars = [u'embargoed', u'public'] |
408 | + expected_pillars = [u'proprietary', u'public'] |
409 | received_pillars = [pillar.name for pillar in |
410 | owner.getAffiliatedPillars(admin)] |
411 | self.assertEqual(expected_pillars, received_pillars) |
412 | @@ -468,15 +468,15 @@ |
413 | owner = self.factory.makePerson() |
414 | admin = self.factory.makeCommercialAdmin() |
415 | self.factory.makeProduct( |
416 | - name=u'embargoed', |
417 | - information_type=InformationType.EMBARGOED, |
418 | + name=u'proprietary', |
419 | + information_type=InformationType.PROPRIETARY, |
420 | owner=owner) |
421 | self.factory.makeProduct( |
422 | name=u'public', |
423 | information_type=InformationType.PUBLIC, |
424 | owner=owner) |
425 | |
426 | - expected_pillars = [u'embargoed', u'public'] |
427 | + expected_pillars = [u'proprietary', u'public'] |
428 | received_pillars = [pillar.name for pillar in |
429 | owner.getAffiliatedPillars(admin)] |
430 | self.assertEqual(expected_pillars, received_pillars) |
431 | |
432 | === modified file 'lib/lp/registry/tests/test_product.py' |
433 | --- lib/lp/registry/tests/test_product.py 2015-07-01 12:00:10 +0000 |
434 | +++ lib/lp/registry/tests/test_product.py 2015-07-02 02:01:38 +0000 |
435 | @@ -27,8 +27,7 @@ |
436 | from lp.app.enums import ( |
437 | FREE_INFORMATION_TYPES, |
438 | InformationType, |
439 | - PROPRIETARY_INFORMATION_TYPES, |
440 | - PUBLIC_PROPRIETARY_INFORMATION_TYPES, |
441 | + PILLAR_INFORMATION_TYPES, |
442 | ServiceUsage, |
443 | ) |
444 | from lp.app.errors import ServiceUsageForbidden |
445 | @@ -127,6 +126,8 @@ |
446 | TranslationsBranchImportMode, |
447 | ) |
448 | |
449 | +PRIVATE_PROJECT_TYPES = [InformationType.PROPRIETARY] |
450 | + |
451 | |
452 | class ValidationTestCase(TestCase): |
453 | """Test IProduct validators.""" |
454 | @@ -383,29 +384,6 @@ |
455 | expected = [InformationType.PROPRIETARY] |
456 | self.assertContentEqual(expected, [policy.type for policy in aps]) |
457 | |
458 | - def test_embargoed_product_creation_sharing_policies(self): |
459 | - # Creating a new embargoed product sets the branch and |
460 | - # specification sharing polices to embargoed or proprietary, and the |
461 | - # bug sharing policy to proprietary. |
462 | - owner = self.factory.makePerson() |
463 | - with person_logged_in(owner): |
464 | - product = getUtility(IProductSet).createProduct( |
465 | - owner, 'carrot', 'Carrot', 'Carrot', 'testing', |
466 | - licenses=[License.OTHER_PROPRIETARY], |
467 | - information_type=InformationType.EMBARGOED) |
468 | - self.assertEqual( |
469 | - BugSharingPolicy.EMBARGOED_OR_PROPRIETARY, |
470 | - product.bug_sharing_policy) |
471 | - self.assertEqual( |
472 | - BranchSharingPolicy.EMBARGOED_OR_PROPRIETARY, |
473 | - product.branch_sharing_policy) |
474 | - self.assertEqual( |
475 | - SpecificationSharingPolicy.EMBARGOED_OR_PROPRIETARY, |
476 | - product.specification_sharing_policy) |
477 | - aps = getUtility(IAccessPolicySource).findByPillar([product]) |
478 | - expected = [InformationType.PROPRIETARY, InformationType.EMBARGOED] |
479 | - self.assertContentEqual(expected, [policy.type for policy in aps]) |
480 | - |
481 | def test_other_proprietary_product_creation_sharing_policies(self): |
482 | # Creating a new product with other/proprietary license leaves bug |
483 | # and branch sharing polices at their default. |
484 | @@ -433,7 +411,7 @@ |
485 | ) |
486 | self.useContext(person_logged_in(product.owner)) |
487 | spec = self.factory.makeSpecification(product=product) |
488 | - for info_type in PROPRIETARY_INFORMATION_TYPES: |
489 | + for info_type in PRIVATE_PROJECT_TYPES: |
490 | with ExpectedException( |
491 | CannotChangeInformationType, 'Some blueprints are public.'): |
492 | product.information_type = info_type |
493 | @@ -442,7 +420,7 @@ |
494 | bug = self.factory.makeBug(target=product) |
495 | for bug_info_type in FREE_INFORMATION_TYPES: |
496 | bug.transitionToInformationType(bug_info_type, product.owner) |
497 | - for info_type in PROPRIETARY_INFORMATION_TYPES: |
498 | + for info_type in PRIVATE_PROJECT_TYPES: |
499 | with ExpectedException( |
500 | CannotChangeInformationType, |
501 | 'Some bugs are neither proprietary nor embargoed.'): |
502 | @@ -453,14 +431,14 @@ |
503 | for branch_info_type in FREE_INFORMATION_TYPES: |
504 | branch.transitionToInformationType(branch_info_type, |
505 | product.owner) |
506 | - for info_type in PROPRIETARY_INFORMATION_TYPES: |
507 | + for info_type in PRIVATE_PROJECT_TYPES: |
508 | with ExpectedException( |
509 | CannotChangeInformationType, |
510 | 'Some branches are neither proprietary nor embargoed.'): |
511 | product.information_type = info_type |
512 | branch.transitionToInformationType(InformationType.PROPRIETARY, |
513 | product.owner) |
514 | - for info_type in PROPRIETARY_INFORMATION_TYPES: |
515 | + for info_type in PRIVATE_PROJECT_TYPES: |
516 | product.information_type = info_type |
517 | |
518 | def test_change_info_type_proprietary_check_translations(self): |
519 | @@ -470,7 +448,7 @@ |
520 | for usage in ServiceUsage: |
521 | product.information_type = InformationType.PUBLIC |
522 | product.translations_usage = usage.value |
523 | - for info_type in PROPRIETARY_INFORMATION_TYPES: |
524 | + for info_type in PRIVATE_PROJECT_TYPES: |
525 | if product.translations_usage == ServiceUsage.LAUNCHPAD: |
526 | with ExpectedException( |
527 | CannotChangeInformationType, |
528 | @@ -493,22 +471,6 @@ |
529 | SpecificationSharingPolicy.PROPRIETARY, |
530 | product.specification_sharing_policy) |
531 | |
532 | - def test_change_info_type_embargoed_sets_policies(self): |
533 | - # Changing information type from public to embargoed sets the |
534 | - # appropriate policies |
535 | - product = self.factory.makeProduct() |
536 | - with person_logged_in(product.owner): |
537 | - product.information_type = InformationType.EMBARGOED |
538 | - self.assertEqual( |
539 | - BranchSharingPolicy.EMBARGOED_OR_PROPRIETARY, |
540 | - product.branch_sharing_policy) |
541 | - self.assertEqual( |
542 | - BugSharingPolicy.EMBARGOED_OR_PROPRIETARY, |
543 | - product.bug_sharing_policy) |
544 | - self.assertEqual( |
545 | - SpecificationSharingPolicy.EMBARGOED_OR_PROPRIETARY, |
546 | - product.specification_sharing_policy) |
547 | - |
548 | def test_proprietary_to_public_leaves_policies(self): |
549 | # Changing information type from public leaves sharing policies |
550 | # unchanged. |
551 | @@ -557,11 +519,13 @@ |
552 | naked_product.information_type = InformationType.PUBLIC |
553 | self.assertIs(None, get_aps(naked_product)) |
554 | |
555 | - # Projects can also be Embargoed because of reasons. Since they |
556 | - # can have both Proprietary and Embargoed artifacts, and someone |
557 | - # who can see either needs LimitedView on the pillar they're on, |
558 | - # both policies are permissible. |
559 | - naked_product.information_type = InformationType.EMBARGOED |
560 | + # Proprietary projects can have both Proprietary and Embargoed |
561 | + # artifacts, and someone who can see either needs LimitedView on |
562 | + # the pillar they're on. So both policies are permissible if |
563 | + # they exist. |
564 | + naked_product.information_type = InformationType.PROPRIETARY |
565 | + naked_product.setBugSharingPolicy( |
566 | + BugSharingPolicy.EMBARGOED_OR_PROPRIETARY) |
567 | [emb_policy] = aps.find([(product, InformationType.EMBARGOED)]) |
568 | self.assertContentEqual( |
569 | [prop_policy.id, emb_policy.id], get_aps(naked_product)) |
570 | @@ -574,7 +538,7 @@ |
571 | for policy in (token.value for token in TeamMembershipPolicy): |
572 | with person_logged_in(team.teamowner): |
573 | team.membership_policy = policy |
574 | - for info_type in PROPRIETARY_INFORMATION_TYPES: |
575 | + for info_type in PRIVATE_PROJECT_TYPES: |
576 | with person_logged_in(product.owner): |
577 | errors = list(product.checkInformationType(info_type)) |
578 | if policy in EXCLUSIVE_TEAM_POLICY: |
579 | @@ -588,12 +552,12 @@ |
580 | def test_checkInformationType_questions(self): |
581 | # Proprietary products must not have questions. |
582 | product = self.factory.makeProduct() |
583 | - for info_type in PROPRIETARY_INFORMATION_TYPES: |
584 | + for info_type in PRIVATE_PROJECT_TYPES: |
585 | with person_logged_in(product.owner): |
586 | self.assertEqual([], |
587 | list(product.checkInformationType(info_type))) |
588 | self.factory.makeQuestion(target=product) |
589 | - for info_type in PROPRIETARY_INFORMATION_TYPES: |
590 | + for info_type in PRIVATE_PROJECT_TYPES: |
591 | with person_logged_in(product.owner): |
592 | error, = list(product.checkInformationType(info_type)) |
593 | with ExpectedException( |
594 | @@ -604,12 +568,12 @@ |
595 | # Proprietary products must not have translations. |
596 | productseries = self.factory.makeProductSeries() |
597 | product = productseries.product |
598 | - for info_type in PROPRIETARY_INFORMATION_TYPES: |
599 | + for info_type in PRIVATE_PROJECT_TYPES: |
600 | with person_logged_in(product.owner): |
601 | self.assertEqual([], |
602 | list(product.checkInformationType(info_type))) |
603 | self.factory.makePOTemplate(productseries=productseries) |
604 | - for info_type in PROPRIETARY_INFORMATION_TYPES: |
605 | + for info_type in PRIVATE_PROJECT_TYPES: |
606 | with person_logged_in(product.owner): |
607 | error, = list(product.checkInformationType(info_type)) |
608 | with ExpectedException( |
609 | @@ -622,7 +586,7 @@ |
610 | product = productseries.product |
611 | entry = self.factory.makeTranslationImportQueueEntry( |
612 | productseries=productseries) |
613 | - for info_type in PROPRIETARY_INFORMATION_TYPES: |
614 | + for info_type in PRIVATE_PROJECT_TYPES: |
615 | with person_logged_in(product.owner): |
616 | error, = list(product.checkInformationType(info_type)) |
617 | with ExpectedException( |
618 | @@ -631,7 +595,7 @@ |
619 | raise error |
620 | removeSecurityProxy(entry).delete(entry.id) |
621 | with person_logged_in(product.owner): |
622 | - for info_type in PROPRIETARY_INFORMATION_TYPES: |
623 | + for info_type in PRIVATE_PROJECT_TYPES: |
624 | self.assertContentEqual( |
625 | [], product.checkInformationType(info_type)) |
626 | |
627 | @@ -644,7 +608,7 @@ |
628 | if mode == TranslationsBranchImportMode.NO_IMPORT: |
629 | continue |
630 | productseries.translations_autoimport_mode = mode |
631 | - for info_type in PROPRIETARY_INFORMATION_TYPES: |
632 | + for info_type in PRIVATE_PROJECT_TYPES: |
633 | error, = list(product.checkInformationType(info_type)) |
634 | with ExpectedException( |
635 | CannotChangeInformationType, |
636 | @@ -652,7 +616,7 @@ |
637 | raise error |
638 | productseries.translations_autoimport_mode = ( |
639 | TranslationsBranchImportMode.NO_IMPORT) |
640 | - for info_type in PROPRIETARY_INFORMATION_TYPES: |
641 | + for info_type in PRIVATE_PROJECT_TYPES: |
642 | self.assertContentEqual( |
643 | [], product.checkInformationType(info_type)) |
644 | |
645 | @@ -664,7 +628,7 @@ |
646 | with person_logged_in(series.owner): |
647 | bug.addTask(series.owner, series) |
648 | bug.default_bugtask.delete() |
649 | - for info_type in PROPRIETARY_INFORMATION_TYPES: |
650 | + for info_type in PRIVATE_PROJECT_TYPES: |
651 | error, = list(series.product.checkInformationType(info_type)) |
652 | with ExpectedException( |
653 | CannotChangeInformationType, |
654 | @@ -675,7 +639,7 @@ |
655 | owner = self.factory.makePerson() |
656 | product = self.factory.makeProduct(owner=owner) |
657 | self.useContext(person_logged_in(owner)) |
658 | - for info_type in PROPRIETARY_INFORMATION_TYPES: |
659 | + for info_type in PRIVATE_PROJECT_TYPES: |
660 | product.information_type = info_type |
661 | with ExpectedException( |
662 | ProprietaryProduct, |
663 | @@ -703,35 +667,35 @@ |
664 | def test_product_information_type(self): |
665 | # Product is created with specified information_type |
666 | product = self.createProduct( |
667 | - information_type=InformationType.EMBARGOED, |
668 | + information_type=InformationType.PROPRIETARY, |
669 | license=License.OTHER_PROPRIETARY) |
670 | - self.assertEqual(InformationType.EMBARGOED, product.information_type) |
671 | + self.assertEqual(InformationType.PROPRIETARY, product.information_type) |
672 | # Owner can set information_type |
673 | with person_logged_in(removeSecurityProxy(product).owner): |
674 | - product.information_type = InformationType.PROPRIETARY |
675 | - self.assertEqual(InformationType.PROPRIETARY, product.information_type) |
676 | + product.information_type = InformationType.PUBLIC |
677 | + self.assertEqual(InformationType.PUBLIC, product.information_type) |
678 | # Database persists information_type value |
679 | store = Store.of(product) |
680 | store.flush() |
681 | store.reset() |
682 | product = store.get(Product, product.id) |
683 | - self.assertEqual(InformationType.PROPRIETARY, product.information_type) |
684 | - self.assertTrue(product.private) |
685 | + self.assertEqual(InformationType.PUBLIC, product.information_type) |
686 | + self.assertFalse(product.private) |
687 | |
688 | def test_switching_product_to_public_does_not_create_policy(self): |
689 | - # Creating a Embargoed product and switching it to Public does not |
690 | - # create a PUBLIC AccessPolicy. |
691 | + # Creating a Proprietary product and switching it to Public does |
692 | + # not create a PUBLIC AccessPolicy. |
693 | product = self.createProduct( |
694 | - information_type=InformationType.EMBARGOED, |
695 | + information_type=InformationType.PROPRIETARY, |
696 | license=License.OTHER_PROPRIETARY) |
697 | aps = getUtility(IAccessPolicySource).findByPillar([product]) |
698 | self.assertContentEqual( |
699 | - [InformationType.PROPRIETARY, InformationType.EMBARGOED], |
700 | + [InformationType.PROPRIETARY], |
701 | [ap.type for ap in aps]) |
702 | removeSecurityProxy(product).information_type = InformationType.PUBLIC |
703 | aps = getUtility(IAccessPolicySource).findByPillar([product]) |
704 | self.assertContentEqual( |
705 | - [InformationType.PROPRIETARY, InformationType.EMBARGOED], |
706 | + [InformationType.PROPRIETARY], |
707 | [ap.type for ap in aps]) |
708 | |
709 | def test_product_information_type_default(self): |
710 | @@ -742,9 +706,9 @@ |
711 | self.assertEqual(InformationType.PUBLIC, product.information_type) |
712 | self.assertFalse(product.private) |
713 | |
714 | - invalid_information_types = [info_type for info_type in |
715 | - InformationType.items if info_type not in |
716 | - PUBLIC_PROPRIETARY_INFORMATION_TYPES] |
717 | + invalid_information_types = [ |
718 | + info_type for info_type in InformationType.items |
719 | + if info_type not in PILLAR_INFORMATION_TYPES] |
720 | |
721 | def test_product_information_type_init_invalid_values(self): |
722 | # Cannot create Product.information_type with invalid values. |
723 | @@ -796,41 +760,39 @@ |
724 | |
725 | # However we can't change it back to a Proprietary because our |
726 | # commercial subscription has expired. |
727 | - for info_type in PROPRIETARY_INFORMATION_TYPES: |
728 | - with ExpectedException( |
729 | + with ExpectedException( |
730 | CommercialSubscribersOnly, |
731 | 'A valid commercial subscription is required for private' |
732 | ' Projects.'): |
733 | - product.information_type = info_type |
734 | + product.information_type = InformationType.PROPRIETARY |
735 | |
736 | def test_product_information_init_proprietary_requires_commercial(self): |
737 | # Cannot create a product with proprietary types without specifying |
738 | # Other/Proprietary license. |
739 | - for info_type in PROPRIETARY_INFORMATION_TYPES: |
740 | - with ExpectedException( |
741 | + with ExpectedException( |
742 | CommercialSubscribersOnly, |
743 | 'A valid commercial subscription is required for private' |
744 | ' Projects.'): |
745 | - self.createProduct(info_type) |
746 | - for info_type in PROPRIETARY_INFORMATION_TYPES: |
747 | - product = self.createProduct(info_type, License.OTHER_PROPRIETARY) |
748 | - self.assertEqual(info_type, product.information_type) |
749 | + self.createProduct(InformationType.PROPRIETARY) |
750 | + product = self.createProduct( |
751 | + InformationType.PROPRIETARY, License.OTHER_PROPRIETARY) |
752 | + self.assertEqual(InformationType.PROPRIETARY, product.information_type) |
753 | |
754 | def test_no_answers_for_proprietary(self): |
755 | # Enabling Answers is forbidden while information_type is proprietary. |
756 | - for info_type in PROPRIETARY_INFORMATION_TYPES: |
757 | - product = self.factory.makeProduct(information_type=info_type) |
758 | - with person_logged_in(removeSecurityProxy(product).owner): |
759 | - self.assertEqual(ServiceUsage.UNKNOWN, product.answers_usage) |
760 | - for usage in ServiceUsage.items: |
761 | - if usage == ServiceUsage.LAUNCHPAD: |
762 | - with ExpectedException( |
763 | - ServiceUsageForbidden, |
764 | - "Answers not allowed for non-public projects."): |
765 | - product.answers_usage = ServiceUsage.LAUNCHPAD |
766 | - else: |
767 | - # all other values are permitted. |
768 | - product.answers_usage = usage |
769 | + product = self.factory.makeProduct( |
770 | + information_type=InformationType.PROPRIETARY) |
771 | + with person_logged_in(removeSecurityProxy(product).owner): |
772 | + self.assertEqual(ServiceUsage.UNKNOWN, product.answers_usage) |
773 | + for usage in ServiceUsage.items: |
774 | + if usage == ServiceUsage.LAUNCHPAD: |
775 | + with ExpectedException( |
776 | + ServiceUsageForbidden, |
777 | + "Answers not allowed for non-public projects."): |
778 | + product.answers_usage = ServiceUsage.LAUNCHPAD |
779 | + else: |
780 | + # all other values are permitted. |
781 | + product.answers_usage = usage |
782 | |
783 | def test_answers_for_public(self): |
784 | # Enabling answers is permitted while information_type is PUBLIC. |
785 | @@ -1265,14 +1227,14 @@ |
786 | # Access policies for Product.information_type are not pruned. |
787 | owner = self.factory.makePerson() |
788 | product = self.factory.makeProduct( |
789 | - information_type=InformationType.EMBARGOED, owner=owner) |
790 | + information_type=InformationType.PROPRIETARY, owner=owner) |
791 | with person_logged_in(owner): |
792 | - product.setBugSharingPolicy(BugSharingPolicy.PROPRIETARY) |
793 | + product.setBugSharingPolicy(BugSharingPolicy.FORBIDDEN) |
794 | product.setSpecificationSharingPolicy( |
795 | - SpecificationSharingPolicy.PROPRIETARY) |
796 | - product.setBranchSharingPolicy(BranchSharingPolicy.PROPRIETARY) |
797 | + SpecificationSharingPolicy.FORBIDDEN) |
798 | + product.setBranchSharingPolicy(BranchSharingPolicy.FORBIDDEN) |
799 | self.assertIsNot(None, getUtility(IAccessPolicySource).find( |
800 | - [(product, InformationType.EMBARGOED)]).one()) |
801 | + [(product, InformationType.PROPRIETARY)]).one()) |
802 | |
803 | |
804 | class TestProductBugInformationTypes(TestCaseWithFactory): |
805 | @@ -1833,12 +1795,6 @@ |
806 | with ExpectedException( |
807 | ProprietaryProduct, "The project is Proprietary."): |
808 | self.setSharingPolicy(policy, owner) |
809 | - with person_logged_in(owner): |
810 | - self.product.information_type = InformationType.EMBARGOED |
811 | - for policy in policies_permitting_public: |
812 | - with ExpectedException( |
813 | - ProprietaryProduct, "The project is Embargoed."): |
814 | - self.setSharingPolicy(policy, owner) |
815 | |
816 | |
817 | class ProductBugSharingPolicyTestCase(BaseSharingPolicyTests, |
818 | @@ -2255,11 +2211,9 @@ |
819 | def makeAllInformationTypes(self): |
820 | proprietary = self.factory.makeProduct( |
821 | information_type=InformationType.PROPRIETARY) |
822 | - embargoed = self.factory.makeProduct( |
823 | - information_type=InformationType.EMBARGOED) |
824 | public = self.factory.makeProduct( |
825 | information_type=InformationType.PUBLIC) |
826 | - return proprietary, embargoed, public |
827 | + return proprietary, public |
828 | |
829 | @staticmethod |
830 | def filterFind(user): |
831 | @@ -2275,22 +2229,15 @@ |
832 | proprietary = self.factory.makeProduct( |
833 | information_type=InformationType.PROPRIETARY, |
834 | owner=owner) |
835 | - embargoed = self.factory.makeProduct( |
836 | - information_type=InformationType.EMBARGOED, |
837 | - owner=owner) |
838 | result = ProductSet.get_users_private_products(owner) |
839 | self.assertIn(proprietary, result) |
840 | - self.assertIn(embargoed, result) |
841 | |
842 | def test_get_all_active_omits_proprietary(self): |
843 | # Ignore proprietary products for anonymous users |
844 | proprietary = self.factory.makeProduct( |
845 | information_type=InformationType.PROPRIETARY) |
846 | - embargoed = self.factory.makeProduct( |
847 | - information_type=InformationType.EMBARGOED) |
848 | result = ProductSet.get_all_active(None) |
849 | self.assertNotIn(proprietary, result) |
850 | - self.assertNotIn(embargoed, result) |
851 | |
852 | def test_search_respects_privacy(self): |
853 | # Proprietary products are filtered from the results for people who |
854 | @@ -2305,19 +2252,17 @@ |
855 | |
856 | def test_getProductPrivacyFilterAnonymous(self): |
857 | # Ignore proprietary products for anonymous users |
858 | - proprietary, embargoed, public = self.makeAllInformationTypes() |
859 | + proprietary, public = self.makeAllInformationTypes() |
860 | result = self.filterFind(None) |
861 | self.assertIn(public, result) |
862 | - self.assertNotIn(embargoed, result) |
863 | self.assertNotIn(proprietary, result) |
864 | |
865 | def test_getProductPrivacyFilter_excludes_random_users(self): |
866 | # Exclude proprietary products for anonymous users |
867 | random = self.factory.makePerson() |
868 | - proprietary, embargoed, public = self.makeAllInformationTypes() |
869 | + proprietary, public = self.makeAllInformationTypes() |
870 | result = self.filterFind(random) |
871 | self.assertIn(public, result) |
872 | - self.assertNotIn(embargoed, result) |
873 | self.assertNotIn(proprietary, result) |
874 | |
875 | def grant(self, pillar, information_type, grantee): |
876 | @@ -2329,61 +2274,53 @@ |
877 | def test_getProductPrivacyFilter_respects_grants(self): |
878 | # Include proprietary products for users with right grants. |
879 | grantee = self.factory.makePerson() |
880 | - proprietary, embargoed, public = self.makeAllInformationTypes() |
881 | - self.grant(embargoed, InformationType.EMBARGOED, grantee) |
882 | + proprietary, public = self.makeAllInformationTypes() |
883 | self.grant(proprietary, InformationType.PROPRIETARY, grantee) |
884 | result = self.filterFind(grantee) |
885 | self.assertIn(public, result) |
886 | - self.assertIn(embargoed, result) |
887 | self.assertIn(proprietary, result) |
888 | |
889 | def test_getProductPrivacyFilter_ignores_wrong_product(self): |
890 | # Exclude proprietary products if grant is on wrong product. |
891 | grantee = self.factory.makePerson() |
892 | - proprietary, embargoed, public = self.makeAllInformationTypes() |
893 | + proprietary, public = self.makeAllInformationTypes() |
894 | self.factory.makeAccessPolicyGrant(grantee=grantee) |
895 | result = self.filterFind(grantee) |
896 | self.assertIn(public, result) |
897 | - self.assertNotIn(embargoed, result) |
898 | self.assertNotIn(proprietary, result) |
899 | |
900 | def test_getProductPrivacyFilter_ignores_wrong_info_type(self): |
901 | # Exclude proprietary products if grant is on wrong information type. |
902 | grantee = self.factory.makePerson() |
903 | - proprietary, embargoed, public = self.makeAllInformationTypes() |
904 | + proprietary, public = self.makeAllInformationTypes() |
905 | self.factory.makeAccessPolicy( |
906 | proprietary, InformationType.PRIVATESECURITY) |
907 | self.grant(proprietary, InformationType.PRIVATESECURITY, grantee) |
908 | result = self.filterFind(grantee) |
909 | self.assertIn(public, result) |
910 | - self.assertNotIn(embargoed, result) |
911 | self.assertNotIn(proprietary, result) |
912 | |
913 | def test_getProductPrivacyFilter_respects_team_grants(self): |
914 | # Include proprietary products for users in teams with right grants. |
915 | grantee = self.factory.makeTeam() |
916 | - proprietary, embargoed, public = self.makeAllInformationTypes() |
917 | - self.grant(embargoed, InformationType.EMBARGOED, grantee) |
918 | + proprietary, public = self.makeAllInformationTypes() |
919 | self.grant(proprietary, InformationType.PROPRIETARY, grantee) |
920 | result = self.filterFind(grantee.teamowner) |
921 | self.assertIn(public, result) |
922 | - self.assertIn(embargoed, result) |
923 | self.assertIn(proprietary, result) |
924 | |
925 | def test_getProductPrivacyFilter_includes_admins(self): |
926 | # Launchpad admins can see everything. |
927 | - proprietary, embargoed, public = self.makeAllInformationTypes() |
928 | + proprietary, public = self.makeAllInformationTypes() |
929 | result = self.filterFind(self.factory.makeAdministrator()) |
930 | self.assertIn(public, result) |
931 | - self.assertIn(embargoed, result) |
932 | self.assertIn(proprietary, result) |
933 | |
934 | def test_getProductPrivacyFilter_includes_commercial_admins(self): |
935 | # Commercial admins can see everything. |
936 | - proprietary, embargoed, public = self.makeAllInformationTypes() |
937 | + proprietary, public = self.makeAllInformationTypes() |
938 | result = self.filterFind(self.factory.makeCommercialAdmin()) |
939 | self.assertIn(public, result) |
940 | - self.assertIn(embargoed, result) |
941 | self.assertIn(proprietary, result) |
942 | |
943 | |
944 | |
945 | === modified file 'lib/lp/registry/tests/test_product_vocabularies.py' |
946 | --- lib/lp/registry/tests/test_product_vocabularies.py 2012-10-19 10:34:55 +0000 |
947 | +++ lib/lp/registry/tests/test_product_vocabularies.py 2015-07-02 02:01:38 +0000 |
948 | @@ -104,10 +104,6 @@ |
949 | # Embargoed and proprietary products are only returned if |
950 | # the current user can see them. |
951 | public_product = self.factory.makeProduct('quux-public') |
952 | - embargoed_owner = self.factory.makePerson() |
953 | - embargoed_product = self.factory.makeProduct( |
954 | - name='quux-embargoed', owner=embargoed_owner, |
955 | - information_type=InformationType.EMBARGOED) |
956 | proprietary_owner = self.factory.makePerson() |
957 | proprietary_product = self.factory.makeProduct( |
958 | name='quux-proprietary', owner=proprietary_owner, |
959 | @@ -125,17 +121,17 @@ |
960 | self.assertEqual([public_product], list(result)) |
961 | |
962 | # People with grants on a private product can see this product. |
963 | - with person_logged_in(embargoed_owner): |
964 | + with person_logged_in(proprietary_owner): |
965 | getUtility(IService, 'sharing').sharePillarInformation( |
966 | - embargoed_product, user, embargoed_owner, |
967 | - {InformationType.EMBARGOED: SharingPermission.ALL}) |
968 | + proprietary_product, user, proprietary_owner, |
969 | + {InformationType.PROPRIETARY: SharingPermission.ALL}) |
970 | with person_logged_in(user): |
971 | result = self.vocabulary.search('quux') |
972 | - self.assertEqual([embargoed_product, public_product], list(result)) |
973 | + self.assertEqual( |
974 | + [proprietary_product, public_product], list(result)) |
975 | |
976 | # Admins can see all products. |
977 | with celebrity_logged_in('admin'): |
978 | result = self.vocabulary.search('quux') |
979 | self.assertEqual( |
980 | - [embargoed_product, proprietary_product, public_product], |
981 | - list(result)) |
982 | + [proprietary_product, public_product], list(result)) |
983 | |
984 | === modified file 'lib/lp/registry/tests/test_productseries.py' |
985 | --- lib/lp/registry/tests/test_productseries.py 2015-01-29 14:14:01 +0000 |
986 | +++ lib/lp/registry/tests/test_productseries.py 2015-07-02 02:01:38 +0000 |
987 | @@ -16,10 +16,7 @@ |
988 | from zope.security.interfaces import Unauthorized |
989 | from zope.security.proxy import removeSecurityProxy |
990 | |
991 | -from lp.app.enums import ( |
992 | - InformationType, |
993 | - PROPRIETARY_INFORMATION_TYPES, |
994 | - ) |
995 | +from lp.app.enums import InformationType |
996 | from lp.app.interfaces.informationtype import IInformationType |
997 | from lp.app.interfaces.services import IService |
998 | from lp.registry.enums import SharingPermission |
999 | @@ -74,15 +71,14 @@ |
1000 | # Autoimports are forbidden if products are proprietary/embargoed. |
1001 | series = self.factory.makeProductSeries() |
1002 | self.useContext(person_logged_in(series.product.owner)) |
1003 | - for info_type in PROPRIETARY_INFORMATION_TYPES: |
1004 | - series.product.information_type = info_type |
1005 | - for mode in TranslationsBranchImportMode.items: |
1006 | - if mode == TranslationsBranchImportMode.NO_IMPORT: |
1007 | - continue |
1008 | - with ExpectedException(ProprietaryProduct, |
1009 | - 'Translations are disabled for proprietary' |
1010 | - ' projects.'): |
1011 | - series.translations_autoimport_mode = mode |
1012 | + series.product.information_type = InformationType.PROPRIETARY |
1013 | + for mode in TranslationsBranchImportMode.items: |
1014 | + if mode == TranslationsBranchImportMode.NO_IMPORT: |
1015 | + continue |
1016 | + with ExpectedException(ProprietaryProduct, |
1017 | + 'Translations are disabled for proprietary' |
1018 | + ' projects.'): |
1019 | + series.translations_autoimport_mode = mode |
1020 | |
1021 | |
1022 | class ProductSeriesReleasesTestCase(TestCaseWithFactory): |
1023 | @@ -201,17 +197,6 @@ |
1024 | series.setPackaging( |
1025 | sp.distroseries, sp.sourcepackagename, series.owner) |
1026 | |
1027 | - def test_refuses_EMBARGOED(self): |
1028 | - """Packaging cannot be created for EMBARGOED productseries""" |
1029 | - product = self.factory.makeProduct( |
1030 | - information_type=InformationType.EMBARGOED) |
1031 | - sp = self.makeSourcePackage() |
1032 | - series = self.factory.makeProductSeries(product=product) |
1033 | - with ExpectedException(CannotPackageProprietaryProduct, |
1034 | - 'Only Public project series can be packaged, not Embargoed.'): |
1035 | - series.setPackaging( |
1036 | - sp.distroseries, sp.sourcepackagename, series.owner) |
1037 | - |
1038 | def test_setPackaging_two_packagings(self): |
1039 | # More than one sourcepackage from the same distroseries |
1040 | # can be linked to a productseries. |
1041 | |
1042 | === modified file 'lib/lp/translations/browser/tests/test_product_view.py' |
1043 | --- lib/lp/translations/browser/tests/test_product_view.py 2014-02-19 04:01:46 +0000 |
1044 | +++ lib/lp/translations/browser/tests/test_product_view.py 2015-07-02 02:01:38 +0000 |
1045 | @@ -12,7 +12,7 @@ |
1046 | |
1047 | from lp.app.enums import ( |
1048 | InformationType, |
1049 | - PUBLIC_PROPRIETARY_INFORMATION_TYPES, |
1050 | + PILLAR_INFORMATION_TYPES, |
1051 | ServiceUsage, |
1052 | ) |
1053 | from lp.registry.interfaces.series import SeriesStatus |
1054 | @@ -132,7 +132,7 @@ |
1055 | def test_launchpad_not_listed_for_proprietary(self): |
1056 | product = self.factory.makeProduct() |
1057 | with person_logged_in(product.owner): |
1058 | - for info_type in PUBLIC_PROPRIETARY_INFORMATION_TYPES: |
1059 | + for info_type in PILLAR_INFORMATION_TYPES: |
1060 | product.information_type = info_type |
1061 | view = create_initialized_view( |
1062 | product, '+configure-translations') |
The product_ _valid_ information_ type constraint should also be changed, possibly after this is deployed.