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 | 11 | 'NON_EMBARGOED_INFORMATION_TYPES', | 11 | 'NON_EMBARGOED_INFORMATION_TYPES', |
6 | 12 | 'PRIVATE_INFORMATION_TYPES', | 12 | 'PRIVATE_INFORMATION_TYPES', |
7 | 13 | 'PROPRIETARY_INFORMATION_TYPES', | 13 | 'PROPRIETARY_INFORMATION_TYPES', |
8 | 14 | 'PILLAR_INFORMATION_TYPES', | ||
9 | 14 | 'PUBLIC_INFORMATION_TYPES', | 15 | 'PUBLIC_INFORMATION_TYPES', |
10 | 15 | 'PUBLIC_PROPRIETARY_INFORMATION_TYPES', | 16 | 'PUBLIC_PROPRIETARY_INFORMATION_TYPES', |
11 | 16 | 'SECURITY_INFORMATION_TYPES', | 17 | 'SECURITY_INFORMATION_TYPES', |
12 | @@ -67,7 +68,6 @@ | |||
13 | 67 | Only shared with users permitted to see embargoed information. | 68 | Only shared with users permitted to see embargoed information. |
14 | 68 | """) | 69 | """) |
15 | 69 | 70 | ||
16 | 70 | |||
17 | 71 | PUBLIC_INFORMATION_TYPES = ( | 71 | PUBLIC_INFORMATION_TYPES = ( |
18 | 72 | InformationType.PUBLIC, InformationType.PUBLICSECURITY) | 72 | InformationType.PUBLIC, InformationType.PUBLICSECURITY) |
19 | 73 | 73 | ||
20 | @@ -97,6 +97,9 @@ | |||
21 | 97 | (InformationType.PUBLIC,) + PROPRIETARY_INFORMATION_TYPES | 97 | (InformationType.PUBLIC,) + PROPRIETARY_INFORMATION_TYPES |
22 | 98 | ) | 98 | ) |
23 | 99 | 99 | ||
24 | 100 | PILLAR_INFORMATION_TYPES = ( | ||
25 | 101 | InformationType.PUBLIC, InformationType.PROPRIETARY) | ||
26 | 102 | |||
27 | 100 | 103 | ||
28 | 101 | class ServiceUsage(DBEnumeratedType): | 104 | class ServiceUsage(DBEnumeratedType): |
29 | 102 | """Launchpad application usages. | 105 | """Launchpad application usages. |
30 | 103 | 106 | ||
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 | 106 | from lp.app.enums import ( | 106 | from lp.app.enums import ( |
36 | 107 | InformationType, | 107 | InformationType, |
37 | 108 | PROPRIETARY_INFORMATION_TYPES, | 108 | PROPRIETARY_INFORMATION_TYPES, |
39 | 109 | PUBLIC_PROPRIETARY_INFORMATION_TYPES, | 109 | PILLAR_INFORMATION_TYPES, |
40 | 110 | ServiceUsage, | 110 | ServiceUsage, |
41 | 111 | ) | 111 | ) |
42 | 112 | from lp.app.errors import ( | 112 | from lp.app.errors import ( |
43 | @@ -1376,8 +1376,7 @@ | |||
44 | 1376 | custom_widget('license_info', GhostWidget) | 1376 | custom_widget('license_info', GhostWidget) |
45 | 1377 | custom_widget( | 1377 | custom_widget( |
46 | 1378 | 'information_type', LaunchpadRadioWidgetWithDescription, | 1378 | 'information_type', LaunchpadRadioWidgetWithDescription, |
49 | 1379 | vocabulary=InformationTypeVocabulary( | 1379 | vocabulary=InformationTypeVocabulary(types=PILLAR_INFORMATION_TYPES)) |
48 | 1380 | types=PUBLIC_PROPRIETARY_INFORMATION_TYPES)) | ||
50 | 1381 | 1380 | ||
51 | 1382 | @property | 1381 | @property |
52 | 1383 | def next_url(self): | 1382 | def next_url(self): |
53 | @@ -1401,8 +1400,7 @@ | |||
54 | 1401 | # the form is rendered during LaunchpadFormView's initialize() | 1400 | # the form is rendered during LaunchpadFormView's initialize() |
55 | 1402 | # when an action is invoked. | 1401 | # when an action is invoked. |
56 | 1403 | cache = IJSONRequestCache(self.request) | 1402 | cache = IJSONRequestCache(self.request) |
59 | 1404 | json_dump_information_types( | 1403 | json_dump_information_types(cache, PILLAR_INFORMATION_TYPES) |
58 | 1405 | cache, PUBLIC_PROPRIETARY_INFORMATION_TYPES) | ||
60 | 1406 | super(ProductEditView, self).initialize() | 1404 | super(ProductEditView, self).initialize() |
61 | 1407 | 1405 | ||
62 | 1408 | def validate(self, data): | 1406 | def validate(self, data): |
63 | @@ -2279,8 +2277,7 @@ | |||
64 | 2279 | custom_widget( | 2277 | custom_widget( |
65 | 2280 | 'information_type', | 2278 | 'information_type', |
66 | 2281 | LaunchpadRadioWidgetWithDescription, | 2279 | LaunchpadRadioWidgetWithDescription, |
69 | 2282 | vocabulary=InformationTypeVocabulary( | 2280 | vocabulary=InformationTypeVocabulary(types=PILLAR_INFORMATION_TYPES)) |
68 | 2283 | types=PUBLIC_PROPRIETARY_INFORMATION_TYPES)) | ||
70 | 2284 | 2281 | ||
71 | 2285 | custom_widget( | 2282 | custom_widget( |
72 | 2286 | 'owner', PersonPickerWidget, header="Select the maintainer", | 2283 | 'owner', PersonPickerWidget, header="Select the maintainer", |
73 | @@ -2299,8 +2296,7 @@ | |||
74 | 2299 | # the form is rendered during LaunchpadFormView's initialize() | 2296 | # the form is rendered during LaunchpadFormView's initialize() |
75 | 2300 | # when an action is invoked. | 2297 | # when an action is invoked. |
76 | 2301 | cache = IJSONRequestCache(self.request) | 2298 | cache = IJSONRequestCache(self.request) |
79 | 2302 | json_dump_information_types( | 2299 | json_dump_information_types(cache, PILLAR_INFORMATION_TYPES) |
78 | 2303 | cache, PUBLIC_PROPRIETARY_INFORMATION_TYPES) | ||
80 | 2304 | super(ProjectAddStepTwo, self).initialize() | 2300 | super(ProjectAddStepTwo, self).initialize() |
81 | 2305 | 2301 | ||
82 | 2306 | @property | 2302 | @property |
83 | 2307 | 2303 | ||
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 | 106 | 106 | ||
89 | 107 | def test_configure_answers_skips_launchpad_for_proprietary(self): | 107 | def test_configure_answers_skips_launchpad_for_proprietary(self): |
90 | 108 | # Proprietary projects forbid LAUNCHPAD for answers. | 108 | # Proprietary projects forbid LAUNCHPAD for answers. |
97 | 109 | for info_type in PROPRIETARY_INFORMATION_TYPES: | 109 | product = self.factory.makeProduct( |
98 | 110 | product = self.factory.makeProduct(information_type=info_type) | 110 | information_type=InformationType.PROPRIETARY) |
99 | 111 | with person_logged_in(None): | 111 | with person_logged_in(None): |
100 | 112 | browser = self.getViewBrowser(product, '+configure-answers', | 112 | browser = self.getViewBrowser(product, '+configure-answers', |
101 | 113 | user=removeSecurityProxy(product).owner) | 113 | user=removeSecurityProxy(product).owner) |
102 | 114 | self.assertThat(browser.contents, Not(HTMLContains(self.lp_tag))) | 114 | self.assertThat(browser.contents, Not(HTMLContains(self.lp_tag))) |
103 | 115 | 115 | ||
104 | 116 | 116 | ||
105 | 117 | def make_product_form(person=None, action=1, proprietary=False): | 117 | def make_product_form(person=None, action=1, proprietary=False): |
106 | @@ -482,14 +482,14 @@ | |||
107 | 482 | } | 482 | } |
108 | 483 | 483 | ||
109 | 484 | def test_limited_information_types_allowed(self): | 484 | def test_limited_information_types_allowed(self): |
111 | 485 | """Products can only be PUBLIC_PROPRIETARY_INFORMATION_TYPES""" | 485 | """Products can only be PILLAR_INFORMATION_TYPES""" |
112 | 486 | product = self.factory.makeProduct() | 486 | product = self.factory.makeProduct() |
113 | 487 | login_person(product.owner) | 487 | login_person(product.owner) |
114 | 488 | view = create_initialized_view( | 488 | view = create_initialized_view( |
115 | 489 | product, '+edit', principal=product.owner) | 489 | product, '+edit', principal=product.owner) |
116 | 490 | vocabulary = view.widgets['information_type'].vocabulary | 490 | vocabulary = view.widgets['information_type'].vocabulary |
117 | 491 | info_types = [t.name for t in vocabulary] | 491 | info_types = [t.name for t in vocabulary] |
119 | 492 | expected = ['PUBLIC', 'PROPRIETARY', 'EMBARGOED'] | 492 | expected = ['PUBLIC', 'PROPRIETARY'] |
120 | 493 | self.assertEqual(expected, info_types) | 493 | self.assertEqual(expected, info_types) |
121 | 494 | 494 | ||
122 | 495 | def test_change_information_type_proprietary(self): | 495 | def test_change_information_type_proprietary(self): |
123 | @@ -683,52 +683,46 @@ | |||
124 | 683 | information_type=InformationType.PUBLIC, owner=owner) | 683 | information_type=InformationType.PUBLIC, owner=owner) |
125 | 684 | proprietary = self.factory.makeProduct( | 684 | proprietary = self.factory.makeProduct( |
126 | 685 | information_type=InformationType.PROPRIETARY, owner=owner) | 685 | information_type=InformationType.PROPRIETARY, owner=owner) |
130 | 686 | embargoed = self.factory.makeProduct( | 686 | return owner, public, proprietary |
128 | 687 | information_type=InformationType.EMBARGOED, owner=owner) | ||
129 | 688 | return owner, public, proprietary, embargoed | ||
131 | 689 | 687 | ||
132 | 690 | def test_proprietary_products_skipped(self): | 688 | def test_proprietary_products_skipped(self): |
133 | 691 | # Ignore proprietary products for anonymous users | 689 | # Ignore proprietary products for anonymous users |
135 | 692 | owner, public, proprietary, embargoed = self.makeAllInformationTypes() | 690 | owner, public, proprietary = self.makeAllInformationTypes() |
136 | 693 | browser = self.getViewBrowser(getUtility(IProductSet)) | 691 | browser = self.getViewBrowser(getUtility(IProductSet)) |
137 | 694 | with person_logged_in(owner): | 692 | with person_logged_in(owner): |
138 | 695 | self.assertIn(public.name, browser.contents) | 693 | self.assertIn(public.name, browser.contents) |
139 | 696 | self.assertNotIn(proprietary.name, browser.contents) | 694 | self.assertNotIn(proprietary.name, browser.contents) |
140 | 697 | self.assertNotIn(embargoed.name, browser.contents) | ||
141 | 698 | 695 | ||
142 | 699 | def test_proprietary_products_shown_to_owners(self): | 696 | def test_proprietary_products_shown_to_owners(self): |
143 | 700 | # Owners will see their proprietary products listed | 697 | # Owners will see their proprietary products listed |
145 | 701 | owner, public, proprietary, embargoed = self.makeAllInformationTypes() | 698 | owner, public, proprietary = self.makeAllInformationTypes() |
146 | 702 | transaction.commit() | 699 | transaction.commit() |
147 | 703 | browser = self.getViewBrowser(getUtility(IProductSet), user=owner) | 700 | browser = self.getViewBrowser(getUtility(IProductSet), user=owner) |
148 | 704 | with person_logged_in(owner): | 701 | with person_logged_in(owner): |
149 | 705 | self.assertIn(public.name, browser.contents) | 702 | self.assertIn(public.name, browser.contents) |
150 | 706 | self.assertIn(proprietary.name, browser.contents) | 703 | self.assertIn(proprietary.name, browser.contents) |
151 | 707 | self.assertIn(embargoed.name, browser.contents) | ||
152 | 708 | 704 | ||
153 | 709 | def test_proprietary_products_skipped_all(self): | 705 | def test_proprietary_products_skipped_all(self): |
154 | 710 | # Ignore proprietary products for anonymous users | 706 | # Ignore proprietary products for anonymous users |
156 | 711 | owner, public, proprietary, embargoed = self.makeAllInformationTypes() | 707 | owner, public, proprietary = self.makeAllInformationTypes() |
157 | 712 | product_set = getUtility(IProductSet) | 708 | product_set = getUtility(IProductSet) |
158 | 713 | browser = self.getViewBrowser(product_set, view_name='+all') | 709 | browser = self.getViewBrowser(product_set, view_name='+all') |
159 | 714 | with person_logged_in(owner): | 710 | with person_logged_in(owner): |
160 | 715 | self.assertIn(public.name, browser.contents) | 711 | self.assertIn(public.name, browser.contents) |
161 | 716 | self.assertNotIn(proprietary.name, browser.contents) | 712 | self.assertNotIn(proprietary.name, browser.contents) |
162 | 717 | self.assertNotIn(embargoed.name, browser.contents) | ||
163 | 718 | 713 | ||
164 | 719 | def test_proprietary_products_shown_to_owners_all(self): | 714 | def test_proprietary_products_shown_to_owners_all(self): |
165 | 720 | # Owners will see their proprietary products listed | 715 | # Owners will see their proprietary products listed |
167 | 721 | owner, public, proprietary, embargoed = self.makeAllInformationTypes() | 716 | owner, public, proprietary = self.makeAllInformationTypes() |
168 | 722 | transaction.commit() | 717 | transaction.commit() |
169 | 723 | browser = self.getViewBrowser(getUtility(IProductSet), user=owner, | 718 | browser = self.getViewBrowser(getUtility(IProductSet), user=owner, |
170 | 724 | view_name='+all') | 719 | view_name='+all') |
171 | 725 | with person_logged_in(owner): | 720 | with person_logged_in(owner): |
172 | 726 | self.assertIn(public.name, browser.contents) | 721 | self.assertIn(public.name, browser.contents) |
173 | 727 | self.assertIn(proprietary.name, browser.contents) | 722 | self.assertIn(proprietary.name, browser.contents) |
174 | 728 | self.assertIn(embargoed.name, browser.contents) | ||
175 | 729 | 723 | ||
176 | 730 | def test_review_exclude_proprietary_for_expert(self): | 724 | def test_review_exclude_proprietary_for_expert(self): |
178 | 731 | owner, public, proprietary, embargoed = self.makeAllInformationTypes() | 725 | owner, public, proprietary = self.makeAllInformationTypes() |
179 | 732 | transaction.commit() | 726 | transaction.commit() |
180 | 733 | expert = self.factory.makeRegistryExpert() | 727 | expert = self.factory.makeRegistryExpert() |
181 | 734 | browser = self.getViewBrowser(getUtility(IProductSet), | 728 | browser = self.getViewBrowser(getUtility(IProductSet), |
182 | @@ -737,10 +731,9 @@ | |||
183 | 737 | with person_logged_in(owner): | 731 | with person_logged_in(owner): |
184 | 738 | self.assertIn(public.name, browser.contents) | 732 | self.assertIn(public.name, browser.contents) |
185 | 739 | self.assertNotIn(proprietary.name, browser.contents) | 733 | self.assertNotIn(proprietary.name, browser.contents) |
186 | 740 | self.assertNotIn(embargoed.name, browser.contents) | ||
187 | 741 | 734 | ||
188 | 742 | def test_review_include_proprietary_for_admin(self): | 735 | def test_review_include_proprietary_for_admin(self): |
190 | 743 | owner, public, proprietary, embargoed = self.makeAllInformationTypes() | 736 | owner, public, proprietary = self.makeAllInformationTypes() |
191 | 744 | transaction.commit() | 737 | transaction.commit() |
192 | 745 | admin = self.factory.makeAdministrator() | 738 | admin = self.factory.makeAdministrator() |
193 | 746 | browser = self.getViewBrowser(getUtility(IProductSet), | 739 | browser = self.getViewBrowser(getUtility(IProductSet), |
194 | @@ -749,4 +742,3 @@ | |||
195 | 749 | with person_logged_in(owner): | 742 | with person_logged_in(owner): |
196 | 750 | self.assertIn(public.name, browser.contents) | 743 | self.assertIn(public.name, browser.contents) |
197 | 751 | self.assertIn(proprietary.name, browser.contents) | 744 | self.assertIn(proprietary.name, browser.contents) |
198 | 752 | self.assertIn(embargoed.name, browser.contents) | ||
199 | 753 | 745 | ||
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 | 21 | is_private: false, order: 1, | 21 | is_private: false, order: 1, |
205 | 22 | description: 'Public Description' | 22 | description: 'Public Description' |
206 | 23 | }, | 23 | }, |
207 | 24 | EMBARGOED: { | ||
208 | 25 | value: 'EMBARGOED', name: 'Embargoed', | ||
209 | 26 | is_private: true, order: 2, | ||
210 | 27 | description: 'Something embargoed' | ||
211 | 28 | }, | ||
212 | 29 | PROPRIETARY: { | 24 | PROPRIETARY: { |
213 | 30 | value: 'PROPRIETARY', name: 'Proprietary', | 25 | value: 'PROPRIETARY', name: 'Proprietary', |
214 | 31 | is_private: true, order: 3, | 26 | is_private: true, order: 3, |
215 | @@ -50,7 +45,8 @@ | |||
216 | 50 | var licenses_cont = licenses.ancestor('td').ancestor('td'); | 45 | var licenses_cont = licenses.ancestor('td').ancestor('td'); |
217 | 51 | Y.Assert.areEqual('none', | 46 | Y.Assert.areEqual('none', |
218 | 52 | licenses_cont.getComputedStyle('display'), | 47 | licenses_cont.getComputedStyle('display'), |
220 | 53 | 'License is hidden when EMBARGOED is selected.'); | 48 | 'License is hidden when PROPRIETARY is ' + |
221 | 49 | 'selected.'); | ||
222 | 54 | 50 | ||
223 | 55 | var new_license = Y.one('input[name="field.licenses"]'); | 51 | var new_license = Y.one('input[name="field.licenses"]'); |
224 | 56 | Y.Assert.areEqual('OTHER_PROPRIETARY', new_license.get('value'), | 52 | Y.Assert.areEqual('OTHER_PROPRIETARY', new_license.get('value'), |
225 | @@ -133,7 +129,7 @@ | |||
226 | 133 | 129 | ||
227 | 134 | // Force the value to change to a private value and make sure the | 130 | // Force the value to change to a private value and make sure the |
228 | 135 | // UI is updated. | 131 | // UI is updated. |
230 | 136 | widget._saveData('EMBARGOED'); | 132 | widget._saveData('PROPRIETARY'); |
231 | 137 | shared.assert_license_updates(); | 133 | shared.assert_license_updates(); |
232 | 138 | 134 | ||
233 | 139 | var bug_super = Y.one('input[name="field.bug_supervisor"]'); | 135 | var bug_super = Y.one('input[name="field.bug_supervisor"]'); |
234 | @@ -141,14 +137,14 @@ | |||
235 | 141 | Y.Assert.areNotEqual( | 137 | Y.Assert.areNotEqual( |
236 | 142 | 'none', | 138 | 'none', |
237 | 143 | bug_super_cont.getComputedStyle('display'), | 139 | bug_super_cont.getComputedStyle('display'), |
239 | 144 | 'Bug Supervisor is shown when EMBARGOED is selected.'); | 140 | 'Bug Supervisor is shown when PROPRIETARY is selected.'); |
240 | 145 | 141 | ||
241 | 146 | var driver = Y.one('input[name="field.driver"]'); | 142 | var driver = Y.one('input[name="field.driver"]'); |
242 | 147 | var driver_cont = driver.ancestor('td'); | 143 | var driver_cont = driver.ancestor('td'); |
243 | 148 | Y.Assert.areNotEqual( | 144 | Y.Assert.areNotEqual( |
244 | 149 | 'none', | 145 | 'none', |
245 | 150 | driver_cont.getComputedStyle('display'), | 146 | driver_cont.getComputedStyle('display'), |
247 | 151 | 'Driver is shown when EMBARGOED is selected.'); | 147 | 'Driver is shown when PROPRIETARY is selected.'); |
248 | 152 | } | 148 | } |
249 | 153 | })); | 149 | })); |
250 | 154 | 150 | ||
251 | @@ -180,7 +176,7 @@ | |||
252 | 180 | 176 | ||
253 | 181 | // Force the value to change to a private value and make sure the | 177 | // Force the value to change to a private value and make sure the |
254 | 182 | // UI is updated. | 178 | // UI is updated. |
256 | 183 | widget._saveData('EMBARGOED'); | 179 | widget._saveData('PROPRIETARY'); |
257 | 184 | shared.assert_license_updates(); | 180 | shared.assert_license_updates(); |
258 | 185 | } | 181 | } |
259 | 186 | })); | 182 | })); |
260 | 187 | 183 | ||
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 | 70 | from lp.app.enums import ( | 70 | from lp.app.enums import ( |
266 | 71 | FREE_INFORMATION_TYPES, | 71 | FREE_INFORMATION_TYPES, |
267 | 72 | InformationType, | 72 | InformationType, |
268 | 73 | PILLAR_INFORMATION_TYPES, | ||
269 | 73 | PRIVATE_INFORMATION_TYPES, | 74 | PRIVATE_INFORMATION_TYPES, |
270 | 74 | PROPRIETARY_INFORMATION_TYPES, | 75 | PROPRIETARY_INFORMATION_TYPES, |
271 | 75 | PUBLIC_INFORMATION_TYPES, | 76 | PUBLIC_INFORMATION_TYPES, |
272 | 76 | PUBLIC_PROPRIETARY_INFORMATION_TYPES, | ||
273 | 77 | service_uses_launchpad, | 77 | service_uses_launchpad, |
274 | 78 | ServiceUsage, | 78 | ServiceUsage, |
275 | 79 | ) | 79 | ) |
276 | @@ -341,21 +341,17 @@ | |||
277 | 341 | bug_policy_default = { | 341 | bug_policy_default = { |
278 | 342 | InformationType.PUBLIC: BugSharingPolicy.PUBLIC, | 342 | InformationType.PUBLIC: BugSharingPolicy.PUBLIC, |
279 | 343 | InformationType.PROPRIETARY: BugSharingPolicy.PROPRIETARY, | 343 | InformationType.PROPRIETARY: BugSharingPolicy.PROPRIETARY, |
280 | 344 | InformationType.EMBARGOED: BugSharingPolicy.EMBARGOED_OR_PROPRIETARY, | ||
281 | 345 | } | 344 | } |
282 | 346 | 345 | ||
283 | 347 | 346 | ||
284 | 348 | branch_policy_default = { | 347 | branch_policy_default = { |
285 | 349 | InformationType.PUBLIC: BranchSharingPolicy.PUBLIC, | 348 | InformationType.PUBLIC: BranchSharingPolicy.PUBLIC, |
286 | 350 | InformationType.EMBARGOED: BranchSharingPolicy.EMBARGOED_OR_PROPRIETARY, | ||
287 | 351 | InformationType.PROPRIETARY: BranchSharingPolicy.PROPRIETARY, | 349 | InformationType.PROPRIETARY: BranchSharingPolicy.PROPRIETARY, |
288 | 352 | } | 350 | } |
289 | 353 | 351 | ||
290 | 354 | 352 | ||
291 | 355 | specification_policy_default = { | 353 | specification_policy_default = { |
292 | 356 | InformationType.PUBLIC: SpecificationSharingPolicy.PUBLIC, | 354 | InformationType.PUBLIC: SpecificationSharingPolicy.PUBLIC, |
293 | 357 | InformationType.EMBARGOED: | ||
294 | 358 | SpecificationSharingPolicy.EMBARGOED_OR_PROPRIETARY, | ||
295 | 359 | InformationType.PROPRIETARY: SpecificationSharingPolicy.PROPRIETARY, | 355 | InformationType.PROPRIETARY: SpecificationSharingPolicy.PROPRIETARY, |
296 | 360 | } | 356 | } |
297 | 361 | 357 | ||
298 | @@ -484,7 +480,7 @@ | |||
299 | 484 | changed. Has the side-effect of creating a commercial subscription if | 480 | changed. Has the side-effect of creating a commercial subscription if |
300 | 485 | permitted. | 481 | permitted. |
301 | 486 | """ | 482 | """ |
303 | 487 | if value not in PUBLIC_PROPRIETARY_INFORMATION_TYPES: | 483 | if value not in PILLAR_INFORMATION_TYPES: |
304 | 488 | yield CannotChangeInformationType('Not supported for Projects.') | 484 | yield CannotChangeInformationType('Not supported for Projects.') |
305 | 489 | if value in PROPRIETARY_INFORMATION_TYPES: | 485 | if value in PROPRIETARY_INFORMATION_TYPES: |
306 | 490 | if self.answers_usage == ServiceUsage.LAUNCHPAD: | 486 | if self.answers_usage == ServiceUsage.LAUNCHPAD: |
307 | @@ -1933,7 +1929,8 @@ | |||
308 | 1933 | licenses = set() | 1929 | licenses = set() |
309 | 1934 | if information_type is None: | 1930 | if information_type is None: |
310 | 1935 | information_type = InformationType.PUBLIC | 1931 | information_type = InformationType.PUBLIC |
312 | 1936 | if information_type in PROPRIETARY_INFORMATION_TYPES: | 1932 | if (information_type in PILLAR_INFORMATION_TYPES |
313 | 1933 | and information_type in PROPRIETARY_INFORMATION_TYPES): | ||
314 | 1937 | # This check is skipped in _valid_product_information_type during | 1934 | # This check is skipped in _valid_product_information_type during |
315 | 1938 | # creation, so done here. It predicts whether a commercial | 1935 | # creation, so done here. It predicts whether a commercial |
316 | 1939 | # subscription will be generated based on the selected license, | 1936 | # subscription will be generated based on the selected license, |
317 | 1940 | 1937 | ||
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 | 248 | # proprietary. | 248 | # proprietary. |
323 | 249 | owner = self.factory.makePerson() | 249 | owner = self.factory.makePerson() |
324 | 250 | product = self.factory.makeProduct( | 250 | product = self.factory.makeProduct( |
326 | 251 | information_type=InformationType.EMBARGOED, | 251 | information_type=InformationType.PROPRIETARY, |
327 | 252 | owner=owner, | 252 | owner=owner, |
328 | 253 | branch_sharing_policy=BranchSharingPolicy.EMBARGOED_OR_PROPRIETARY) | 253 | branch_sharing_policy=BranchSharingPolicy.EMBARGOED_OR_PROPRIETARY) |
329 | 254 | with person_logged_in(owner): | 254 | with person_logged_in(owner): |
330 | 255 | 255 | ||
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 | 188 | series, self.sourcepackagename, self.distroseries, | 188 | series, self.sourcepackagename, self.distroseries, |
336 | 189 | PackagingType.PRIME, owner=self.owner) | 189 | PackagingType.PRIME, owner=self.owner) |
337 | 190 | 190 | ||
338 | 191 | def test_createPackaging_refuses_EMBARGOED(self): | ||
339 | 192 | """Packaging cannot be created for EMBARGOED productseries""" | ||
340 | 193 | owner = self.factory.makePerson() | ||
341 | 194 | product = self.factory.makeProduct( | ||
342 | 195 | owner=owner, | ||
343 | 196 | information_type=InformationType.EMBARGOED) | ||
344 | 197 | series = self.factory.makeProductSeries(product=product) | ||
345 | 198 | with person_logged_in(owner): | ||
346 | 199 | with ExpectedException(CannotPackageProprietaryProduct, | ||
347 | 200 | 'Only Public project series can be packaged, not Embargoed.'): | ||
348 | 201 | self.packaging_util.createPackaging( | ||
349 | 202 | series, self.sourcepackagename, self.distroseries, | ||
350 | 203 | PackagingType.PRIME, owner=self.owner) | ||
351 | 204 | |||
352 | 205 | 191 | ||
353 | 206 | class TestPackagingEntryExists(PackagingUtilMixin, TestCaseWithFactory): | 192 | class TestPackagingEntryExists(PackagingUtilMixin, TestCaseWithFactory): |
354 | 207 | """Test PackagingUtil.packagingEntryExists.""" | 193 | """Test PackagingUtil.packagingEntryExists.""" |
355 | 208 | 194 | ||
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 | 412 | user.getAffiliatedPillars(user)] | 412 | user.getAffiliatedPillars(user)] |
361 | 413 | self.assertEqual(expected_pillars, received_pillars) | 413 | self.assertEqual(expected_pillars, received_pillars) |
362 | 414 | 414 | ||
364 | 415 | def test_getAffiliatedPillars_minus_embargoed(self): | 415 | def test_getAffiliatedPillars_minus_proprietary(self): |
365 | 416 | # Skip non public products if not allowed to see them. | 416 | # Skip non public products if not allowed to see them. |
366 | 417 | owner = self.factory.makePerson() | 417 | owner = self.factory.makePerson() |
367 | 418 | user = self.factory.makePerson() | 418 | user = self.factory.makePerson() |
368 | 419 | self.factory.makeProduct( | 419 | self.factory.makeProduct( |
370 | 420 | information_type=InformationType.EMBARGOED, | 420 | information_type=InformationType.PROPRIETARY, |
371 | 421 | owner=owner) | 421 | owner=owner) |
372 | 422 | public = self.factory.makeProduct( | 422 | public = self.factory.makeProduct( |
373 | 423 | information_type=InformationType.PUBLIC, | 423 | information_type=InformationType.PUBLIC, |
374 | @@ -432,15 +432,15 @@ | |||
375 | 432 | # Users can see their own non-public affiliated products. | 432 | # Users can see their own non-public affiliated products. |
376 | 433 | owner = self.factory.makePerson() | 433 | owner = self.factory.makePerson() |
377 | 434 | self.factory.makeProduct( | 434 | self.factory.makeProduct( |
380 | 435 | name=u'embargoed', | 435 | name=u'proprietary', |
381 | 436 | information_type=InformationType.EMBARGOED, | 436 | information_type=InformationType.PROPRIETARY, |
382 | 437 | owner=owner) | 437 | owner=owner) |
383 | 438 | self.factory.makeProduct( | 438 | self.factory.makeProduct( |
384 | 439 | name=u'public', | 439 | name=u'public', |
385 | 440 | information_type=InformationType.PUBLIC, | 440 | information_type=InformationType.PUBLIC, |
386 | 441 | owner=owner) | 441 | owner=owner) |
387 | 442 | 442 | ||
389 | 443 | expected_pillars = [u'embargoed', u'public'] | 443 | expected_pillars = [u'proprietary', u'public'] |
390 | 444 | received_pillars = [pillar.name for pillar in | 444 | received_pillars = [pillar.name for pillar in |
391 | 445 | owner.getAffiliatedPillars(owner)] | 445 | owner.getAffiliatedPillars(owner)] |
392 | 446 | self.assertEqual(expected_pillars, received_pillars) | 446 | self.assertEqual(expected_pillars, received_pillars) |
393 | @@ -450,15 +450,15 @@ | |||
394 | 450 | owner = self.factory.makePerson() | 450 | owner = self.factory.makePerson() |
395 | 451 | admin = self.factory.makeAdministrator() | 451 | admin = self.factory.makeAdministrator() |
396 | 452 | self.factory.makeProduct( | 452 | self.factory.makeProduct( |
399 | 453 | name=u'embargoed', | 453 | name=u'proprietary', |
400 | 454 | information_type=InformationType.EMBARGOED, | 454 | information_type=InformationType.PROPRIETARY, |
401 | 455 | owner=owner) | 455 | owner=owner) |
402 | 456 | self.factory.makeProduct( | 456 | self.factory.makeProduct( |
403 | 457 | name=u'public', | 457 | name=u'public', |
404 | 458 | information_type=InformationType.PUBLIC, | 458 | information_type=InformationType.PUBLIC, |
405 | 459 | owner=owner) | 459 | owner=owner) |
406 | 460 | 460 | ||
408 | 461 | expected_pillars = [u'embargoed', u'public'] | 461 | expected_pillars = [u'proprietary', u'public'] |
409 | 462 | received_pillars = [pillar.name for pillar in | 462 | received_pillars = [pillar.name for pillar in |
410 | 463 | owner.getAffiliatedPillars(admin)] | 463 | owner.getAffiliatedPillars(admin)] |
411 | 464 | self.assertEqual(expected_pillars, received_pillars) | 464 | self.assertEqual(expected_pillars, received_pillars) |
412 | @@ -468,15 +468,15 @@ | |||
413 | 468 | owner = self.factory.makePerson() | 468 | owner = self.factory.makePerson() |
414 | 469 | admin = self.factory.makeCommercialAdmin() | 469 | admin = self.factory.makeCommercialAdmin() |
415 | 470 | self.factory.makeProduct( | 470 | self.factory.makeProduct( |
418 | 471 | name=u'embargoed', | 471 | name=u'proprietary', |
419 | 472 | information_type=InformationType.EMBARGOED, | 472 | information_type=InformationType.PROPRIETARY, |
420 | 473 | owner=owner) | 473 | owner=owner) |
421 | 474 | self.factory.makeProduct( | 474 | self.factory.makeProduct( |
422 | 475 | name=u'public', | 475 | name=u'public', |
423 | 476 | information_type=InformationType.PUBLIC, | 476 | information_type=InformationType.PUBLIC, |
424 | 477 | owner=owner) | 477 | owner=owner) |
425 | 478 | 478 | ||
427 | 479 | expected_pillars = [u'embargoed', u'public'] | 479 | expected_pillars = [u'proprietary', u'public'] |
428 | 480 | received_pillars = [pillar.name for pillar in | 480 | received_pillars = [pillar.name for pillar in |
429 | 481 | owner.getAffiliatedPillars(admin)] | 481 | owner.getAffiliatedPillars(admin)] |
430 | 482 | self.assertEqual(expected_pillars, received_pillars) | 482 | self.assertEqual(expected_pillars, received_pillars) |
431 | 483 | 483 | ||
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 | 27 | from lp.app.enums import ( | 27 | from lp.app.enums import ( |
437 | 28 | FREE_INFORMATION_TYPES, | 28 | FREE_INFORMATION_TYPES, |
438 | 29 | InformationType, | 29 | InformationType, |
441 | 30 | PROPRIETARY_INFORMATION_TYPES, | 30 | PILLAR_INFORMATION_TYPES, |
440 | 31 | PUBLIC_PROPRIETARY_INFORMATION_TYPES, | ||
442 | 32 | ServiceUsage, | 31 | ServiceUsage, |
443 | 33 | ) | 32 | ) |
444 | 34 | from lp.app.errors import ServiceUsageForbidden | 33 | from lp.app.errors import ServiceUsageForbidden |
445 | @@ -127,6 +126,8 @@ | |||
446 | 127 | TranslationsBranchImportMode, | 126 | TranslationsBranchImportMode, |
447 | 128 | ) | 127 | ) |
448 | 129 | 128 | ||
449 | 129 | PRIVATE_PROJECT_TYPES = [InformationType.PROPRIETARY] | ||
450 | 130 | |||
451 | 130 | 131 | ||
452 | 131 | class ValidationTestCase(TestCase): | 132 | class ValidationTestCase(TestCase): |
453 | 132 | """Test IProduct validators.""" | 133 | """Test IProduct validators.""" |
454 | @@ -383,29 +384,6 @@ | |||
455 | 383 | expected = [InformationType.PROPRIETARY] | 384 | expected = [InformationType.PROPRIETARY] |
456 | 384 | self.assertContentEqual(expected, [policy.type for policy in aps]) | 385 | self.assertContentEqual(expected, [policy.type for policy in aps]) |
457 | 385 | 386 | ||
458 | 386 | def test_embargoed_product_creation_sharing_policies(self): | ||
459 | 387 | # Creating a new embargoed product sets the branch and | ||
460 | 388 | # specification sharing polices to embargoed or proprietary, and the | ||
461 | 389 | # bug sharing policy to proprietary. | ||
462 | 390 | owner = self.factory.makePerson() | ||
463 | 391 | with person_logged_in(owner): | ||
464 | 392 | product = getUtility(IProductSet).createProduct( | ||
465 | 393 | owner, 'carrot', 'Carrot', 'Carrot', 'testing', | ||
466 | 394 | licenses=[License.OTHER_PROPRIETARY], | ||
467 | 395 | information_type=InformationType.EMBARGOED) | ||
468 | 396 | self.assertEqual( | ||
469 | 397 | BugSharingPolicy.EMBARGOED_OR_PROPRIETARY, | ||
470 | 398 | product.bug_sharing_policy) | ||
471 | 399 | self.assertEqual( | ||
472 | 400 | BranchSharingPolicy.EMBARGOED_OR_PROPRIETARY, | ||
473 | 401 | product.branch_sharing_policy) | ||
474 | 402 | self.assertEqual( | ||
475 | 403 | SpecificationSharingPolicy.EMBARGOED_OR_PROPRIETARY, | ||
476 | 404 | product.specification_sharing_policy) | ||
477 | 405 | aps = getUtility(IAccessPolicySource).findByPillar([product]) | ||
478 | 406 | expected = [InformationType.PROPRIETARY, InformationType.EMBARGOED] | ||
479 | 407 | self.assertContentEqual(expected, [policy.type for policy in aps]) | ||
480 | 408 | |||
481 | 409 | def test_other_proprietary_product_creation_sharing_policies(self): | 387 | def test_other_proprietary_product_creation_sharing_policies(self): |
482 | 410 | # Creating a new product with other/proprietary license leaves bug | 388 | # Creating a new product with other/proprietary license leaves bug |
483 | 411 | # and branch sharing polices at their default. | 389 | # and branch sharing polices at their default. |
484 | @@ -433,7 +411,7 @@ | |||
485 | 433 | ) | 411 | ) |
486 | 434 | self.useContext(person_logged_in(product.owner)) | 412 | self.useContext(person_logged_in(product.owner)) |
487 | 435 | spec = self.factory.makeSpecification(product=product) | 413 | spec = self.factory.makeSpecification(product=product) |
489 | 436 | for info_type in PROPRIETARY_INFORMATION_TYPES: | 414 | for info_type in PRIVATE_PROJECT_TYPES: |
490 | 437 | with ExpectedException( | 415 | with ExpectedException( |
491 | 438 | CannotChangeInformationType, 'Some blueprints are public.'): | 416 | CannotChangeInformationType, 'Some blueprints are public.'): |
492 | 439 | product.information_type = info_type | 417 | product.information_type = info_type |
493 | @@ -442,7 +420,7 @@ | |||
494 | 442 | bug = self.factory.makeBug(target=product) | 420 | bug = self.factory.makeBug(target=product) |
495 | 443 | for bug_info_type in FREE_INFORMATION_TYPES: | 421 | for bug_info_type in FREE_INFORMATION_TYPES: |
496 | 444 | bug.transitionToInformationType(bug_info_type, product.owner) | 422 | bug.transitionToInformationType(bug_info_type, product.owner) |
498 | 445 | for info_type in PROPRIETARY_INFORMATION_TYPES: | 423 | for info_type in PRIVATE_PROJECT_TYPES: |
499 | 446 | with ExpectedException( | 424 | with ExpectedException( |
500 | 447 | CannotChangeInformationType, | 425 | CannotChangeInformationType, |
501 | 448 | 'Some bugs are neither proprietary nor embargoed.'): | 426 | 'Some bugs are neither proprietary nor embargoed.'): |
502 | @@ -453,14 +431,14 @@ | |||
503 | 453 | for branch_info_type in FREE_INFORMATION_TYPES: | 431 | for branch_info_type in FREE_INFORMATION_TYPES: |
504 | 454 | branch.transitionToInformationType(branch_info_type, | 432 | branch.transitionToInformationType(branch_info_type, |
505 | 455 | product.owner) | 433 | product.owner) |
507 | 456 | for info_type in PROPRIETARY_INFORMATION_TYPES: | 434 | for info_type in PRIVATE_PROJECT_TYPES: |
508 | 457 | with ExpectedException( | 435 | with ExpectedException( |
509 | 458 | CannotChangeInformationType, | 436 | CannotChangeInformationType, |
510 | 459 | 'Some branches are neither proprietary nor embargoed.'): | 437 | 'Some branches are neither proprietary nor embargoed.'): |
511 | 460 | product.information_type = info_type | 438 | product.information_type = info_type |
512 | 461 | branch.transitionToInformationType(InformationType.PROPRIETARY, | 439 | branch.transitionToInformationType(InformationType.PROPRIETARY, |
513 | 462 | product.owner) | 440 | product.owner) |
515 | 463 | for info_type in PROPRIETARY_INFORMATION_TYPES: | 441 | for info_type in PRIVATE_PROJECT_TYPES: |
516 | 464 | product.information_type = info_type | 442 | product.information_type = info_type |
517 | 465 | 443 | ||
518 | 466 | def test_change_info_type_proprietary_check_translations(self): | 444 | def test_change_info_type_proprietary_check_translations(self): |
519 | @@ -470,7 +448,7 @@ | |||
520 | 470 | for usage in ServiceUsage: | 448 | for usage in ServiceUsage: |
521 | 471 | product.information_type = InformationType.PUBLIC | 449 | product.information_type = InformationType.PUBLIC |
522 | 472 | product.translations_usage = usage.value | 450 | product.translations_usage = usage.value |
524 | 473 | for info_type in PROPRIETARY_INFORMATION_TYPES: | 451 | for info_type in PRIVATE_PROJECT_TYPES: |
525 | 474 | if product.translations_usage == ServiceUsage.LAUNCHPAD: | 452 | if product.translations_usage == ServiceUsage.LAUNCHPAD: |
526 | 475 | with ExpectedException( | 453 | with ExpectedException( |
527 | 476 | CannotChangeInformationType, | 454 | CannotChangeInformationType, |
528 | @@ -493,22 +471,6 @@ | |||
529 | 493 | SpecificationSharingPolicy.PROPRIETARY, | 471 | SpecificationSharingPolicy.PROPRIETARY, |
530 | 494 | product.specification_sharing_policy) | 472 | product.specification_sharing_policy) |
531 | 495 | 473 | ||
532 | 496 | def test_change_info_type_embargoed_sets_policies(self): | ||
533 | 497 | # Changing information type from public to embargoed sets the | ||
534 | 498 | # appropriate policies | ||
535 | 499 | product = self.factory.makeProduct() | ||
536 | 500 | with person_logged_in(product.owner): | ||
537 | 501 | product.information_type = InformationType.EMBARGOED | ||
538 | 502 | self.assertEqual( | ||
539 | 503 | BranchSharingPolicy.EMBARGOED_OR_PROPRIETARY, | ||
540 | 504 | product.branch_sharing_policy) | ||
541 | 505 | self.assertEqual( | ||
542 | 506 | BugSharingPolicy.EMBARGOED_OR_PROPRIETARY, | ||
543 | 507 | product.bug_sharing_policy) | ||
544 | 508 | self.assertEqual( | ||
545 | 509 | SpecificationSharingPolicy.EMBARGOED_OR_PROPRIETARY, | ||
546 | 510 | product.specification_sharing_policy) | ||
547 | 511 | |||
548 | 512 | def test_proprietary_to_public_leaves_policies(self): | 474 | def test_proprietary_to_public_leaves_policies(self): |
549 | 513 | # Changing information type from public leaves sharing policies | 475 | # Changing information type from public leaves sharing policies |
550 | 514 | # unchanged. | 476 | # unchanged. |
551 | @@ -557,11 +519,13 @@ | |||
552 | 557 | naked_product.information_type = InformationType.PUBLIC | 519 | naked_product.information_type = InformationType.PUBLIC |
553 | 558 | self.assertIs(None, get_aps(naked_product)) | 520 | self.assertIs(None, get_aps(naked_product)) |
554 | 559 | 521 | ||
560 | 560 | # Projects can also be Embargoed because of reasons. Since they | 522 | # Proprietary projects can have both Proprietary and Embargoed |
561 | 561 | # can have both Proprietary and Embargoed artifacts, and someone | 523 | # artifacts, and someone who can see either needs LimitedView on |
562 | 562 | # who can see either needs LimitedView on the pillar they're on, | 524 | # the pillar they're on. So both policies are permissible if |
563 | 563 | # both policies are permissible. | 525 | # they exist. |
564 | 564 | naked_product.information_type = InformationType.EMBARGOED | 526 | naked_product.information_type = InformationType.PROPRIETARY |
565 | 527 | naked_product.setBugSharingPolicy( | ||
566 | 528 | BugSharingPolicy.EMBARGOED_OR_PROPRIETARY) | ||
567 | 565 | [emb_policy] = aps.find([(product, InformationType.EMBARGOED)]) | 529 | [emb_policy] = aps.find([(product, InformationType.EMBARGOED)]) |
568 | 566 | self.assertContentEqual( | 530 | self.assertContentEqual( |
569 | 567 | [prop_policy.id, emb_policy.id], get_aps(naked_product)) | 531 | [prop_policy.id, emb_policy.id], get_aps(naked_product)) |
570 | @@ -574,7 +538,7 @@ | |||
571 | 574 | for policy in (token.value for token in TeamMembershipPolicy): | 538 | for policy in (token.value for token in TeamMembershipPolicy): |
572 | 575 | with person_logged_in(team.teamowner): | 539 | with person_logged_in(team.teamowner): |
573 | 576 | team.membership_policy = policy | 540 | team.membership_policy = policy |
575 | 577 | for info_type in PROPRIETARY_INFORMATION_TYPES: | 541 | for info_type in PRIVATE_PROJECT_TYPES: |
576 | 578 | with person_logged_in(product.owner): | 542 | with person_logged_in(product.owner): |
577 | 579 | errors = list(product.checkInformationType(info_type)) | 543 | errors = list(product.checkInformationType(info_type)) |
578 | 580 | if policy in EXCLUSIVE_TEAM_POLICY: | 544 | if policy in EXCLUSIVE_TEAM_POLICY: |
579 | @@ -588,12 +552,12 @@ | |||
580 | 588 | def test_checkInformationType_questions(self): | 552 | def test_checkInformationType_questions(self): |
581 | 589 | # Proprietary products must not have questions. | 553 | # Proprietary products must not have questions. |
582 | 590 | product = self.factory.makeProduct() | 554 | product = self.factory.makeProduct() |
584 | 591 | for info_type in PROPRIETARY_INFORMATION_TYPES: | 555 | for info_type in PRIVATE_PROJECT_TYPES: |
585 | 592 | with person_logged_in(product.owner): | 556 | with person_logged_in(product.owner): |
586 | 593 | self.assertEqual([], | 557 | self.assertEqual([], |
587 | 594 | list(product.checkInformationType(info_type))) | 558 | list(product.checkInformationType(info_type))) |
588 | 595 | self.factory.makeQuestion(target=product) | 559 | self.factory.makeQuestion(target=product) |
590 | 596 | for info_type in PROPRIETARY_INFORMATION_TYPES: | 560 | for info_type in PRIVATE_PROJECT_TYPES: |
591 | 597 | with person_logged_in(product.owner): | 561 | with person_logged_in(product.owner): |
592 | 598 | error, = list(product.checkInformationType(info_type)) | 562 | error, = list(product.checkInformationType(info_type)) |
593 | 599 | with ExpectedException( | 563 | with ExpectedException( |
594 | @@ -604,12 +568,12 @@ | |||
595 | 604 | # Proprietary products must not have translations. | 568 | # Proprietary products must not have translations. |
596 | 605 | productseries = self.factory.makeProductSeries() | 569 | productseries = self.factory.makeProductSeries() |
597 | 606 | product = productseries.product | 570 | product = productseries.product |
599 | 607 | for info_type in PROPRIETARY_INFORMATION_TYPES: | 571 | for info_type in PRIVATE_PROJECT_TYPES: |
600 | 608 | with person_logged_in(product.owner): | 572 | with person_logged_in(product.owner): |
601 | 609 | self.assertEqual([], | 573 | self.assertEqual([], |
602 | 610 | list(product.checkInformationType(info_type))) | 574 | list(product.checkInformationType(info_type))) |
603 | 611 | self.factory.makePOTemplate(productseries=productseries) | 575 | self.factory.makePOTemplate(productseries=productseries) |
605 | 612 | for info_type in PROPRIETARY_INFORMATION_TYPES: | 576 | for info_type in PRIVATE_PROJECT_TYPES: |
606 | 613 | with person_logged_in(product.owner): | 577 | with person_logged_in(product.owner): |
607 | 614 | error, = list(product.checkInformationType(info_type)) | 578 | error, = list(product.checkInformationType(info_type)) |
608 | 615 | with ExpectedException( | 579 | with ExpectedException( |
609 | @@ -622,7 +586,7 @@ | |||
610 | 622 | product = productseries.product | 586 | product = productseries.product |
611 | 623 | entry = self.factory.makeTranslationImportQueueEntry( | 587 | entry = self.factory.makeTranslationImportQueueEntry( |
612 | 624 | productseries=productseries) | 588 | productseries=productseries) |
614 | 625 | for info_type in PROPRIETARY_INFORMATION_TYPES: | 589 | for info_type in PRIVATE_PROJECT_TYPES: |
615 | 626 | with person_logged_in(product.owner): | 590 | with person_logged_in(product.owner): |
616 | 627 | error, = list(product.checkInformationType(info_type)) | 591 | error, = list(product.checkInformationType(info_type)) |
617 | 628 | with ExpectedException( | 592 | with ExpectedException( |
618 | @@ -631,7 +595,7 @@ | |||
619 | 631 | raise error | 595 | raise error |
620 | 632 | removeSecurityProxy(entry).delete(entry.id) | 596 | removeSecurityProxy(entry).delete(entry.id) |
621 | 633 | with person_logged_in(product.owner): | 597 | with person_logged_in(product.owner): |
623 | 634 | for info_type in PROPRIETARY_INFORMATION_TYPES: | 598 | for info_type in PRIVATE_PROJECT_TYPES: |
624 | 635 | self.assertContentEqual( | 599 | self.assertContentEqual( |
625 | 636 | [], product.checkInformationType(info_type)) | 600 | [], product.checkInformationType(info_type)) |
626 | 637 | 601 | ||
627 | @@ -644,7 +608,7 @@ | |||
628 | 644 | if mode == TranslationsBranchImportMode.NO_IMPORT: | 608 | if mode == TranslationsBranchImportMode.NO_IMPORT: |
629 | 645 | continue | 609 | continue |
630 | 646 | productseries.translations_autoimport_mode = mode | 610 | productseries.translations_autoimport_mode = mode |
632 | 647 | for info_type in PROPRIETARY_INFORMATION_TYPES: | 611 | for info_type in PRIVATE_PROJECT_TYPES: |
633 | 648 | error, = list(product.checkInformationType(info_type)) | 612 | error, = list(product.checkInformationType(info_type)) |
634 | 649 | with ExpectedException( | 613 | with ExpectedException( |
635 | 650 | CannotChangeInformationType, | 614 | CannotChangeInformationType, |
636 | @@ -652,7 +616,7 @@ | |||
637 | 652 | raise error | 616 | raise error |
638 | 653 | productseries.translations_autoimport_mode = ( | 617 | productseries.translations_autoimport_mode = ( |
639 | 654 | TranslationsBranchImportMode.NO_IMPORT) | 618 | TranslationsBranchImportMode.NO_IMPORT) |
641 | 655 | for info_type in PROPRIETARY_INFORMATION_TYPES: | 619 | for info_type in PRIVATE_PROJECT_TYPES: |
642 | 656 | self.assertContentEqual( | 620 | self.assertContentEqual( |
643 | 657 | [], product.checkInformationType(info_type)) | 621 | [], product.checkInformationType(info_type)) |
644 | 658 | 622 | ||
645 | @@ -664,7 +628,7 @@ | |||
646 | 664 | with person_logged_in(series.owner): | 628 | with person_logged_in(series.owner): |
647 | 665 | bug.addTask(series.owner, series) | 629 | bug.addTask(series.owner, series) |
648 | 666 | bug.default_bugtask.delete() | 630 | bug.default_bugtask.delete() |
650 | 667 | for info_type in PROPRIETARY_INFORMATION_TYPES: | 631 | for info_type in PRIVATE_PROJECT_TYPES: |
651 | 668 | error, = list(series.product.checkInformationType(info_type)) | 632 | error, = list(series.product.checkInformationType(info_type)) |
652 | 669 | with ExpectedException( | 633 | with ExpectedException( |
653 | 670 | CannotChangeInformationType, | 634 | CannotChangeInformationType, |
654 | @@ -675,7 +639,7 @@ | |||
655 | 675 | owner = self.factory.makePerson() | 639 | owner = self.factory.makePerson() |
656 | 676 | product = self.factory.makeProduct(owner=owner) | 640 | product = self.factory.makeProduct(owner=owner) |
657 | 677 | self.useContext(person_logged_in(owner)) | 641 | self.useContext(person_logged_in(owner)) |
659 | 678 | for info_type in PROPRIETARY_INFORMATION_TYPES: | 642 | for info_type in PRIVATE_PROJECT_TYPES: |
660 | 679 | product.information_type = info_type | 643 | product.information_type = info_type |
661 | 680 | with ExpectedException( | 644 | with ExpectedException( |
662 | 681 | ProprietaryProduct, | 645 | ProprietaryProduct, |
663 | @@ -703,35 +667,35 @@ | |||
664 | 703 | def test_product_information_type(self): | 667 | def test_product_information_type(self): |
665 | 704 | # Product is created with specified information_type | 668 | # Product is created with specified information_type |
666 | 705 | product = self.createProduct( | 669 | product = self.createProduct( |
668 | 706 | information_type=InformationType.EMBARGOED, | 670 | information_type=InformationType.PROPRIETARY, |
669 | 707 | license=License.OTHER_PROPRIETARY) | 671 | license=License.OTHER_PROPRIETARY) |
671 | 708 | self.assertEqual(InformationType.EMBARGOED, product.information_type) | 672 | self.assertEqual(InformationType.PROPRIETARY, product.information_type) |
672 | 709 | # Owner can set information_type | 673 | # Owner can set information_type |
673 | 710 | with person_logged_in(removeSecurityProxy(product).owner): | 674 | with person_logged_in(removeSecurityProxy(product).owner): |
676 | 711 | product.information_type = InformationType.PROPRIETARY | 675 | product.information_type = InformationType.PUBLIC |
677 | 712 | self.assertEqual(InformationType.PROPRIETARY, product.information_type) | 676 | self.assertEqual(InformationType.PUBLIC, product.information_type) |
678 | 713 | # Database persists information_type value | 677 | # Database persists information_type value |
679 | 714 | store = Store.of(product) | 678 | store = Store.of(product) |
680 | 715 | store.flush() | 679 | store.flush() |
681 | 716 | store.reset() | 680 | store.reset() |
682 | 717 | product = store.get(Product, product.id) | 681 | product = store.get(Product, product.id) |
685 | 718 | self.assertEqual(InformationType.PROPRIETARY, product.information_type) | 682 | self.assertEqual(InformationType.PUBLIC, product.information_type) |
686 | 719 | self.assertTrue(product.private) | 683 | self.assertFalse(product.private) |
687 | 720 | 684 | ||
688 | 721 | def test_switching_product_to_public_does_not_create_policy(self): | 685 | def test_switching_product_to_public_does_not_create_policy(self): |
691 | 722 | # Creating a Embargoed product and switching it to Public does not | 686 | # Creating a Proprietary product and switching it to Public does |
692 | 723 | # create a PUBLIC AccessPolicy. | 687 | # not create a PUBLIC AccessPolicy. |
693 | 724 | product = self.createProduct( | 688 | product = self.createProduct( |
695 | 725 | information_type=InformationType.EMBARGOED, | 689 | information_type=InformationType.PROPRIETARY, |
696 | 726 | license=License.OTHER_PROPRIETARY) | 690 | license=License.OTHER_PROPRIETARY) |
697 | 727 | aps = getUtility(IAccessPolicySource).findByPillar([product]) | 691 | aps = getUtility(IAccessPolicySource).findByPillar([product]) |
698 | 728 | self.assertContentEqual( | 692 | self.assertContentEqual( |
700 | 729 | [InformationType.PROPRIETARY, InformationType.EMBARGOED], | 693 | [InformationType.PROPRIETARY], |
701 | 730 | [ap.type for ap in aps]) | 694 | [ap.type for ap in aps]) |
702 | 731 | removeSecurityProxy(product).information_type = InformationType.PUBLIC | 695 | removeSecurityProxy(product).information_type = InformationType.PUBLIC |
703 | 732 | aps = getUtility(IAccessPolicySource).findByPillar([product]) | 696 | aps = getUtility(IAccessPolicySource).findByPillar([product]) |
704 | 733 | self.assertContentEqual( | 697 | self.assertContentEqual( |
706 | 734 | [InformationType.PROPRIETARY, InformationType.EMBARGOED], | 698 | [InformationType.PROPRIETARY], |
707 | 735 | [ap.type for ap in aps]) | 699 | [ap.type for ap in aps]) |
708 | 736 | 700 | ||
709 | 737 | def test_product_information_type_default(self): | 701 | def test_product_information_type_default(self): |
710 | @@ -742,9 +706,9 @@ | |||
711 | 742 | self.assertEqual(InformationType.PUBLIC, product.information_type) | 706 | self.assertEqual(InformationType.PUBLIC, product.information_type) |
712 | 743 | self.assertFalse(product.private) | 707 | self.assertFalse(product.private) |
713 | 744 | 708 | ||
717 | 745 | invalid_information_types = [info_type for info_type in | 709 | invalid_information_types = [ |
718 | 746 | InformationType.items if info_type not in | 710 | info_type for info_type in InformationType.items |
719 | 747 | PUBLIC_PROPRIETARY_INFORMATION_TYPES] | 711 | if info_type not in PILLAR_INFORMATION_TYPES] |
720 | 748 | 712 | ||
721 | 749 | def test_product_information_type_init_invalid_values(self): | 713 | def test_product_information_type_init_invalid_values(self): |
722 | 750 | # Cannot create Product.information_type with invalid values. | 714 | # Cannot create Product.information_type with invalid values. |
723 | @@ -796,41 +760,39 @@ | |||
724 | 796 | 760 | ||
725 | 797 | # However we can't change it back to a Proprietary because our | 761 | # However we can't change it back to a Proprietary because our |
726 | 798 | # commercial subscription has expired. | 762 | # commercial subscription has expired. |
729 | 799 | for info_type in PROPRIETARY_INFORMATION_TYPES: | 763 | with ExpectedException( |
728 | 800 | with ExpectedException( | ||
730 | 801 | CommercialSubscribersOnly, | 764 | CommercialSubscribersOnly, |
731 | 802 | 'A valid commercial subscription is required for private' | 765 | 'A valid commercial subscription is required for private' |
732 | 803 | ' Projects.'): | 766 | ' Projects.'): |
734 | 804 | product.information_type = info_type | 767 | product.information_type = InformationType.PROPRIETARY |
735 | 805 | 768 | ||
736 | 806 | def test_product_information_init_proprietary_requires_commercial(self): | 769 | def test_product_information_init_proprietary_requires_commercial(self): |
737 | 807 | # Cannot create a product with proprietary types without specifying | 770 | # Cannot create a product with proprietary types without specifying |
738 | 808 | # Other/Proprietary license. | 771 | # Other/Proprietary license. |
741 | 809 | for info_type in PROPRIETARY_INFORMATION_TYPES: | 772 | with ExpectedException( |
740 | 810 | with ExpectedException( | ||
742 | 811 | CommercialSubscribersOnly, | 773 | CommercialSubscribersOnly, |
743 | 812 | 'A valid commercial subscription is required for private' | 774 | 'A valid commercial subscription is required for private' |
744 | 813 | ' Projects.'): | 775 | ' Projects.'): |
749 | 814 | self.createProduct(info_type) | 776 | self.createProduct(InformationType.PROPRIETARY) |
750 | 815 | for info_type in PROPRIETARY_INFORMATION_TYPES: | 777 | product = self.createProduct( |
751 | 816 | product = self.createProduct(info_type, License.OTHER_PROPRIETARY) | 778 | InformationType.PROPRIETARY, License.OTHER_PROPRIETARY) |
752 | 817 | self.assertEqual(info_type, product.information_type) | 779 | self.assertEqual(InformationType.PROPRIETARY, product.information_type) |
753 | 818 | 780 | ||
754 | 819 | def test_no_answers_for_proprietary(self): | 781 | def test_no_answers_for_proprietary(self): |
755 | 820 | # Enabling Answers is forbidden while information_type is proprietary. | 782 | # Enabling Answers is forbidden while information_type is proprietary. |
769 | 821 | for info_type in PROPRIETARY_INFORMATION_TYPES: | 783 | product = self.factory.makeProduct( |
770 | 822 | product = self.factory.makeProduct(information_type=info_type) | 784 | information_type=InformationType.PROPRIETARY) |
771 | 823 | with person_logged_in(removeSecurityProxy(product).owner): | 785 | with person_logged_in(removeSecurityProxy(product).owner): |
772 | 824 | self.assertEqual(ServiceUsage.UNKNOWN, product.answers_usage) | 786 | self.assertEqual(ServiceUsage.UNKNOWN, product.answers_usage) |
773 | 825 | for usage in ServiceUsage.items: | 787 | for usage in ServiceUsage.items: |
774 | 826 | if usage == ServiceUsage.LAUNCHPAD: | 788 | if usage == ServiceUsage.LAUNCHPAD: |
775 | 827 | with ExpectedException( | 789 | with ExpectedException( |
776 | 828 | ServiceUsageForbidden, | 790 | ServiceUsageForbidden, |
777 | 829 | "Answers not allowed for non-public projects."): | 791 | "Answers not allowed for non-public projects."): |
778 | 830 | product.answers_usage = ServiceUsage.LAUNCHPAD | 792 | product.answers_usage = ServiceUsage.LAUNCHPAD |
779 | 831 | else: | 793 | else: |
780 | 832 | # all other values are permitted. | 794 | # all other values are permitted. |
781 | 833 | product.answers_usage = usage | 795 | product.answers_usage = usage |
782 | 834 | 796 | ||
783 | 835 | def test_answers_for_public(self): | 797 | def test_answers_for_public(self): |
784 | 836 | # Enabling answers is permitted while information_type is PUBLIC. | 798 | # Enabling answers is permitted while information_type is PUBLIC. |
785 | @@ -1265,14 +1227,14 @@ | |||
786 | 1265 | # Access policies for Product.information_type are not pruned. | 1227 | # Access policies for Product.information_type are not pruned. |
787 | 1266 | owner = self.factory.makePerson() | 1228 | owner = self.factory.makePerson() |
788 | 1267 | product = self.factory.makeProduct( | 1229 | product = self.factory.makeProduct( |
790 | 1268 | information_type=InformationType.EMBARGOED, owner=owner) | 1230 | information_type=InformationType.PROPRIETARY, owner=owner) |
791 | 1269 | with person_logged_in(owner): | 1231 | with person_logged_in(owner): |
793 | 1270 | product.setBugSharingPolicy(BugSharingPolicy.PROPRIETARY) | 1232 | product.setBugSharingPolicy(BugSharingPolicy.FORBIDDEN) |
794 | 1271 | product.setSpecificationSharingPolicy( | 1233 | product.setSpecificationSharingPolicy( |
797 | 1272 | SpecificationSharingPolicy.PROPRIETARY) | 1234 | SpecificationSharingPolicy.FORBIDDEN) |
798 | 1273 | product.setBranchSharingPolicy(BranchSharingPolicy.PROPRIETARY) | 1235 | product.setBranchSharingPolicy(BranchSharingPolicy.FORBIDDEN) |
799 | 1274 | self.assertIsNot(None, getUtility(IAccessPolicySource).find( | 1236 | self.assertIsNot(None, getUtility(IAccessPolicySource).find( |
801 | 1275 | [(product, InformationType.EMBARGOED)]).one()) | 1237 | [(product, InformationType.PROPRIETARY)]).one()) |
802 | 1276 | 1238 | ||
803 | 1277 | 1239 | ||
804 | 1278 | class TestProductBugInformationTypes(TestCaseWithFactory): | 1240 | class TestProductBugInformationTypes(TestCaseWithFactory): |
805 | @@ -1833,12 +1795,6 @@ | |||
806 | 1833 | with ExpectedException( | 1795 | with ExpectedException( |
807 | 1834 | ProprietaryProduct, "The project is Proprietary."): | 1796 | ProprietaryProduct, "The project is Proprietary."): |
808 | 1835 | self.setSharingPolicy(policy, owner) | 1797 | self.setSharingPolicy(policy, owner) |
809 | 1836 | with person_logged_in(owner): | ||
810 | 1837 | self.product.information_type = InformationType.EMBARGOED | ||
811 | 1838 | for policy in policies_permitting_public: | ||
812 | 1839 | with ExpectedException( | ||
813 | 1840 | ProprietaryProduct, "The project is Embargoed."): | ||
814 | 1841 | self.setSharingPolicy(policy, owner) | ||
815 | 1842 | 1798 | ||
816 | 1843 | 1799 | ||
817 | 1844 | class ProductBugSharingPolicyTestCase(BaseSharingPolicyTests, | 1800 | class ProductBugSharingPolicyTestCase(BaseSharingPolicyTests, |
818 | @@ -2255,11 +2211,9 @@ | |||
819 | 2255 | def makeAllInformationTypes(self): | 2211 | def makeAllInformationTypes(self): |
820 | 2256 | proprietary = self.factory.makeProduct( | 2212 | proprietary = self.factory.makeProduct( |
821 | 2257 | information_type=InformationType.PROPRIETARY) | 2213 | information_type=InformationType.PROPRIETARY) |
822 | 2258 | embargoed = self.factory.makeProduct( | ||
823 | 2259 | information_type=InformationType.EMBARGOED) | ||
824 | 2260 | public = self.factory.makeProduct( | 2214 | public = self.factory.makeProduct( |
825 | 2261 | information_type=InformationType.PUBLIC) | 2215 | information_type=InformationType.PUBLIC) |
827 | 2262 | return proprietary, embargoed, public | 2216 | return proprietary, public |
828 | 2263 | 2217 | ||
829 | 2264 | @staticmethod | 2218 | @staticmethod |
830 | 2265 | def filterFind(user): | 2219 | def filterFind(user): |
831 | @@ -2275,22 +2229,15 @@ | |||
832 | 2275 | proprietary = self.factory.makeProduct( | 2229 | proprietary = self.factory.makeProduct( |
833 | 2276 | information_type=InformationType.PROPRIETARY, | 2230 | information_type=InformationType.PROPRIETARY, |
834 | 2277 | owner=owner) | 2231 | owner=owner) |
835 | 2278 | embargoed = self.factory.makeProduct( | ||
836 | 2279 | information_type=InformationType.EMBARGOED, | ||
837 | 2280 | owner=owner) | ||
838 | 2281 | result = ProductSet.get_users_private_products(owner) | 2232 | result = ProductSet.get_users_private_products(owner) |
839 | 2282 | self.assertIn(proprietary, result) | 2233 | self.assertIn(proprietary, result) |
840 | 2283 | self.assertIn(embargoed, result) | ||
841 | 2284 | 2234 | ||
842 | 2285 | def test_get_all_active_omits_proprietary(self): | 2235 | def test_get_all_active_omits_proprietary(self): |
843 | 2286 | # Ignore proprietary products for anonymous users | 2236 | # Ignore proprietary products for anonymous users |
844 | 2287 | proprietary = self.factory.makeProduct( | 2237 | proprietary = self.factory.makeProduct( |
845 | 2288 | information_type=InformationType.PROPRIETARY) | 2238 | information_type=InformationType.PROPRIETARY) |
846 | 2289 | embargoed = self.factory.makeProduct( | ||
847 | 2290 | information_type=InformationType.EMBARGOED) | ||
848 | 2291 | result = ProductSet.get_all_active(None) | 2239 | result = ProductSet.get_all_active(None) |
849 | 2292 | self.assertNotIn(proprietary, result) | 2240 | self.assertNotIn(proprietary, result) |
850 | 2293 | self.assertNotIn(embargoed, result) | ||
851 | 2294 | 2241 | ||
852 | 2295 | def test_search_respects_privacy(self): | 2242 | def test_search_respects_privacy(self): |
853 | 2296 | # Proprietary products are filtered from the results for people who | 2243 | # Proprietary products are filtered from the results for people who |
854 | @@ -2305,19 +2252,17 @@ | |||
855 | 2305 | 2252 | ||
856 | 2306 | def test_getProductPrivacyFilterAnonymous(self): | 2253 | def test_getProductPrivacyFilterAnonymous(self): |
857 | 2307 | # Ignore proprietary products for anonymous users | 2254 | # Ignore proprietary products for anonymous users |
859 | 2308 | proprietary, embargoed, public = self.makeAllInformationTypes() | 2255 | proprietary, public = self.makeAllInformationTypes() |
860 | 2309 | result = self.filterFind(None) | 2256 | result = self.filterFind(None) |
861 | 2310 | self.assertIn(public, result) | 2257 | self.assertIn(public, result) |
862 | 2311 | self.assertNotIn(embargoed, result) | ||
863 | 2312 | self.assertNotIn(proprietary, result) | 2258 | self.assertNotIn(proprietary, result) |
864 | 2313 | 2259 | ||
865 | 2314 | def test_getProductPrivacyFilter_excludes_random_users(self): | 2260 | def test_getProductPrivacyFilter_excludes_random_users(self): |
866 | 2315 | # Exclude proprietary products for anonymous users | 2261 | # Exclude proprietary products for anonymous users |
867 | 2316 | random = self.factory.makePerson() | 2262 | random = self.factory.makePerson() |
869 | 2317 | proprietary, embargoed, public = self.makeAllInformationTypes() | 2263 | proprietary, public = self.makeAllInformationTypes() |
870 | 2318 | result = self.filterFind(random) | 2264 | result = self.filterFind(random) |
871 | 2319 | self.assertIn(public, result) | 2265 | self.assertIn(public, result) |
872 | 2320 | self.assertNotIn(embargoed, result) | ||
873 | 2321 | self.assertNotIn(proprietary, result) | 2266 | self.assertNotIn(proprietary, result) |
874 | 2322 | 2267 | ||
875 | 2323 | def grant(self, pillar, information_type, grantee): | 2268 | def grant(self, pillar, information_type, grantee): |
876 | @@ -2329,61 +2274,53 @@ | |||
877 | 2329 | def test_getProductPrivacyFilter_respects_grants(self): | 2274 | def test_getProductPrivacyFilter_respects_grants(self): |
878 | 2330 | # Include proprietary products for users with right grants. | 2275 | # Include proprietary products for users with right grants. |
879 | 2331 | grantee = self.factory.makePerson() | 2276 | grantee = self.factory.makePerson() |
882 | 2332 | proprietary, embargoed, public = self.makeAllInformationTypes() | 2277 | proprietary, public = self.makeAllInformationTypes() |
881 | 2333 | self.grant(embargoed, InformationType.EMBARGOED, grantee) | ||
883 | 2334 | self.grant(proprietary, InformationType.PROPRIETARY, grantee) | 2278 | self.grant(proprietary, InformationType.PROPRIETARY, grantee) |
884 | 2335 | result = self.filterFind(grantee) | 2279 | result = self.filterFind(grantee) |
885 | 2336 | self.assertIn(public, result) | 2280 | self.assertIn(public, result) |
886 | 2337 | self.assertIn(embargoed, result) | ||
887 | 2338 | self.assertIn(proprietary, result) | 2281 | self.assertIn(proprietary, result) |
888 | 2339 | 2282 | ||
889 | 2340 | def test_getProductPrivacyFilter_ignores_wrong_product(self): | 2283 | def test_getProductPrivacyFilter_ignores_wrong_product(self): |
890 | 2341 | # Exclude proprietary products if grant is on wrong product. | 2284 | # Exclude proprietary products if grant is on wrong product. |
891 | 2342 | grantee = self.factory.makePerson() | 2285 | grantee = self.factory.makePerson() |
893 | 2343 | proprietary, embargoed, public = self.makeAllInformationTypes() | 2286 | proprietary, public = self.makeAllInformationTypes() |
894 | 2344 | self.factory.makeAccessPolicyGrant(grantee=grantee) | 2287 | self.factory.makeAccessPolicyGrant(grantee=grantee) |
895 | 2345 | result = self.filterFind(grantee) | 2288 | result = self.filterFind(grantee) |
896 | 2346 | self.assertIn(public, result) | 2289 | self.assertIn(public, result) |
897 | 2347 | self.assertNotIn(embargoed, result) | ||
898 | 2348 | self.assertNotIn(proprietary, result) | 2290 | self.assertNotIn(proprietary, result) |
899 | 2349 | 2291 | ||
900 | 2350 | def test_getProductPrivacyFilter_ignores_wrong_info_type(self): | 2292 | def test_getProductPrivacyFilter_ignores_wrong_info_type(self): |
901 | 2351 | # Exclude proprietary products if grant is on wrong information type. | 2293 | # Exclude proprietary products if grant is on wrong information type. |
902 | 2352 | grantee = self.factory.makePerson() | 2294 | grantee = self.factory.makePerson() |
904 | 2353 | proprietary, embargoed, public = self.makeAllInformationTypes() | 2295 | proprietary, public = self.makeAllInformationTypes() |
905 | 2354 | self.factory.makeAccessPolicy( | 2296 | self.factory.makeAccessPolicy( |
906 | 2355 | proprietary, InformationType.PRIVATESECURITY) | 2297 | proprietary, InformationType.PRIVATESECURITY) |
907 | 2356 | self.grant(proprietary, InformationType.PRIVATESECURITY, grantee) | 2298 | self.grant(proprietary, InformationType.PRIVATESECURITY, grantee) |
908 | 2357 | result = self.filterFind(grantee) | 2299 | result = self.filterFind(grantee) |
909 | 2358 | self.assertIn(public, result) | 2300 | self.assertIn(public, result) |
910 | 2359 | self.assertNotIn(embargoed, result) | ||
911 | 2360 | self.assertNotIn(proprietary, result) | 2301 | self.assertNotIn(proprietary, result) |
912 | 2361 | 2302 | ||
913 | 2362 | def test_getProductPrivacyFilter_respects_team_grants(self): | 2303 | def test_getProductPrivacyFilter_respects_team_grants(self): |
914 | 2363 | # Include proprietary products for users in teams with right grants. | 2304 | # Include proprietary products for users in teams with right grants. |
915 | 2364 | grantee = self.factory.makeTeam() | 2305 | grantee = self.factory.makeTeam() |
918 | 2365 | proprietary, embargoed, public = self.makeAllInformationTypes() | 2306 | proprietary, public = self.makeAllInformationTypes() |
917 | 2366 | self.grant(embargoed, InformationType.EMBARGOED, grantee) | ||
919 | 2367 | self.grant(proprietary, InformationType.PROPRIETARY, grantee) | 2307 | self.grant(proprietary, InformationType.PROPRIETARY, grantee) |
920 | 2368 | result = self.filterFind(grantee.teamowner) | 2308 | result = self.filterFind(grantee.teamowner) |
921 | 2369 | self.assertIn(public, result) | 2309 | self.assertIn(public, result) |
922 | 2370 | self.assertIn(embargoed, result) | ||
923 | 2371 | self.assertIn(proprietary, result) | 2310 | self.assertIn(proprietary, result) |
924 | 2372 | 2311 | ||
925 | 2373 | def test_getProductPrivacyFilter_includes_admins(self): | 2312 | def test_getProductPrivacyFilter_includes_admins(self): |
926 | 2374 | # Launchpad admins can see everything. | 2313 | # Launchpad admins can see everything. |
928 | 2375 | proprietary, embargoed, public = self.makeAllInformationTypes() | 2314 | proprietary, public = self.makeAllInformationTypes() |
929 | 2376 | result = self.filterFind(self.factory.makeAdministrator()) | 2315 | result = self.filterFind(self.factory.makeAdministrator()) |
930 | 2377 | self.assertIn(public, result) | 2316 | self.assertIn(public, result) |
931 | 2378 | self.assertIn(embargoed, result) | ||
932 | 2379 | self.assertIn(proprietary, result) | 2317 | self.assertIn(proprietary, result) |
933 | 2380 | 2318 | ||
934 | 2381 | def test_getProductPrivacyFilter_includes_commercial_admins(self): | 2319 | def test_getProductPrivacyFilter_includes_commercial_admins(self): |
935 | 2382 | # Commercial admins can see everything. | 2320 | # Commercial admins can see everything. |
937 | 2383 | proprietary, embargoed, public = self.makeAllInformationTypes() | 2321 | proprietary, public = self.makeAllInformationTypes() |
938 | 2384 | result = self.filterFind(self.factory.makeCommercialAdmin()) | 2322 | result = self.filterFind(self.factory.makeCommercialAdmin()) |
939 | 2385 | self.assertIn(public, result) | 2323 | self.assertIn(public, result) |
940 | 2386 | self.assertIn(embargoed, result) | ||
941 | 2387 | self.assertIn(proprietary, result) | 2324 | self.assertIn(proprietary, result) |
942 | 2388 | 2325 | ||
943 | 2389 | 2326 | ||
944 | 2390 | 2327 | ||
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 | 104 | # Embargoed and proprietary products are only returned if | 104 | # Embargoed and proprietary products are only returned if |
950 | 105 | # the current user can see them. | 105 | # the current user can see them. |
951 | 106 | public_product = self.factory.makeProduct('quux-public') | 106 | public_product = self.factory.makeProduct('quux-public') |
952 | 107 | embargoed_owner = self.factory.makePerson() | ||
953 | 108 | embargoed_product = self.factory.makeProduct( | ||
954 | 109 | name='quux-embargoed', owner=embargoed_owner, | ||
955 | 110 | information_type=InformationType.EMBARGOED) | ||
956 | 111 | proprietary_owner = self.factory.makePerson() | 107 | proprietary_owner = self.factory.makePerson() |
957 | 112 | proprietary_product = self.factory.makeProduct( | 108 | proprietary_product = self.factory.makeProduct( |
958 | 113 | name='quux-proprietary', owner=proprietary_owner, | 109 | name='quux-proprietary', owner=proprietary_owner, |
959 | @@ -125,17 +121,17 @@ | |||
960 | 125 | self.assertEqual([public_product], list(result)) | 121 | self.assertEqual([public_product], list(result)) |
961 | 126 | 122 | ||
962 | 127 | # People with grants on a private product can see this product. | 123 | # People with grants on a private product can see this product. |
964 | 128 | with person_logged_in(embargoed_owner): | 124 | with person_logged_in(proprietary_owner): |
965 | 129 | getUtility(IService, 'sharing').sharePillarInformation( | 125 | getUtility(IService, 'sharing').sharePillarInformation( |
968 | 130 | embargoed_product, user, embargoed_owner, | 126 | proprietary_product, user, proprietary_owner, |
969 | 131 | {InformationType.EMBARGOED: SharingPermission.ALL}) | 127 | {InformationType.PROPRIETARY: SharingPermission.ALL}) |
970 | 132 | with person_logged_in(user): | 128 | with person_logged_in(user): |
971 | 133 | result = self.vocabulary.search('quux') | 129 | result = self.vocabulary.search('quux') |
973 | 134 | self.assertEqual([embargoed_product, public_product], list(result)) | 130 | self.assertEqual( |
974 | 131 | [proprietary_product, public_product], list(result)) | ||
975 | 135 | 132 | ||
976 | 136 | # Admins can see all products. | 133 | # Admins can see all products. |
977 | 137 | with celebrity_logged_in('admin'): | 134 | with celebrity_logged_in('admin'): |
978 | 138 | result = self.vocabulary.search('quux') | 135 | result = self.vocabulary.search('quux') |
979 | 139 | self.assertEqual( | 136 | self.assertEqual( |
982 | 140 | [embargoed_product, proprietary_product, public_product], | 137 | [proprietary_product, public_product], list(result)) |
981 | 141 | list(result)) | ||
983 | 142 | 138 | ||
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 | 16 | from zope.security.interfaces import Unauthorized | 16 | from zope.security.interfaces import Unauthorized |
989 | 17 | from zope.security.proxy import removeSecurityProxy | 17 | from zope.security.proxy import removeSecurityProxy |
990 | 18 | 18 | ||
995 | 19 | from lp.app.enums import ( | 19 | from lp.app.enums import InformationType |
992 | 20 | InformationType, | ||
993 | 21 | PROPRIETARY_INFORMATION_TYPES, | ||
994 | 22 | ) | ||
996 | 23 | from lp.app.interfaces.informationtype import IInformationType | 20 | from lp.app.interfaces.informationtype import IInformationType |
997 | 24 | from lp.app.interfaces.services import IService | 21 | from lp.app.interfaces.services import IService |
998 | 25 | from lp.registry.enums import SharingPermission | 22 | from lp.registry.enums import SharingPermission |
999 | @@ -74,15 +71,14 @@ | |||
1000 | 74 | # Autoimports are forbidden if products are proprietary/embargoed. | 71 | # Autoimports are forbidden if products are proprietary/embargoed. |
1001 | 75 | series = self.factory.makeProductSeries() | 72 | series = self.factory.makeProductSeries() |
1002 | 76 | self.useContext(person_logged_in(series.product.owner)) | 73 | self.useContext(person_logged_in(series.product.owner)) |
1012 | 77 | for info_type in PROPRIETARY_INFORMATION_TYPES: | 74 | series.product.information_type = InformationType.PROPRIETARY |
1013 | 78 | series.product.information_type = info_type | 75 | for mode in TranslationsBranchImportMode.items: |
1014 | 79 | for mode in TranslationsBranchImportMode.items: | 76 | if mode == TranslationsBranchImportMode.NO_IMPORT: |
1015 | 80 | if mode == TranslationsBranchImportMode.NO_IMPORT: | 77 | continue |
1016 | 81 | continue | 78 | with ExpectedException(ProprietaryProduct, |
1017 | 82 | with ExpectedException(ProprietaryProduct, | 79 | 'Translations are disabled for proprietary' |
1018 | 83 | 'Translations are disabled for proprietary' | 80 | ' projects.'): |
1019 | 84 | ' projects.'): | 81 | series.translations_autoimport_mode = mode |
1011 | 85 | series.translations_autoimport_mode = mode | ||
1020 | 86 | 82 | ||
1021 | 87 | 83 | ||
1022 | 88 | class ProductSeriesReleasesTestCase(TestCaseWithFactory): | 84 | class ProductSeriesReleasesTestCase(TestCaseWithFactory): |
1023 | @@ -201,17 +197,6 @@ | |||
1024 | 201 | series.setPackaging( | 197 | series.setPackaging( |
1025 | 202 | sp.distroseries, sp.sourcepackagename, series.owner) | 198 | sp.distroseries, sp.sourcepackagename, series.owner) |
1026 | 203 | 199 | ||
1027 | 204 | def test_refuses_EMBARGOED(self): | ||
1028 | 205 | """Packaging cannot be created for EMBARGOED productseries""" | ||
1029 | 206 | product = self.factory.makeProduct( | ||
1030 | 207 | information_type=InformationType.EMBARGOED) | ||
1031 | 208 | sp = self.makeSourcePackage() | ||
1032 | 209 | series = self.factory.makeProductSeries(product=product) | ||
1033 | 210 | with ExpectedException(CannotPackageProprietaryProduct, | ||
1034 | 211 | 'Only Public project series can be packaged, not Embargoed.'): | ||
1035 | 212 | series.setPackaging( | ||
1036 | 213 | sp.distroseries, sp.sourcepackagename, series.owner) | ||
1037 | 214 | |||
1038 | 215 | def test_setPackaging_two_packagings(self): | 200 | def test_setPackaging_two_packagings(self): |
1039 | 216 | # More than one sourcepackage from the same distroseries | 201 | # More than one sourcepackage from the same distroseries |
1040 | 217 | # can be linked to a productseries. | 202 | # can be linked to a productseries. |
1041 | 218 | 203 | ||
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 | 12 | 12 | ||
1047 | 13 | from lp.app.enums import ( | 13 | from lp.app.enums import ( |
1048 | 14 | InformationType, | 14 | InformationType, |
1050 | 15 | PUBLIC_PROPRIETARY_INFORMATION_TYPES, | 15 | PILLAR_INFORMATION_TYPES, |
1051 | 16 | ServiceUsage, | 16 | ServiceUsage, |
1052 | 17 | ) | 17 | ) |
1053 | 18 | from lp.registry.interfaces.series import SeriesStatus | 18 | from lp.registry.interfaces.series import SeriesStatus |
1054 | @@ -132,7 +132,7 @@ | |||
1055 | 132 | def test_launchpad_not_listed_for_proprietary(self): | 132 | def test_launchpad_not_listed_for_proprietary(self): |
1056 | 133 | product = self.factory.makeProduct() | 133 | product = self.factory.makeProduct() |
1057 | 134 | with person_logged_in(product.owner): | 134 | with person_logged_in(product.owner): |
1059 | 135 | for info_type in PUBLIC_PROPRIETARY_INFORMATION_TYPES: | 135 | for info_type in PILLAR_INFORMATION_TYPES: |
1060 | 136 | product.information_type = info_type | 136 | product.information_type = info_type |
1061 | 137 | view = create_initialized_view( | 137 | view = create_initialized_view( |
1062 | 138 | product, '+configure-translations') | 138 | product, '+configure-translations') |
The product_ _valid_ information_ type constraint should also be changed, possibly after this is deployed.