launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #18849
[Merge] lp:~wgrant/launchpad/death-to-embargoed into lp:launchpad
William Grant has proposed merging lp:~wgrant/launchpad/death-to-embargoed into lp:launchpad.
Commit message:
Remove Embargoed as a legal value for Product.information_type.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~wgrant/launchpad/death-to-embargoed/+merge/263083
Remove Embargoed as a legal value for Product.information_type.
InformationType.EMBARGOED exists to give proprietary projects two different levels of protection: eg. a partner project might share bugs with the customer, but code only with employees until the project is done. There's no difference between Proprietary and Embargoed as a pillar information type except the sharing policy defaults. It confuses many project creators, and it's only used by a dozen projects -- all of them look like mistakes.
We should UPDATE Product SET information_type = 5 WHERE information_type = 6; before this is deployed.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/death-to-embargoed into lp:launchpad.
=== modified file 'lib/lp/app/enums.py'
--- lib/lp/app/enums.py 2012-09-17 15:19:10 +0000
+++ lib/lp/app/enums.py 2015-06-26 10:10:59 +0000
@@ -11,6 +11,7 @@
'NON_EMBARGOED_INFORMATION_TYPES',
'PRIVATE_INFORMATION_TYPES',
'PROPRIETARY_INFORMATION_TYPES',
+ 'PILLAR_INFORMATION_TYPES',
'PUBLIC_INFORMATION_TYPES',
'PUBLIC_PROPRIETARY_INFORMATION_TYPES',
'SECURITY_INFORMATION_TYPES',
@@ -67,7 +68,6 @@
Only shared with users permitted to see embargoed information.
""")
-
PUBLIC_INFORMATION_TYPES = (
InformationType.PUBLIC, InformationType.PUBLICSECURITY)
@@ -97,6 +97,9 @@
(InformationType.PUBLIC,) + PROPRIETARY_INFORMATION_TYPES
)
+PILLAR_INFORMATION_TYPES = (
+ InformationType.PUBLIC, InformationType.PROPRIETARY)
+
class ServiceUsage(DBEnumeratedType):
"""Launchpad application usages.
=== modified file 'lib/lp/registry/browser/product.py'
--- lib/lp/registry/browser/product.py 2015-06-25 03:33:33 +0000
+++ lib/lp/registry/browser/product.py 2015-06-26 10:10:59 +0000
@@ -71,7 +71,6 @@
from zope.schema import (
Bool,
Choice,
- TextLine,
)
from zope.schema.vocabulary import (
SimpleTerm,
@@ -107,7 +106,7 @@
from lp.app.enums import (
InformationType,
PROPRIETARY_INFORMATION_TYPES,
- PUBLIC_PROPRIETARY_INFORMATION_TYPES,
+ PILLAR_INFORMATION_TYPES,
ServiceUsage,
)
from lp.app.errors import (
@@ -1377,8 +1376,7 @@
custom_widget('license_info', GhostWidget)
custom_widget(
'information_type', LaunchpadRadioWidgetWithDescription,
- vocabulary=InformationTypeVocabulary(
- types=PUBLIC_PROPRIETARY_INFORMATION_TYPES))
+ vocabulary=InformationTypeVocabulary(types=PILLAR_INFORMATION_TYPES))
@property
def next_url(self):
@@ -1402,8 +1400,7 @@
# the form is rendered during LaunchpadFormView's initialize()
# when an action is invoked.
cache = IJSONRequestCache(self.request)
- json_dump_information_types(
- cache, PUBLIC_PROPRIETARY_INFORMATION_TYPES)
+ json_dump_information_types(cache, PILLAR_INFORMATION_TYPES)
super(ProductEditView, self).initialize()
def validate(self, data):
@@ -2277,8 +2274,7 @@
custom_widget(
'information_type',
LaunchpadRadioWidgetWithDescription,
- vocabulary=InformationTypeVocabulary(
- types=PUBLIC_PROPRIETARY_INFORMATION_TYPES))
+ vocabulary=InformationTypeVocabulary(types=PILLAR_INFORMATION_TYPES))
custom_widget(
'owner', PersonPickerWidget, header="Select the maintainer",
@@ -2297,8 +2293,7 @@
# the form is rendered during LaunchpadFormView's initialize()
# when an action is invoked.
cache = IJSONRequestCache(self.request)
- json_dump_information_types(
- cache, PUBLIC_PROPRIETARY_INFORMATION_TYPES)
+ json_dump_information_types(cache, PILLAR_INFORMATION_TYPES)
super(ProjectAddStepTwo, self).initialize()
@property
=== modified file 'lib/lp/registry/browser/tests/test_product.py'
--- lib/lp/registry/browser/tests/test_product.py 2015-06-25 08:59:07 +0000
+++ lib/lp/registry/browser/tests/test_product.py 2015-06-26 10:10:59 +0000
@@ -106,12 +106,12 @@
def test_configure_answers_skips_launchpad_for_proprietary(self):
# Proprietary projects forbid LAUNCHPAD for answers.
- for info_type in PROPRIETARY_INFORMATION_TYPES:
- product = self.factory.makeProduct(information_type=info_type)
- with person_logged_in(None):
- browser = self.getViewBrowser(product, '+configure-answers',
- user=removeSecurityProxy(product).owner)
- self.assertThat(browser.contents, Not(HTMLContains(self.lp_tag)))
+ product = self.factory.makeProduct(
+ information_type=InformationType.PROPRIETARY)
+ with person_logged_in(None):
+ browser = self.getViewBrowser(product, '+configure-answers',
+ user=removeSecurityProxy(product).owner)
+ self.assertThat(browser.contents, Not(HTMLContains(self.lp_tag)))
def make_product_form(person=None, action=1, proprietary=False):
@@ -482,14 +482,14 @@
}
def test_limited_information_types_allowed(self):
- """Products can only be PUBLIC_PROPRIETARY_INFORMATION_TYPES"""
+ """Products can only be PILLAR_INFORMATION_TYPES"""
product = self.factory.makeProduct()
login_person(product.owner)
view = create_initialized_view(
product, '+edit', principal=product.owner)
vocabulary = view.widgets['information_type'].vocabulary
info_types = [t.name for t in vocabulary]
- expected = ['PUBLIC', 'PROPRIETARY', 'EMBARGOED']
+ expected = ['PUBLIC', 'PROPRIETARY']
self.assertEqual(expected, info_types)
def test_change_information_type_proprietary(self):
@@ -683,52 +683,46 @@
information_type=InformationType.PUBLIC, owner=owner)
proprietary = self.factory.makeProduct(
information_type=InformationType.PROPRIETARY, owner=owner)
- embargoed = self.factory.makeProduct(
- information_type=InformationType.EMBARGOED, owner=owner)
- return owner, public, proprietary, embargoed
+ return owner, public, proprietary
def test_proprietary_products_skipped(self):
# Ignore proprietary products for anonymous users
- owner, public, proprietary, embargoed = self.makeAllInformationTypes()
+ owner, public, proprietary = self.makeAllInformationTypes()
browser = self.getViewBrowser(getUtility(IProductSet))
with person_logged_in(owner):
self.assertIn(public.name, browser.contents)
self.assertNotIn(proprietary.name, browser.contents)
- self.assertNotIn(embargoed.name, browser.contents)
def test_proprietary_products_shown_to_owners(self):
# Owners will see their proprietary products listed
- owner, public, proprietary, embargoed = self.makeAllInformationTypes()
+ owner, public, proprietary = self.makeAllInformationTypes()
transaction.commit()
browser = self.getViewBrowser(getUtility(IProductSet), user=owner)
with person_logged_in(owner):
self.assertIn(public.name, browser.contents)
self.assertIn(proprietary.name, browser.contents)
- self.assertIn(embargoed.name, browser.contents)
def test_proprietary_products_skipped_all(self):
# Ignore proprietary products for anonymous users
- owner, public, proprietary, embargoed = self.makeAllInformationTypes()
+ owner, public, proprietary = self.makeAllInformationTypes()
product_set = getUtility(IProductSet)
browser = self.getViewBrowser(product_set, view_name='+all')
with person_logged_in(owner):
self.assertIn(public.name, browser.contents)
self.assertNotIn(proprietary.name, browser.contents)
- self.assertNotIn(embargoed.name, browser.contents)
def test_proprietary_products_shown_to_owners_all(self):
# Owners will see their proprietary products listed
- owner, public, proprietary, embargoed = self.makeAllInformationTypes()
+ owner, public, proprietary = self.makeAllInformationTypes()
transaction.commit()
browser = self.getViewBrowser(getUtility(IProductSet), user=owner,
view_name='+all')
with person_logged_in(owner):
self.assertIn(public.name, browser.contents)
self.assertIn(proprietary.name, browser.contents)
- self.assertIn(embargoed.name, browser.contents)
def test_review_exclude_proprietary_for_expert(self):
- owner, public, proprietary, embargoed = self.makeAllInformationTypes()
+ owner, public, proprietary = self.makeAllInformationTypes()
transaction.commit()
expert = self.factory.makeRegistryExpert()
browser = self.getViewBrowser(getUtility(IProductSet),
@@ -737,10 +731,9 @@
with person_logged_in(owner):
self.assertIn(public.name, browser.contents)
self.assertNotIn(proprietary.name, browser.contents)
- self.assertNotIn(embargoed.name, browser.contents)
def test_review_include_proprietary_for_admin(self):
- owner, public, proprietary, embargoed = self.makeAllInformationTypes()
+ owner, public, proprietary = self.makeAllInformationTypes()
transaction.commit()
admin = self.factory.makeAdministrator()
browser = self.getViewBrowser(getUtility(IProductSet),
@@ -749,4 +742,3 @@
with person_logged_in(owner):
self.assertIn(public.name, browser.contents)
self.assertIn(proprietary.name, browser.contents)
- self.assertIn(embargoed.name, browser.contents)
=== modified file 'lib/lp/registry/model/product.py'
--- lib/lp/registry/model/product.py 2015-06-24 21:14:20 +0000
+++ lib/lp/registry/model/product.py 2015-06-26 10:10:59 +0000
@@ -67,10 +67,10 @@
from lp.app.enums import (
FREE_INFORMATION_TYPES,
InformationType,
+ PILLAR_INFORMATION_TYPES,
PRIVATE_INFORMATION_TYPES,
PROPRIETARY_INFORMATION_TYPES,
PUBLIC_INFORMATION_TYPES,
- PUBLIC_PROPRIETARY_INFORMATION_TYPES,
service_uses_launchpad,
ServiceUsage,
)
@@ -337,21 +337,17 @@
bug_policy_default = {
InformationType.PUBLIC: BugSharingPolicy.PUBLIC,
InformationType.PROPRIETARY: BugSharingPolicy.PROPRIETARY,
- InformationType.EMBARGOED: BugSharingPolicy.EMBARGOED_OR_PROPRIETARY,
}
branch_policy_default = {
InformationType.PUBLIC: BranchSharingPolicy.PUBLIC,
- InformationType.EMBARGOED: BranchSharingPolicy.EMBARGOED_OR_PROPRIETARY,
InformationType.PROPRIETARY: BranchSharingPolicy.PROPRIETARY,
}
specification_policy_default = {
InformationType.PUBLIC: SpecificationSharingPolicy.PUBLIC,
- InformationType.EMBARGOED:
- SpecificationSharingPolicy.EMBARGOED_OR_PROPRIETARY,
InformationType.PROPRIETARY: SpecificationSharingPolicy.PROPRIETARY,
}
@@ -480,7 +476,7 @@
changed. Has the side-effect of creating a commercial subscription if
permitted.
"""
- if value not in PUBLIC_PROPRIETARY_INFORMATION_TYPES:
+ if value not in PILLAR_INFORMATION_TYPES:
yield CannotChangeInformationType('Not supported for Projects.')
if value in PROPRIETARY_INFORMATION_TYPES:
if self.answers_usage == ServiceUsage.LAUNCHPAD:
@@ -1872,7 +1868,8 @@
licenses = set()
if information_type is None:
information_type = InformationType.PUBLIC
- if information_type in PROPRIETARY_INFORMATION_TYPES:
+ if (information_type in PILLAR_INFORMATION_TYPES
+ and information_type in PROPRIETARY_INFORMATION_TYPES):
# This check is skipped in _valid_product_information_type during
# creation, so done here. It predicts whether a commercial
# subscription will be generated based on the selected license,
=== modified file 'lib/lp/registry/services/tests/test_sharingservice.py'
--- lib/lp/registry/services/tests/test_sharingservice.py 2015-05-14 13:57:51 +0000
+++ lib/lp/registry/services/tests/test_sharingservice.py 2015-06-26 10:10:59 +0000
@@ -248,7 +248,7 @@
# proprietary.
owner = self.factory.makePerson()
product = self.factory.makeProduct(
- information_type=InformationType.EMBARGOED,
+ information_type=InformationType.PROPRIETARY,
owner=owner,
branch_sharing_policy=BranchSharingPolicy.EMBARGOED_OR_PROPRIETARY)
with person_logged_in(owner):
=== modified file 'lib/lp/registry/tests/test_packaging.py'
--- lib/lp/registry/tests/test_packaging.py 2012-10-18 14:39:18 +0000
+++ lib/lp/registry/tests/test_packaging.py 2015-06-26 10:10:59 +0000
@@ -188,20 +188,6 @@
series, self.sourcepackagename, self.distroseries,
PackagingType.PRIME, owner=self.owner)
- def test_createPackaging_refuses_EMBARGOED(self):
- """Packaging cannot be created for EMBARGOED productseries"""
- owner = self.factory.makePerson()
- product = self.factory.makeProduct(
- owner=owner,
- information_type=InformationType.EMBARGOED)
- series = self.factory.makeProductSeries(product=product)
- with person_logged_in(owner):
- with ExpectedException(CannotPackageProprietaryProduct,
- 'Only Public project series can be packaged, not Embargoed.'):
- self.packaging_util.createPackaging(
- series, self.sourcepackagename, self.distroseries,
- PackagingType.PRIME, owner=self.owner)
-
class TestPackagingEntryExists(PackagingUtilMixin, TestCaseWithFactory):
"""Test PackagingUtil.packagingEntryExists."""
=== modified file 'lib/lp/registry/tests/test_person.py'
--- lib/lp/registry/tests/test_person.py 2015-05-11 13:17:41 +0000
+++ lib/lp/registry/tests/test_person.py 2015-06-26 10:10:59 +0000
@@ -412,12 +412,12 @@
user.getAffiliatedPillars(user)]
self.assertEqual(expected_pillars, received_pillars)
- def test_getAffiliatedPillars_minus_embargoed(self):
+ def test_getAffiliatedPillars_minus_proprietary(self):
# Skip non public products if not allowed to see them.
owner = self.factory.makePerson()
user = self.factory.makePerson()
self.factory.makeProduct(
- information_type=InformationType.EMBARGOED,
+ information_type=InformationType.PROPRIETARY,
owner=owner)
public = self.factory.makeProduct(
information_type=InformationType.PUBLIC,
@@ -432,15 +432,15 @@
# Users can see their own non-public affiliated products.
owner = self.factory.makePerson()
self.factory.makeProduct(
- name=u'embargoed',
- information_type=InformationType.EMBARGOED,
+ name=u'proprietary',
+ information_type=InformationType.PROPRIETARY,
owner=owner)
self.factory.makeProduct(
name=u'public',
information_type=InformationType.PUBLIC,
owner=owner)
- expected_pillars = [u'embargoed', u'public']
+ expected_pillars = [u'proprietary', u'public']
received_pillars = [pillar.name for pillar in
owner.getAffiliatedPillars(owner)]
self.assertEqual(expected_pillars, received_pillars)
@@ -450,15 +450,15 @@
owner = self.factory.makePerson()
admin = self.factory.makeAdministrator()
self.factory.makeProduct(
- name=u'embargoed',
- information_type=InformationType.EMBARGOED,
+ name=u'proprietary',
+ information_type=InformationType.PROPRIETARY,
owner=owner)
self.factory.makeProduct(
name=u'public',
information_type=InformationType.PUBLIC,
owner=owner)
- expected_pillars = [u'embargoed', u'public']
+ expected_pillars = [u'proprietary', u'public']
received_pillars = [pillar.name for pillar in
owner.getAffiliatedPillars(admin)]
self.assertEqual(expected_pillars, received_pillars)
@@ -468,15 +468,15 @@
owner = self.factory.makePerson()
admin = self.factory.makeCommercialAdmin()
self.factory.makeProduct(
- name=u'embargoed',
- information_type=InformationType.EMBARGOED,
+ name=u'proprietary',
+ information_type=InformationType.PROPRIETARY,
owner=owner)
self.factory.makeProduct(
name=u'public',
information_type=InformationType.PUBLIC,
owner=owner)
- expected_pillars = [u'embargoed', u'public']
+ expected_pillars = [u'proprietary', u'public']
received_pillars = [pillar.name for pillar in
owner.getAffiliatedPillars(admin)]
self.assertEqual(expected_pillars, received_pillars)
=== modified file 'lib/lp/registry/tests/test_product.py'
--- lib/lp/registry/tests/test_product.py 2015-06-25 07:39:40 +0000
+++ lib/lp/registry/tests/test_product.py 2015-06-26 10:10:59 +0000
@@ -27,8 +27,7 @@
from lp.app.enums import (
FREE_INFORMATION_TYPES,
InformationType,
- PROPRIETARY_INFORMATION_TYPES,
- PUBLIC_PROPRIETARY_INFORMATION_TYPES,
+ PILLAR_INFORMATION_TYPES,
ServiceUsage,
)
from lp.app.errors import ServiceUsageForbidden
@@ -127,6 +126,8 @@
TranslationsBranchImportMode,
)
+PRIVATE_PROJECT_TYPES = [InformationType.PROPRIETARY]
+
class ValidationTestCase(TestCase):
"""Test IProduct validators."""
@@ -383,29 +384,6 @@
expected = [InformationType.PROPRIETARY]
self.assertContentEqual(expected, [policy.type for policy in aps])
- def test_embargoed_product_creation_sharing_policies(self):
- # Creating a new embargoed product sets the branch and
- # specification sharing polices to embargoed or proprietary, and the
- # bug sharing policy to proprietary.
- owner = self.factory.makePerson()
- with person_logged_in(owner):
- product = getUtility(IProductSet).createProduct(
- owner, 'carrot', 'Carrot', 'Carrot', 'testing',
- licenses=[License.OTHER_PROPRIETARY],
- information_type=InformationType.EMBARGOED)
- self.assertEqual(
- BugSharingPolicy.EMBARGOED_OR_PROPRIETARY,
- product.bug_sharing_policy)
- self.assertEqual(
- BranchSharingPolicy.EMBARGOED_OR_PROPRIETARY,
- product.branch_sharing_policy)
- self.assertEqual(
- SpecificationSharingPolicy.EMBARGOED_OR_PROPRIETARY,
- product.specification_sharing_policy)
- aps = getUtility(IAccessPolicySource).findByPillar([product])
- expected = [InformationType.PROPRIETARY, InformationType.EMBARGOED]
- self.assertContentEqual(expected, [policy.type for policy in aps])
-
def test_other_proprietary_product_creation_sharing_policies(self):
# Creating a new product with other/proprietary license leaves bug
# and branch sharing polices at their default.
@@ -433,7 +411,7 @@
)
self.useContext(person_logged_in(product.owner))
spec = self.factory.makeSpecification(product=product)
- for info_type in PROPRIETARY_INFORMATION_TYPES:
+ for info_type in PRIVATE_PROJECT_TYPES:
with ExpectedException(
CannotChangeInformationType, 'Some blueprints are public.'):
product.information_type = info_type
@@ -442,7 +420,7 @@
bug = self.factory.makeBug(target=product)
for bug_info_type in FREE_INFORMATION_TYPES:
bug.transitionToInformationType(bug_info_type, product.owner)
- for info_type in PROPRIETARY_INFORMATION_TYPES:
+ for info_type in PRIVATE_PROJECT_TYPES:
with ExpectedException(
CannotChangeInformationType,
'Some bugs are neither proprietary nor embargoed.'):
@@ -453,14 +431,14 @@
for branch_info_type in FREE_INFORMATION_TYPES:
branch.transitionToInformationType(branch_info_type,
product.owner)
- for info_type in PROPRIETARY_INFORMATION_TYPES:
+ for info_type in PRIVATE_PROJECT_TYPES:
with ExpectedException(
CannotChangeInformationType,
'Some branches are neither proprietary nor embargoed.'):
product.information_type = info_type
branch.transitionToInformationType(InformationType.PROPRIETARY,
product.owner)
- for info_type in PROPRIETARY_INFORMATION_TYPES:
+ for info_type in PRIVATE_PROJECT_TYPES:
product.information_type = info_type
def test_change_info_type_proprietary_check_translations(self):
@@ -470,7 +448,7 @@
for usage in ServiceUsage:
product.information_type = InformationType.PUBLIC
product.translations_usage = usage.value
- for info_type in PROPRIETARY_INFORMATION_TYPES:
+ for info_type in PRIVATE_PROJECT_TYPES:
if product.translations_usage == ServiceUsage.LAUNCHPAD:
with ExpectedException(
CannotChangeInformationType,
@@ -493,22 +471,6 @@
SpecificationSharingPolicy.PROPRIETARY,
product.specification_sharing_policy)
- def test_change_info_type_embargoed_sets_policies(self):
- # Changing information type from public to embargoed sets the
- # appropriate policies
- product = self.factory.makeProduct()
- with person_logged_in(product.owner):
- product.information_type = InformationType.EMBARGOED
- self.assertEqual(
- BranchSharingPolicy.EMBARGOED_OR_PROPRIETARY,
- product.branch_sharing_policy)
- self.assertEqual(
- BugSharingPolicy.EMBARGOED_OR_PROPRIETARY,
- product.bug_sharing_policy)
- self.assertEqual(
- SpecificationSharingPolicy.EMBARGOED_OR_PROPRIETARY,
- product.specification_sharing_policy)
-
def test_proprietary_to_public_leaves_policies(self):
# Changing information type from public leaves sharing policies
# unchanged.
@@ -535,7 +497,7 @@
for policy in (token.value for token in TeamMembershipPolicy):
with person_logged_in(team.teamowner):
team.membership_policy = policy
- for info_type in PROPRIETARY_INFORMATION_TYPES:
+ for info_type in PRIVATE_PROJECT_TYPES:
with person_logged_in(product.owner):
errors = list(product.checkInformationType(info_type))
if policy in EXCLUSIVE_TEAM_POLICY:
@@ -549,12 +511,12 @@
def test_checkInformationType_questions(self):
# Proprietary products must not have questions.
product = self.factory.makeProduct()
- for info_type in PROPRIETARY_INFORMATION_TYPES:
+ for info_type in PRIVATE_PROJECT_TYPES:
with person_logged_in(product.owner):
self.assertEqual([],
list(product.checkInformationType(info_type)))
self.factory.makeQuestion(target=product)
- for info_type in PROPRIETARY_INFORMATION_TYPES:
+ for info_type in PRIVATE_PROJECT_TYPES:
with person_logged_in(product.owner):
error, = list(product.checkInformationType(info_type))
with ExpectedException(
@@ -565,12 +527,12 @@
# Proprietary products must not have translations.
productseries = self.factory.makeProductSeries()
product = productseries.product
- for info_type in PROPRIETARY_INFORMATION_TYPES:
+ for info_type in PRIVATE_PROJECT_TYPES:
with person_logged_in(product.owner):
self.assertEqual([],
list(product.checkInformationType(info_type)))
self.factory.makePOTemplate(productseries=productseries)
- for info_type in PROPRIETARY_INFORMATION_TYPES:
+ for info_type in PRIVATE_PROJECT_TYPES:
with person_logged_in(product.owner):
error, = list(product.checkInformationType(info_type))
with ExpectedException(
@@ -583,7 +545,7 @@
product = productseries.product
entry = self.factory.makeTranslationImportQueueEntry(
productseries=productseries)
- for info_type in PROPRIETARY_INFORMATION_TYPES:
+ for info_type in PRIVATE_PROJECT_TYPES:
with person_logged_in(product.owner):
error, = list(product.checkInformationType(info_type))
with ExpectedException(
@@ -592,7 +554,7 @@
raise error
removeSecurityProxy(entry).delete(entry.id)
with person_logged_in(product.owner):
- for info_type in PROPRIETARY_INFORMATION_TYPES:
+ for info_type in PRIVATE_PROJECT_TYPES:
self.assertContentEqual(
[], product.checkInformationType(info_type))
@@ -605,7 +567,7 @@
if mode == TranslationsBranchImportMode.NO_IMPORT:
continue
productseries.translations_autoimport_mode = mode
- for info_type in PROPRIETARY_INFORMATION_TYPES:
+ for info_type in PRIVATE_PROJECT_TYPES:
error, = list(product.checkInformationType(info_type))
with ExpectedException(
CannotChangeInformationType,
@@ -613,7 +575,7 @@
raise error
productseries.translations_autoimport_mode = (
TranslationsBranchImportMode.NO_IMPORT)
- for info_type in PROPRIETARY_INFORMATION_TYPES:
+ for info_type in PRIVATE_PROJECT_TYPES:
self.assertContentEqual(
[], product.checkInformationType(info_type))
@@ -625,7 +587,7 @@
with person_logged_in(series.owner):
bug.addTask(series.owner, series)
bug.default_bugtask.delete()
- for info_type in PROPRIETARY_INFORMATION_TYPES:
+ for info_type in PRIVATE_PROJECT_TYPES:
error, = list(series.product.checkInformationType(info_type))
with ExpectedException(
CannotChangeInformationType,
@@ -636,7 +598,7 @@
owner = self.factory.makePerson()
product = self.factory.makeProduct(owner=owner)
self.useContext(person_logged_in(owner))
- for info_type in PROPRIETARY_INFORMATION_TYPES:
+ for info_type in PRIVATE_PROJECT_TYPES:
product.information_type = info_type
with ExpectedException(
ProprietaryProduct,
@@ -664,35 +626,35 @@
def test_product_information_type(self):
# Product is created with specified information_type
product = self.createProduct(
- information_type=InformationType.EMBARGOED,
+ information_type=InformationType.PROPRIETARY,
license=License.OTHER_PROPRIETARY)
- self.assertEqual(InformationType.EMBARGOED, product.information_type)
+ self.assertEqual(InformationType.PROPRIETARY, product.information_type)
# Owner can set information_type
with person_logged_in(removeSecurityProxy(product).owner):
- product.information_type = InformationType.PROPRIETARY
- self.assertEqual(InformationType.PROPRIETARY, product.information_type)
+ product.information_type = InformationType.PUBLIC
+ self.assertEqual(InformationType.PUBLIC, product.information_type)
# Database persists information_type value
store = Store.of(product)
store.flush()
store.reset()
product = store.get(Product, product.id)
- self.assertEqual(InformationType.PROPRIETARY, product.information_type)
- self.assertTrue(product.private)
+ self.assertEqual(InformationType.PUBLIC, product.information_type)
+ self.assertFalse(product.private)
def test_switching_product_to_public_does_not_create_policy(self):
- # Creating a Embargoed product and switching it to Public does not
- # create a PUBLIC AccessPolicy.
+ # Creating a Proprietary product and switching it to Public does
+ # not create a PUBLIC AccessPolicy.
product = self.createProduct(
- information_type=InformationType.EMBARGOED,
+ information_type=InformationType.PROPRIETARY,
license=License.OTHER_PROPRIETARY)
aps = getUtility(IAccessPolicySource).findByPillar([product])
self.assertContentEqual(
- [InformationType.PROPRIETARY, InformationType.EMBARGOED],
+ [InformationType.PROPRIETARY],
[ap.type for ap in aps])
removeSecurityProxy(product).information_type = InformationType.PUBLIC
aps = getUtility(IAccessPolicySource).findByPillar([product])
self.assertContentEqual(
- [InformationType.PROPRIETARY, InformationType.EMBARGOED],
+ [InformationType.PROPRIETARY],
[ap.type for ap in aps])
def test_product_information_type_default(self):
@@ -703,9 +665,9 @@
self.assertEqual(InformationType.PUBLIC, product.information_type)
self.assertFalse(product.private)
- invalid_information_types = [info_type for info_type in
- InformationType.items if info_type not in
- PUBLIC_PROPRIETARY_INFORMATION_TYPES]
+ invalid_information_types = [
+ info_type for info_type in InformationType.items
+ if info_type not in PILLAR_INFORMATION_TYPES]
def test_product_information_type_init_invalid_values(self):
# Cannot create Product.information_type with invalid values.
@@ -757,41 +719,39 @@
# However we can't change it back to a Proprietary because our
# commercial subscription has expired.
- for info_type in PROPRIETARY_INFORMATION_TYPES:
- with ExpectedException(
+ with ExpectedException(
CommercialSubscribersOnly,
'A valid commercial subscription is required for private'
' Projects.'):
- product.information_type = info_type
+ product.information_type = InformationType.PROPRIETARY
def test_product_information_init_proprietary_requires_commercial(self):
# Cannot create a product with proprietary types without specifying
# Other/Proprietary license.
- for info_type in PROPRIETARY_INFORMATION_TYPES:
- with ExpectedException(
+ with ExpectedException(
CommercialSubscribersOnly,
'A valid commercial subscription is required for private'
' Projects.'):
- self.createProduct(info_type)
- for info_type in PROPRIETARY_INFORMATION_TYPES:
- product = self.createProduct(info_type, License.OTHER_PROPRIETARY)
- self.assertEqual(info_type, product.information_type)
+ self.createProduct(InformationType.PROPRIETARY)
+ product = self.createProduct(
+ InformationType.PROPRIETARY, License.OTHER_PROPRIETARY)
+ self.assertEqual(InformationType.PROPRIETARY, product.information_type)
def test_no_answers_for_proprietary(self):
# Enabling Answers is forbidden while information_type is proprietary.
- for info_type in PROPRIETARY_INFORMATION_TYPES:
- product = self.factory.makeProduct(information_type=info_type)
- with person_logged_in(removeSecurityProxy(product).owner):
- self.assertEqual(ServiceUsage.UNKNOWN, product.answers_usage)
- for usage in ServiceUsage.items:
- if usage == ServiceUsage.LAUNCHPAD:
- with ExpectedException(
- ServiceUsageForbidden,
- "Answers not allowed for non-public projects."):
- product.answers_usage = ServiceUsage.LAUNCHPAD
- else:
- # all other values are permitted.
- product.answers_usage = usage
+ product = self.factory.makeProduct(
+ information_type=InformationType.PROPRIETARY)
+ with person_logged_in(removeSecurityProxy(product).owner):
+ self.assertEqual(ServiceUsage.UNKNOWN, product.answers_usage)
+ for usage in ServiceUsage.items:
+ if usage == ServiceUsage.LAUNCHPAD:
+ with ExpectedException(
+ ServiceUsageForbidden,
+ "Answers not allowed for non-public projects."):
+ product.answers_usage = ServiceUsage.LAUNCHPAD
+ else:
+ # all other values are permitted.
+ product.answers_usage = usage
def test_answers_for_public(self):
# Enabling answers is permitted while information_type is PUBLIC.
@@ -1226,14 +1186,14 @@
# Access policies for Product.information_type are not pruned.
owner = self.factory.makePerson()
product = self.factory.makeProduct(
- information_type=InformationType.EMBARGOED, owner=owner)
+ information_type=InformationType.PROPRIETARY, owner=owner)
with person_logged_in(owner):
- product.setBugSharingPolicy(BugSharingPolicy.PROPRIETARY)
+ product.setBugSharingPolicy(BugSharingPolicy.FORBIDDEN)
product.setSpecificationSharingPolicy(
- SpecificationSharingPolicy.PROPRIETARY)
- product.setBranchSharingPolicy(BranchSharingPolicy.PROPRIETARY)
+ SpecificationSharingPolicy.FORBIDDEN)
+ product.setBranchSharingPolicy(BranchSharingPolicy.FORBIDDEN)
self.assertIsNot(None, getUtility(IAccessPolicySource).find(
- [(product, InformationType.EMBARGOED)]).one())
+ [(product, InformationType.PROPRIETARY)]).one())
class TestProductBugInformationTypes(TestCaseWithFactory):
@@ -1794,12 +1754,6 @@
with ExpectedException(
ProprietaryProduct, "The project is Proprietary."):
self.setSharingPolicy(policy, owner)
- with person_logged_in(owner):
- self.product.information_type = InformationType.EMBARGOED
- for policy in policies_permitting_public:
- with ExpectedException(
- ProprietaryProduct, "The project is Embargoed."):
- self.setSharingPolicy(policy, owner)
class ProductBugSharingPolicyTestCase(BaseSharingPolicyTests,
@@ -2216,11 +2170,9 @@
def makeAllInformationTypes(self):
proprietary = self.factory.makeProduct(
information_type=InformationType.PROPRIETARY)
- embargoed = self.factory.makeProduct(
- information_type=InformationType.EMBARGOED)
public = self.factory.makeProduct(
information_type=InformationType.PUBLIC)
- return proprietary, embargoed, public
+ return proprietary, public
@staticmethod
def filterFind(user):
@@ -2236,22 +2188,15 @@
proprietary = self.factory.makeProduct(
information_type=InformationType.PROPRIETARY,
owner=owner)
- embargoed = self.factory.makeProduct(
- information_type=InformationType.EMBARGOED,
- owner=owner)
result = ProductSet.get_users_private_products(owner)
self.assertIn(proprietary, result)
- self.assertIn(embargoed, result)
def test_get_all_active_omits_proprietary(self):
# Ignore proprietary products for anonymous users
proprietary = self.factory.makeProduct(
information_type=InformationType.PROPRIETARY)
- embargoed = self.factory.makeProduct(
- information_type=InformationType.EMBARGOED)
result = ProductSet.get_all_active(None)
self.assertNotIn(proprietary, result)
- self.assertNotIn(embargoed, result)
def test_search_respects_privacy(self):
# Proprietary products are filtered from the results for people who
@@ -2266,19 +2211,17 @@
def test_getProductPrivacyFilterAnonymous(self):
# Ignore proprietary products for anonymous users
- proprietary, embargoed, public = self.makeAllInformationTypes()
+ proprietary, public = self.makeAllInformationTypes()
result = self.filterFind(None)
self.assertIn(public, result)
- self.assertNotIn(embargoed, result)
self.assertNotIn(proprietary, result)
def test_getProductPrivacyFilter_excludes_random_users(self):
# Exclude proprietary products for anonymous users
random = self.factory.makePerson()
- proprietary, embargoed, public = self.makeAllInformationTypes()
+ proprietary, public = self.makeAllInformationTypes()
result = self.filterFind(random)
self.assertIn(public, result)
- self.assertNotIn(embargoed, result)
self.assertNotIn(proprietary, result)
def grant(self, pillar, information_type, grantee):
@@ -2290,61 +2233,52 @@
def test_getProductPrivacyFilter_respects_grants(self):
# Include proprietary products for users with right grants.
grantee = self.factory.makePerson()
- proprietary, embargoed, public = self.makeAllInformationTypes()
- self.grant(embargoed, InformationType.EMBARGOED, grantee)
+ proprietary, public = self.makeAllInformationTypes()
self.grant(proprietary, InformationType.PROPRIETARY, grantee)
result = self.filterFind(grantee)
self.assertIn(public, result)
- self.assertIn(embargoed, result)
self.assertIn(proprietary, result)
def test_getProductPrivacyFilter_ignores_wrong_product(self):
# Exclude proprietary products if grant is on wrong product.
grantee = self.factory.makePerson()
- proprietary, embargoed, public = self.makeAllInformationTypes()
+ proprietary, public = self.makeAllInformationTypes()
self.factory.makeAccessPolicyGrant(grantee=grantee)
result = self.filterFind(grantee)
self.assertIn(public, result)
- self.assertNotIn(embargoed, result)
self.assertNotIn(proprietary, result)
def test_getProductPrivacyFilter_ignores_wrong_info_type(self):
# Exclude proprietary products if grant is on wrong information type.
grantee = self.factory.makePerson()
- proprietary, embargoed, public = self.makeAllInformationTypes()
- self.grant(embargoed, InformationType.PROPRIETARY, grantee)
+ proprietary, public = self.makeAllInformationTypes()
self.factory.makeAccessPolicy(proprietary, InformationType.EMBARGOED)
self.grant(proprietary, InformationType.EMBARGOED, grantee)
result = self.filterFind(grantee)
self.assertIn(public, result)
- self.assertNotIn(embargoed, result)
self.assertNotIn(proprietary, result)
def test_getProductPrivacyFilter_respects_team_grants(self):
# Include proprietary products for users in teams with right grants.
grantee = self.factory.makeTeam()
- proprietary, embargoed, public = self.makeAllInformationTypes()
- self.grant(embargoed, InformationType.EMBARGOED, grantee)
+ proprietary, public = self.makeAllInformationTypes()
self.grant(proprietary, InformationType.PROPRIETARY, grantee)
result = self.filterFind(grantee.teamowner)
self.assertIn(public, result)
- self.assertIn(embargoed, result)
self.assertIn(proprietary, result)
def test_getProductPrivacyFilter_includes_admins(self):
# Launchpad admins can see everything.
- proprietary, embargoed, public = self.makeAllInformationTypes()
+ proprietary, public = self.makeAllInformationTypes()
result = self.filterFind(self.factory.makeAdministrator())
self.assertIn(public, result)
- self.assertIn(embargoed, result)
self.assertIn(proprietary, result)
def test_getProductPrivacyFilter_includes_commercial_admins(self):
# Commercial admins can see everything.
- proprietary, embargoed, public = self.makeAllInformationTypes()
+ proprietary, public = self.makeAllInformationTypes()
result = self.filterFind(self.factory.makeCommercialAdmin())
self.assertIn(public, result)
- self.assertIn(embargoed, result)
self.assertIn(proprietary, result)
=== modified file 'lib/lp/registry/tests/test_product_vocabularies.py'
--- lib/lp/registry/tests/test_product_vocabularies.py 2012-10-19 10:34:55 +0000
+++ lib/lp/registry/tests/test_product_vocabularies.py 2015-06-26 10:10:59 +0000
@@ -104,10 +104,6 @@
# Embargoed and proprietary products are only returned if
# the current user can see them.
public_product = self.factory.makeProduct('quux-public')
- embargoed_owner = self.factory.makePerson()
- embargoed_product = self.factory.makeProduct(
- name='quux-embargoed', owner=embargoed_owner,
- information_type=InformationType.EMBARGOED)
proprietary_owner = self.factory.makePerson()
proprietary_product = self.factory.makeProduct(
name='quux-proprietary', owner=proprietary_owner,
@@ -125,17 +121,17 @@
self.assertEqual([public_product], list(result))
# People with grants on a private product can see this product.
- with person_logged_in(embargoed_owner):
+ with person_logged_in(proprietary_owner):
getUtility(IService, 'sharing').sharePillarInformation(
- embargoed_product, user, embargoed_owner,
- {InformationType.EMBARGOED: SharingPermission.ALL})
+ proprietary_product, user, proprietary_owner,
+ {InformationType.PROPRIETARY: SharingPermission.ALL})
with person_logged_in(user):
result = self.vocabulary.search('quux')
- self.assertEqual([embargoed_product, public_product], list(result))
+ self.assertEqual(
+ [proprietary_product, public_product], list(result))
# Admins can see all products.
with celebrity_logged_in('admin'):
result = self.vocabulary.search('quux')
self.assertEqual(
- [embargoed_product, proprietary_product, public_product],
- list(result))
+ [proprietary_product, public_product], list(result))
=== modified file 'lib/lp/registry/tests/test_productseries.py'
--- lib/lp/registry/tests/test_productseries.py 2015-01-29 14:14:01 +0000
+++ lib/lp/registry/tests/test_productseries.py 2015-06-26 10:10:59 +0000
@@ -16,10 +16,7 @@
from zope.security.interfaces import Unauthorized
from zope.security.proxy import removeSecurityProxy
-from lp.app.enums import (
- InformationType,
- PROPRIETARY_INFORMATION_TYPES,
- )
+from lp.app.enums import InformationType
from lp.app.interfaces.informationtype import IInformationType
from lp.app.interfaces.services import IService
from lp.registry.enums import SharingPermission
@@ -74,15 +71,14 @@
# Autoimports are forbidden if products are proprietary/embargoed.
series = self.factory.makeProductSeries()
self.useContext(person_logged_in(series.product.owner))
- for info_type in PROPRIETARY_INFORMATION_TYPES:
- series.product.information_type = info_type
- for mode in TranslationsBranchImportMode.items:
- if mode == TranslationsBranchImportMode.NO_IMPORT:
- continue
- with ExpectedException(ProprietaryProduct,
- 'Translations are disabled for proprietary'
- ' projects.'):
- series.translations_autoimport_mode = mode
+ series.product.information_type = InformationType.PROPRIETARY
+ for mode in TranslationsBranchImportMode.items:
+ if mode == TranslationsBranchImportMode.NO_IMPORT:
+ continue
+ with ExpectedException(ProprietaryProduct,
+ 'Translations are disabled for proprietary'
+ ' projects.'):
+ series.translations_autoimport_mode = mode
class ProductSeriesReleasesTestCase(TestCaseWithFactory):
@@ -201,17 +197,6 @@
series.setPackaging(
sp.distroseries, sp.sourcepackagename, series.owner)
- def test_refuses_EMBARGOED(self):
- """Packaging cannot be created for EMBARGOED productseries"""
- product = self.factory.makeProduct(
- information_type=InformationType.EMBARGOED)
- sp = self.makeSourcePackage()
- series = self.factory.makeProductSeries(product=product)
- with ExpectedException(CannotPackageProprietaryProduct,
- 'Only Public project series can be packaged, not Embargoed.'):
- series.setPackaging(
- sp.distroseries, sp.sourcepackagename, series.owner)
-
def test_setPackaging_two_packagings(self):
# More than one sourcepackage from the same distroseries
# can be linked to a productseries.
=== modified file 'lib/lp/translations/browser/tests/test_product_view.py'
--- lib/lp/translations/browser/tests/test_product_view.py 2014-02-19 04:01:46 +0000
+++ lib/lp/translations/browser/tests/test_product_view.py 2015-06-26 10:10:59 +0000
@@ -12,7 +12,7 @@
from lp.app.enums import (
InformationType,
- PUBLIC_PROPRIETARY_INFORMATION_TYPES,
+ PILLAR_INFORMATION_TYPES,
ServiceUsage,
)
from lp.registry.interfaces.series import SeriesStatus
@@ -132,7 +132,7 @@
def test_launchpad_not_listed_for_proprietary(self):
product = self.factory.makeProduct()
with person_logged_in(product.owner):
- for info_type in PUBLIC_PROPRIETARY_INFORMATION_TYPES:
+ for info_type in PILLAR_INFORMATION_TYPES:
product.information_type = info_type
view = create_initialized_view(
product, '+configure-translations')
Follow ups