launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #08387
[Merge] lp:~stevenk/launchpad/branch-information_type-factory into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/branch-information_type-factory into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #933768 in Launchpad itself: "Update branch to use information_visibility_policy"
https://bugs.launchpad.net/launchpad/+bug/933768
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/branch-information_type-factory/+merge/108094
Change factory.make*Branch() to no longer take a private argument, and instead rely on information_type, and change all callsites.
--
https://code.launchpad.net/~stevenk/launchpad/branch-information_type-factory/+merge/108094
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/branch-information_type-factory into lp:launchpad.
=== modified file 'lib/lp/app/browser/tests/test_launchpad.py'
--- lib/lp/app/browser/tests/test_launchpad.py 2012-05-24 02:16:59 +0000
+++ lib/lp/app/browser/tests/test_launchpad.py 2012-05-31 03:58:20 +0000
@@ -173,7 +173,8 @@
def test_private_branch(self):
# If an attempt is made to access a private branch, display an error.
- branch = self.factory.makeProductBranch(private=True)
+ branch = self.factory.makeProductBranch(
+ information_type=InformationType.USERDATA)
branch_unique_name = removeSecurityProxy(branch).unique_name
login(ANONYMOUS)
requiredMessage = "No such branch: '%s'." % branch_unique_name
@@ -251,7 +252,8 @@
# message telling the user there is no linked branch.
sourcepackage = self.factory.makeSourcePackage()
branch = self.factory.makePackageBranch(
- sourcepackage=sourcepackage, private=True)
+ sourcepackage=sourcepackage,
+ information_type=InformationType.USERDATA)
distro_package = sourcepackage.distribution_sourcepackage
registrant = distro_package.distribution.owner
with person_logged_in(registrant):
@@ -298,7 +300,8 @@
def test_private_branch_for_series(self):
# If the development focus of a product series is private, display a
# message telling the user there is no linked branch.
- branch = self.factory.makeBranch(private=True)
+ branch = self.factory.makeBranch(
+ information_type=InformationType.USERDATA)
series = self.factory.makeProductSeries(branch=branch)
login(ANONYMOUS)
path = ICanHasLinkedBranch(series).bzr_path
=== modified file 'lib/lp/bugs/model/tests/test_bug.py'
--- lib/lp/bugs/model/tests/test_bug.py 2012-05-16 09:05:42 +0000
+++ lib/lp/bugs/model/tests/test_bug.py 2012-05-31 03:58:20 +0000
@@ -456,7 +456,8 @@
bug = self.factory.makeBug()
private_branch_owner = self.factory.makePerson()
private_branch = self.factory.makeBranch(
- owner=private_branch_owner, private=True)
+ owner=private_branch_owner,
+ information_type=InformationType.USERDATA)
with person_logged_in(private_branch_owner):
bug.linkBranch(private_branch, private_branch.registrant)
public_branch_owner = self.factory.makePerson()
=== modified file 'lib/lp/bugs/tests/test_bugchanges.py'
--- lib/lp/bugs/tests/test_bugchanges.py 2012-05-08 01:06:31 +0000
+++ lib/lp/bugs/tests/test_bugchanges.py 2012-05-31 03:58:20 +0000
@@ -502,7 +502,8 @@
def test_link_private_branch(self):
# Linking a *private* branch to a bug adds *nothing* to the
# activity log and does *not* send an e-mail notification.
- branch = self.factory.makeBranch(private=True)
+ branch = self.factory.makeBranch(
+ information_type=InformationType.USERDATA)
self.bug.linkBranch(branch, self.user)
self.assertRecordedChange()
@@ -555,7 +556,8 @@
def test_unlink_private_branch(self):
# Unlinking a *private* branch from a bug adds *nothing* to
# the activity log and does *not* send an e-mail notification.
- branch = self.factory.makeBranch(private=True)
+ branch = self.factory.makeBranch(
+ information_type=InformationType.USERDATA)
self.bug.linkBranch(branch, self.user)
self.saveOldChanges()
self.bug.unlinkBranch(branch, self.user)
=== modified file 'lib/lp/code/browser/tests/test_bazaar.py'
--- lib/lp/code/browser/tests/test_bazaar.py 2012-01-01 02:58:52 +0000
+++ lib/lp/code/browser/tests/test_bazaar.py 2012-05-31 03:58:20 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for classes in the lp.code.browser.bazaar module."""
@@ -8,6 +8,7 @@
from zope.security.proxy import removeSecurityProxy
from lp.code.browser.bazaar import BazaarApplicationView
+from lp.registry.enums import InformationType
from lp.services.webapp.authorization import check_permission
from lp.services.webapp.servers import LaunchpadTestRequest
from lp.testing import (
@@ -34,7 +35,8 @@
def test_recently_registered(self):
# Create a some private branches (stacked and unstacked) that the
# logged in user would not normally see.
- private_branch = self.factory.makeAnyBranch(private=True)
+ private_branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
self.factory.makeAnyBranch(stacked_on=private_branch)
branch = self.factory.makeAnyBranch()
recent_branches = self.getViewBranches('recently_registered_branches')
@@ -51,7 +53,8 @@
def test_recently_changed(self):
# Create a some private branches (stacked and unstacked) that the
# logged in user would not normally see.
- private_branch = self.factory.makeAnyBranch(private=True)
+ private_branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
stacked_private_branch = self.factory.makeAnyBranch(
stacked_on=private_branch)
branch = self.factory.makeAnyBranch()
@@ -65,7 +68,8 @@
# Create an import branch that is stacked on a private branch that the
# logged in user would not normally see. This would never happen in
# reality, but hey, lets test the function actually works.
- private_branch = self.factory.makeAnyBranch(private=True)
+ private_branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
# A new code import needs a real user as the sender for the outgoing
# email.
login_person(self.factory.makePerson())
=== modified file 'lib/lp/code/browser/tests/test_branchmergeproposal.py'
--- lib/lp/code/browser/tests/test_branchmergeproposal.py 2012-05-24 02:16:59 +0000
+++ lib/lp/code/browser/tests/test_branchmergeproposal.py 2012-05-31 03:58:20 +0000
@@ -472,7 +472,8 @@
# Make a branch the reviewer cannot see.
owner = self.factory.makePerson()
- target_branch = self._makeTargetBranch(owner=owner, private=True)
+ target_branch = self._makeTargetBranch(
+ owner=owner, information_type=InformationType.USERDATA)
reviewer = self.factory.makePerson()
extra = {'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest'}
request = LaunchpadTestRequest(
@@ -498,7 +499,8 @@
# Ajax submits where there is a validation error in the submitted data
# return the expected json response containing the error info.
owner = self.factory.makePerson()
- target_branch = self._makeTargetBranch(owner=owner, private=True)
+ target_branch = self._makeTargetBranch(
+ owner=owner, information_type=InformationType.USERDATA)
extra = {'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest'}
with person_logged_in(owner):
request = LaunchpadTestRequest(
@@ -670,7 +672,7 @@
# notification message is displayed.
owner = self.factory.makePerson()
target_branch = self._makeTargetBranch(
- private=True, owner=owner)
+ owner=owner, information_type=InformationType.USERDATA)
reviewer = self.factory.makePerson()
with person_logged_in(owner):
view = self._createView()
=== modified file 'lib/lp/code/browser/tests/test_branchmergeproposallisting.py'
--- lib/lp/code/browser/tests/test_branchmergeproposallisting.py 2011-12-30 06:14:56 +0000
+++ lib/lp/code/browser/tests/test_branchmergeproposallisting.py 2012-05-31 03:58:20 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Unit tests for BranchMergeProposal listing views."""
@@ -23,6 +23,7 @@
BranchMergeProposalStatus,
CodeReviewVote,
)
+from lp.registry.enums import InformationType
from lp.registry.model.personproduct import PersonProduct
from lp.services.database.sqlbase import flush_database_caches
from lp.services.webapp.servers import LaunchpadTestRequest
@@ -380,7 +381,8 @@
# Merge proposals against private branches are visible to
# the branch owner.
product = self.factory.makeProduct()
- branch = self.factory.makeBranch(private=True, product=product)
+ branch = self.factory.makeBranch(
+ product=product, information_type=InformationType.USERDATA)
with person_logged_in(removeSecurityProxy(branch).owner):
mp = self.factory.makeBranchMergeProposal(target_branch=branch)
view = create_initialized_view(
=== modified file 'lib/lp/code/browser/tests/test_branchmergequeuelisting.py'
--- lib/lp/code/browser/tests/test_branchmergequeuelisting.py 2012-01-01 02:58:52 +0000
+++ lib/lp/code/browser/tests/test_branchmergequeuelisting.py 2012-05-31 03:58:20 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for branch listing."""
@@ -11,6 +11,7 @@
import soupmatchers
from zope.security.proxy import removeSecurityProxy
+from lp.registry.enums import InformationType
from lp.services.features.model import (
FeatureFlag,
getFeatureStore,
@@ -49,7 +50,7 @@
mergequeues = [
self.factory.makeBranchMergeQueue(
owner=self.branch_owner, branches=self._makeBranches())
- for i in range(nr_queues-nr_with_private_branches)]
+ for i in range(nr_queues - nr_with_private_branches)]
mergequeues_with_private_branches = [
self.factory.makeBranchMergeQueue(
owner=self.branch_owner,
@@ -65,7 +66,8 @@
private_branches = [
self.factory.makeProductBranch(
- owner=self.branch_owner, private=True)
+ owner=self.branch_owner,
+ information_type=InformationType.USERDATA)
for i in range(nr_private)]
branches.extend(private_branches)
=== modified file 'lib/lp/code/browser/tests/test_product.py'
--- lib/lp/code/browser/tests/test_product.py 2012-03-08 19:25:58 +0000
+++ lib/lp/code/browser/tests/test_product.py 2012-05-31 03:58:20 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for the product view classes and templates."""
@@ -21,6 +21,7 @@
)
from lp.code.interfaces.revision import IRevisionSet
from lp.code.publisher import CodeLayer
+from lp.registry.enums import InformationType
from lp.services.webapp import canonical_url
from lp.testing import (
ANONYMOUS,
@@ -104,7 +105,7 @@
# see at least one branch for the product they can still see the
# +code-index page.
product, branch = self.makeProductAndDevelopmentFocusBranch(
- private=True)
+ information_type=InformationType.USERDATA)
self.factory.makeProductBranch(product=product)
# This is just "assertNotRaises"
self.getUserBrowser(canonical_url(product, rootsite='code'))
@@ -117,7 +118,7 @@
def test_initial_branches_does_not_contain_private_dev_focus_branch(self):
product, branch = self.makeProductAndDevelopmentFocusBranch(
- private=True)
+ information_type=InformationType.USERDATA)
view = create_initialized_view(product, '+code-index',
rootsite='code')
self.assertNotIn(branch, view.initial_branches)
@@ -144,7 +145,7 @@
# for a private branch.
fsm = self.factory.makePerson(email='flyingpasta@xxxxxxxxxxx')
product, branch = self.makeProductAndDevelopmentFocusBranch(
- private=True, owner=fsm)
+ owner=fsm, information_type=InformationType.USERDATA)
date_generator = time_counter(
datetime.now(pytz.UTC) - timedelta(days=30),
timedelta(days=1))
@@ -166,7 +167,7 @@
# for a private branch.
fsm = self.factory.makePerson(email='flyingpasta@xxxxxxxxxxx')
product, branch = self.makeProductAndDevelopmentFocusBranch(
- private=True, owner=fsm)
+ owner=fsm, information_type=InformationType.USERDATA)
date_generator = time_counter(
datetime.now(pytz.UTC) - timedelta(days=30),
timedelta(days=1))
=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipe.py'
--- lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2012-02-28 04:24:19 +0000
+++ lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2012-05-31 03:58:20 +0000
@@ -35,6 +35,7 @@
)
from lp.code.interfaces.sourcepackagerecipe import MINIMAL_RECIPE_TEXT
from lp.code.tests.helpers import recipe_parser_newest_version
+from lp.registry.enums import InformationType
from lp.registry.interfaces.person import TeamSubscriptionPolicy
from lp.registry.interfaces.pocket import PackagePublishingPocket
from lp.registry.interfaces.series import SeriesStatus
@@ -322,7 +323,8 @@
def test_create_new_recipe_private_branch(self):
# Recipes can't be created on private branches.
with person_logged_in(self.chef):
- branch = self.factory.makeBranch(private=True, owner=self.chef)
+ branch = self.factory.makeBranch(
+ owner=self.chef, information_type=InformationType.USERDATA)
branch_url = canonical_url(branch)
browser = self.getUserBrowser(branch_url, user=self.chef)
@@ -516,7 +518,8 @@
def test_create_recipe_private_branch(self):
# If a user tries to create source package recipe with a private
# base branch, they should get an error.
- branch = self.factory.makeAnyBranch(private=True, owner=self.user)
+ branch = self.factory.makeAnyBranch(
+ owner=self.user, information_type=InformationType.USERDATA)
with person_logged_in(self.user):
bzr_identity = branch.bzr_identity
recipe_text = MINIMAL_RECIPE_TEXT % bzr_identity
@@ -933,7 +936,8 @@
# If a user tries to set source package recipe to use a private
# branch, they should get an error.
recipe = self.factory.makeSourcePackageRecipe(owner=self.user)
- branch = self.factory.makeAnyBranch(private=True, owner=self.user)
+ branch = self.factory.makeAnyBranch(
+ owner=self.user, information_type=InformationType.USERDATA)
with person_logged_in(self.user):
bzr_identity = branch.bzr_identity
recipe_text = MINIMAL_RECIPE_TEXT % bzr_identity
=== modified file 'lib/lp/code/model/tests/test_branch.py'
--- lib/lp/code/model/tests/test_branch.py 2012-05-25 01:48:31 +0000
+++ lib/lp/code/model/tests/test_branch.py 2012-05-31 03:58:20 +0000
@@ -1125,7 +1125,8 @@
def test_private_linked_to_product(self):
# Private branches also have a short lp:url.
- branch = self.factory.makeProductBranch(private=True)
+ branch = self.factory.makeProductBranch(
+ information_type=InformationType.USERDATA)
with celebrity_logged_in('admin'):
product = branch.product
ICanHasLinkedBranch(product).setBranch(branch)
@@ -1881,7 +1882,8 @@
def test_private_branch(self):
"""landing_candidates works for private branches."""
- branch = self.factory.makeBranch(private=True)
+ branch = self.factory.makeBranch(
+ information_type=InformationType.USERDATA)
with person_logged_in(removeSecurityProxy(branch).owner):
mp = self.factory.makeBranchMergeProposal(target_branch=branch)
self.assertContentEqual([mp], branch.landing_candidates)
@@ -2162,7 +2164,8 @@
def test_private(self):
# The codebrowse URL for a private branch is a 'https' url.
owner = self.factory.makePerson()
- branch = self.factory.makeAnyBranch(private=True, owner=owner)
+ branch = self.factory.makeAnyBranch(
+ owner=owner, information_type=InformationType.USERDATA)
login_person(owner)
self.assertEqual(
'https://bazaar.launchpad.dev/' + branch.unique_name,
@@ -2334,9 +2337,9 @@
def test_public_stacked_on_private_is_private(self):
# A public branch stacked on a private branch is private.
- stacked_on = self.factory.makeBranch(private=True)
- branch = self.factory.makeBranch(
- stacked_on=stacked_on, private=False)
+ stacked_on = self.factory.makeBranch(
+ information_type=InformationType.USERDATA)
+ branch = self.factory.makeBranch(stacked_on=stacked_on)
self.assertTrue(branch.private)
self.assertEqual(
stacked_on.information_type, branch.information_type)
@@ -2345,8 +2348,9 @@
def test_private_stacked_on_public_is_private(self):
# A private branch stacked on a public branch is private.
- stacked_on = self.factory.makeBranch(private=False)
- branch = self.factory.makeBranch(stacked_on=stacked_on, private=True)
+ stacked_on = self.factory.makeBranch()
+ branch = self.factory.makeBranch(
+ stacked_on=stacked_on, information_type=InformationType.USERDATA)
self.assertTrue(branch.private)
self.assertNotEqual(
stacked_on.information_type, branch.information_type)
@@ -2412,7 +2416,8 @@
def test_private_to_private(self):
# Setting a private branch to be private is a no-op.
- branch = self.factory.makeProductBranch(private=True)
+ branch = self.factory.makeProductBranch(
+ information_type=InformationType.USERDATA)
self.assertTrue(branch.private)
branch.setPrivate(True, branch.owner)
self.assertTrue(branch.private)
@@ -2422,7 +2427,8 @@
def test_private_to_public_allowed(self):
# If the namespace policy allows public branches, then changing from
# private to public is allowed.
- branch = self.factory.makeProductBranch(private=True)
+ branch = self.factory.makeProductBranch(
+ information_type=InformationType.USERDATA)
branch.setPrivate(False, branch.owner)
self.assertFalse(branch.private)
self.assertFalse(removeSecurityProxy(branch).transitively_private)
@@ -2432,7 +2438,8 @@
def test_private_to_public_not_allowed(self):
# If the namespace policy does not allow public branches, attempting
# to change the branch to be public raises BranchCannotBePublic.
- branch = self.factory.makeProductBranch(private=True)
+ branch = self.factory.makeProductBranch(
+ information_type=InformationType.USERDATA)
branch.product.setBranchVisibilityTeamPolicy(
None, BranchVisibilityRule.FORBIDDEN)
branch.product.setBranchVisibilityTeamPolicy(
@@ -2445,7 +2452,8 @@
def test_cannot_transition_with_private_stacked_on(self):
# If a public branch is stacked on a private branch, it can not
# change its information_type to public.
- stacked_on = self.factory.makeBranch(private=True)
+ stacked_on = self.factory.makeBranch(
+ information_type=InformationType.USERDATA)
branch = self.factory.makeBranch(stacked_on=stacked_on)
self.assertRaises(
BranchCannotChangeInformationType,
@@ -2456,7 +2464,8 @@
# If a private branch is stacked on a public branch, it can change
# its information_type.
stacked_on = self.factory.makeBranch()
- branch = self.factory.makeBranch(stacked_on=stacked_on, private=True)
+ branch = self.factory.makeBranch(
+ stacked_on=stacked_on, information_type=InformationType.USERDATA)
branch.transitionToInformationType(
InformationType.UNEMBARGOEDSECURITY, branch.owner)
self.assertEqual(
=== modified file 'lib/lp/code/model/tests/test_branchcollection.py'
--- lib/lp/code/model/tests/test_branchcollection.py 2012-05-15 08:16:09 +0000
+++ lib/lp/code/model/tests/test_branchcollection.py 2012-05-31 03:58:20 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for branch collections."""
@@ -159,7 +159,8 @@
for i in range(branch_number):
branches.append(
self.factory.makeStackedOnBranchChain(
- owner=person, private=True, depth=depth))
+ owner=person, depth=depth,
+ information_type=InformationType.USERDATA))
with person_logged_in(person):
all_branches = (
GenericBranchCollection.preloadVisibleStackedOnBranches(
@@ -173,8 +174,7 @@
branches = []
for i in range(branch_number):
branches.append(
- self.factory.makeStackedOnBranchChain(
- private=False, depth=depth))
+ self.factory.makeStackedOnBranchChain(depth=depth))
all_branches = (
GenericBranchCollection.preloadVisibleStackedOnBranches(branches))
self.assertEqual(len(all_branches), branch_number * depth)
@@ -188,7 +188,7 @@
for i in range(branch_number):
branches.append(
self.factory.makeStackedOnBranchChain(
- owner=person, private=False, depth=depth))
+ owner=person, depth=depth))
with person_logged_in(person):
all_branches = (
GenericBranchCollection.preloadVisibleStackedOnBranches(
@@ -222,7 +222,7 @@
# IBranchCollection.count() returns the number of branches that
# getBranches() yields, even when the visibleByUser filter is applied.
branch = self.factory.makeAnyBranch()
- self.factory.makeAnyBranch(private=True)
+ self.factory.makeAnyBranch(information_type=InformationType.USERDATA)
collection = self.all_branches.visibleByUser(branch.owner)
self.assertEqual(1, collection.getBranches().count())
self.assertEqual(1, len(list(collection.getBranches())))
@@ -588,13 +588,13 @@
# We make private branch by stacking a public branch on top of a
# private one.
self.private_stacked_on_branch = self.factory.makeAnyBranch(
- private=True)
+ information_type=InformationType.USERDATA)
self.public_stacked_on_branch = self.factory.makeAnyBranch(
stacked_on=self.private_stacked_on_branch)
self.private_branch1 = self.factory.makeAnyBranch(
stacked_on=self.public_stacked_on_branch, name='private1')
self.private_branch2 = self.factory.makeAnyBranch(
- private=True, name='private2')
+ name='private2', information_type=InformationType.USERDATA)
self.all_branches = getUtility(IAllBranches)
def test_all_branches(self):
@@ -685,7 +685,8 @@
# branch, even if it's private.
team_owner = self.factory.makePerson()
team = self.factory.makeTeam(team_owner)
- private_branch = self.factory.makeAnyBranch(private=True)
+ private_branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
# Subscribe the team.
removeSecurityProxy(private_branch).subscribe(
team, BranchSubscriptionNotificationLevel.NOEMAIL,
@@ -973,7 +974,8 @@
# Don't include proposals if the target branch is private for
# anonymous views.
reviewer = self.factory.makePerson()
- target_branch = self.factory.makeAnyBranch(private=True)
+ target_branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
proposal = self.factory.makeBranchMergeProposal(
target_branch=target_branch)
proposal.nominateReviewer(reviewer, reviewer)
@@ -987,7 +989,7 @@
reviewer = self.factory.makePerson()
product = self.factory.makeProduct()
source_branch = self.factory.makeProductBranch(
- product=product, private=True)
+ product=product, information_type=InformationType.USERDATA)
target_branch = self.factory.makeProductBranch(product=product)
proposal = self.factory.makeBranchMergeProposal(
source_branch=source_branch, target_branch=target_branch)
=== modified file 'lib/lp/code/model/tests/test_branchlookup.py'
--- lib/lp/code/model/tests/test_branchlookup.py 2012-05-25 01:48:31 +0000
+++ lib/lp/code/model/tests/test_branchlookup.py 2012-05-31 03:58:20 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for the IBranchLookup implementation."""
@@ -25,6 +25,7 @@
BRANCH_ID_ALIAS_PREFIX,
)
from lp.code.interfaces.linkedbranch import ICanHasLinkedBranch
+from lp.registry.enums import InformationType
from lp.registry.errors import (
NoSuchDistroSeries,
NoSuchSourcePackageName,
@@ -135,7 +136,8 @@
def test_branch_id_alias_private(self):
# Private branches are not found at all (this is for anonymous access)
owner = self.factory.makePerson()
- branch = self.factory.makeAnyBranch(owner=owner, private=True)
+ branch = self.factory.makeAnyBranch(
+ owner=owner, information_type=InformationType.USERDATA)
with person_logged_in(owner):
path = branch_id_alias(branch)
result = self.branch_set.getIdAndTrailingPath(path)
@@ -146,7 +148,7 @@
# (this is for anonymous access)
owner = self.factory.makePerson()
private_branch = self.factory.makeAnyBranch(
- owner=owner, private=True)
+ owner=owner, information_type=InformationType.USERDATA)
branch = self.factory.makeAnyBranch(
stacked_on=private_branch, owner=owner)
with person_logged_in(owner):
@@ -547,7 +549,8 @@
def test_private_branch(self):
# If the unique name refers to an invisible branch, getByLPPath raises
# NoSuchBranch, just as if the branch weren't there at all.
- branch = self.factory.makeAnyBranch(private=True)
+ branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
path = removeSecurityProxy(branch).unique_name
self.assertRaises(
NoSuchBranch, self.branch_lookup.getByLPPath, path)
@@ -555,7 +558,8 @@
def test_transitive_private_branch(self):
# If the unique name refers to an invisible branch, getByLPPath raises
# NoSuchBranch, just as if the branch weren't there at all.
- private_branch = self.factory.makeAnyBranch(private=True)
+ private_branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
branch = self.factory.makeAnyBranch(stacked_on=private_branch)
path = removeSecurityProxy(branch).unique_name
self.assertRaises(
@@ -642,7 +646,8 @@
# If the given path refers to an object with an invisible linked
# branch, then getByLPPath raises `NoLinkedBranch`, as if the branch
# weren't there at all.
- branch = self.factory.makeProductBranch(private=True)
+ branch = self.factory.makeProductBranch(
+ information_type=InformationType.USERDATA)
product = removeSecurityProxy(branch).product
removeSecurityProxy(product).development_focus.branch = branch
self.assertRaises(
@@ -652,7 +657,8 @@
# If the given path refers to an object with an invisible linked
# branch, then getByLPPath raises `NoLinkedBranch`, as if the branch
# weren't there at all.
- private_branch = self.factory.makeProductBranch(private=True)
+ private_branch = self.factory.makeProductBranch(
+ information_type=InformationType.USERDATA)
branch = self.factory.makeProductBranch(stacked_on=private_branch)
product = removeSecurityProxy(branch).product
removeSecurityProxy(product).development_focus.branch = branch
=== modified file 'lib/lp/code/model/tests/test_branchmergeproposal.py'
--- lib/lp/code/model/tests/test_branchmergeproposal.py 2012-05-24 02:16:59 +0000
+++ lib/lp/code/model/tests/test_branchmergeproposal.py 2012-05-31 03:58:20 +0000
@@ -1504,7 +1504,8 @@
product = self.factory.makeProduct()
# We make a source branch stacked on a private one.
base_branch = self.factory.makeBranch(
- owner=owner, private=True, product=product)
+ owner=owner, product=product,
+ information_type=InformationType.USERDATA)
source_branch = self.factory.makeBranch(
stacked_on=base_branch, product=product, owner=owner)
target_branch = self.factory.makeBranch(owner=owner, product=product)
=== modified file 'lib/lp/code/model/tests/test_branchmergequeuecollection.py'
--- lib/lp/code/model/tests/test_branchmergequeuecollection.py 2012-01-01 02:58:52 +0000
+++ lib/lp/code/model/tests/test_branchmergequeuecollection.py 2012-05-31 03:58:20 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for branch merge queue collections."""
@@ -18,6 +18,7 @@
from lp.code.model.branchmergequeuecollection import (
GenericBranchMergeQueueCollection,
)
+from lp.registry.enums import InformationType
from lp.services.database.lpstorm import IMasterStore
from lp.testing import TestCaseWithFactory
from lp.testing.layers import DatabaseFunctionalLayer
@@ -65,8 +66,8 @@
# will be the size of that subset. That is, 'count' respects any
# filters that are applied.
person = self.factory.makePerson()
- queue = self.factory.makeBranchMergeQueue(owner=person)
- queue2 = self.factory.makeAnyBranch()
+ self.factory.makeBranchMergeQueue(owner=person)
+ self.factory.makeAnyBranch()
collection = GenericBranchMergeQueueCollection(
self.store, [BranchMergeQueue.owner == person])
self.assertEqual(1, collection.count())
@@ -84,12 +85,14 @@
# IBranchMergeQueueCollection.count() returns the number of queues
# that getMergeQueues() yields, even when the visibleByUser filter is
# applied.
- branch = self.factory.makeAnyBranch(private=True)
+ branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
naked_branch = removeSecurityProxy(branch)
- queue = self.factory.makeBranchMergeQueue(branches=[naked_branch])
- branch2 = self.factory.makeAnyBranch(private=True)
+ self.factory.makeBranchMergeQueue(branches=[naked_branch])
+ branch2 = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
naked_branch2 = removeSecurityProxy(branch2)
- queue2 = self.factory.makeBranchMergeQueue(branches=[naked_branch2])
+ self.factory.makeBranchMergeQueue(branches=[naked_branch2])
collection = self.all_queues.visibleByUser(naked_branch.owner)
self.assertEqual(1, len(collection.getMergeQueues()))
self.assertEqual(1, collection.count())
@@ -98,7 +101,7 @@
# 'ownedBy' returns a new collection restricted to queues owned by
# the given person.
queue = self.factory.makeBranchMergeQueue()
- queue2 = self.factory.makeBranchMergeQueue()
+ self.factory.makeBranchMergeQueue()
collection = self.all_queues.ownedBy(queue.owner)
self.assertEqual([queue], collection.getMergeQueues())
@@ -113,13 +116,13 @@
self.queue_with_public_branch = self.factory.makeBranchMergeQueue(
branches=[removeSecurityProxy(public_branch)])
private_branch1 = self.factory.makeAnyBranch(
- private=True, name='private1')
+ name='private1', information_type=InformationType.USERDATA)
naked_private_branch1 = removeSecurityProxy(private_branch1)
self.private_branch1_owner = naked_private_branch1.owner
self.queue1_with_private_branch = self.factory.makeBranchMergeQueue(
branches=[naked_private_branch1])
private_branch2 = self.factory.makeAnyBranch(
- private=True, name='private2')
+ name='private2', information_type=InformationType.USERDATA)
self.queue2_with_private_branch = self.factory.makeBranchMergeQueue(
branches=[removeSecurityProxy(private_branch2)])
self.all_queues = getUtility(IAllBranchMergeQueues)
@@ -162,7 +165,8 @@
team_owner = self.factory.makePerson()
team = self.factory.makeTeam(team_owner)
private_branch = self.factory.makeAnyBranch(
- owner=team, private=True, name='team')
+ owner=team, name='team',
+ information_type=InformationType.USERDATA)
queue_with_private_branch = self.factory.makeBranchMergeQueue(
branches=[removeSecurityProxy(private_branch)])
queues = self.all_queues.visibleByUser(team_owner)
=== modified file 'lib/lp/code/model/tests/test_branchpuller.py'
--- lib/lp/code/model/tests/test_branchpuller.py 2012-04-06 17:28:25 +0000
+++ lib/lp/code/model/tests/test_branchpuller.py 2012-05-31 03:58:20 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for the branch puller model code."""
@@ -17,6 +17,7 @@
from lp.code.enums import BranchType
from lp.code.interfaces.branchpuller import IBranchPuller
+from lp.registry.enums import InformationType
from lp.services.database.constants import UTC_NOW
from lp.testing import (
login_person,
@@ -218,7 +219,8 @@
# If there is a private branch that needs mirroring,
# acquireBranchToPull returns that.
branch = self.factory.makeAnyBranch(
- branch_type=BranchType.MIRRORED, private=True)
+ branch_type=BranchType.MIRRORED,
+ information_type=InformationType.USERDATA)
removeSecurityProxy(branch).requestMirror()
self.assertBranchIsAcquired(branch)
=== modified file 'lib/lp/code/model/tests/test_branchset.py'
--- lib/lp/code/model/tests/test_branchset.py 2012-01-30 06:02:10 +0000
+++ lib/lp/code/model/tests/test_branchset.py 2012-05-31 03:58:20 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for BranchSet."""
@@ -10,6 +10,7 @@
from lp.code.interfaces.branch import IBranchSet
from lp.code.model.branch import BranchSet
+from lp.registry.enums import InformationType
from lp.testing import (
login_person,
logout,
@@ -74,7 +75,8 @@
person = self.factory.makePerson(name='fred')
owner = self.factory.makePerson()
visible_branch = self.factory.makeBranch()
- invisible_branch = self.factory.makeBranch(owner=owner, private=True)
+ invisible_branch = self.factory.makeBranch(
+ owner=owner, information_type=InformationType.USERDATA)
invisible_name = removeSecurityProxy(invisible_branch).unique_name
branches = [
visible_branch.unique_name,
@@ -96,7 +98,8 @@
person = self.factory.makePerson(name='fred')
owner = self.factory.makePerson()
visible_branch = self.factory.makeBranch()
- invisible_branch = self.factory.makeBranch(owner=owner, private=True)
+ invisible_branch = self.factory.makeBranch(
+ owner=owner, information_type=InformationType.USERDATA)
invisible_name = removeSecurityProxy(invisible_branch).unique_name
branches = [
visible_branch.unique_name,
=== modified file 'lib/lp/code/model/tests/test_branchtarget.py'
--- lib/lp/code/model/tests/test_branchtarget.py 2012-04-06 17:28:25 +0000
+++ lib/lp/code/model/tests/test_branchtarget.py 2012-05-31 03:58:20 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for branch contexts."""
@@ -19,6 +19,7 @@
PersonBranchTarget,
ProductBranchTarget,
)
+from lp.registry.enums import InformationType
from lp.registry.interfaces.pocket import PackagePublishingPocket
from lp.services.webapp import canonical_url
from lp.services.webapp.interfaces import IPrimaryContext
@@ -544,13 +545,15 @@
def test_invisible(self):
# `check_default_stacked_on` returns None for branches invisible to
# the current user.
- branch = self.factory.makeAnyBranch(private=True)
+ branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
self.assertIs(None, check_default_stacked_on(branch))
def test_invisible_been_mirrored(self):
# `check_default_stacked_on` returns None for branches invisible to
# the current user, even if those branches have already been mirrored.
- branch = self.factory.makeAnyBranch(private=True)
+ branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
naked_branch = removeSecurityProxy(branch)
naked_branch.branchChanged(
'', self.factory.getUniqueString(), None, None, None)
=== modified file 'lib/lp/code/model/tests/test_branchvisibility.py'
--- lib/lp/code/model/tests/test_branchvisibility.py 2012-05-24 02:16:59 +0000
+++ lib/lp/code/model/tests/test_branchvisibility.py 2012-05-31 03:58:20 +0000
@@ -26,6 +26,7 @@
CodeReviewNotificationLevel,
)
from lp.code.interfaces.branch import IBranchSet
+from lp.registry.enums import InformationType
from lp.registry.interfaces.role import IPersonRoles
from lp.security import AccessBranch
from lp.services.webapp.authorization import (
@@ -76,7 +77,8 @@
# The owners of a branch always have visibility of their own branches.
owner = self.factory.makePerson()
- branch = self.factory.makeBranch(owner=owner, private=True)
+ branch = self.factory.makeBranch(
+ owner=owner, information_type=InformationType.USERDATA)
naked_branch = removeSecurityProxy(branch)
clear_cache() # Clear authorization cache for check_permission.
@@ -89,7 +91,8 @@
def test_visible_to_administrator(self):
# Launchpad administrators often have a need to see private
# Launchpad things in order to fix up fubars by users.
- branch = self.factory.makeBranch(private=True)
+ branch = self.factory.makeBranch(
+ information_type=InformationType.USERDATA)
naked_branch = removeSecurityProxy(branch)
admin = getUtility(ILaunchpadCelebrities).admin.teamowner
access = AccessBranch(naked_branch)
@@ -98,7 +101,8 @@
def test_visible_to_subscribers(self):
# Branches that are not public are viewable by members of the
# visibility_team and to subscribers.
- branch = self.factory.makeBranch(private=True)
+ branch = self.factory.makeBranch(
+ information_type=InformationType.USERDATA)
naked_branch = removeSecurityProxy(branch)
person = self.factory.makePerson()
teamowner = self.factory.makePerson()
@@ -135,10 +139,16 @@
test_branches = []
for x in range(5):
# We want the first 3 public and the last 3 private.
- branch = self.factory.makeBranch(private=x > 2)
+ information_type = InformationType.PUBLIC
+ if x > 2:
+ information_type = InformationType.USERDATA
+ branch = self.factory.makeBranch(
+ information_type=information_type)
test_branches.append(branch)
test_branches.append(
- self.factory.makeBranch(private=True, owner=private_owner))
+ self.factory.makeBranch(
+ owner=private_owner,
+ information_type=InformationType.USERDATA))
# Anonymous users see just the public branches.
branch_info = [(branch, branch.private)
=== modified file 'lib/lp/code/model/tests/test_revision.py'
--- lib/lp/code/model/tests/test_revision.py 2012-02-28 04:24:19 +0000
+++ lib/lp/code/model/tests/test_revision.py 2012-05-31 03:58:20 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for Revisions."""
@@ -26,6 +26,7 @@
RevisionCache,
RevisionSet,
)
+from lp.registry.enums import InformationType
from lp.registry.model.karma import Karma
from lp.scripts.garbo import RevisionAuthorEmailLinker
from lp.services.database.lpstorm import IMasterObject
@@ -847,7 +848,8 @@
def test_revisions_for_private_branch_marked_private(self):
# If the branch is private, then the revisions in the cache will be
# marked private too.
- branch = self.factory.makeAnyBranch(private=True)
+ branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
revision = self.factory.makeRevision()
branch.createBranchRevision(1, revision)
RevisionSet.updateRevisionCacheForBranch(branch)
@@ -858,7 +860,8 @@
def test_revisions_for_transitive_private_branch_marked_private(self):
# If the branch is stacked on a private branch, then the revisions in
# the cache will be marked private too.
- private_branch = self.factory.makeAnyBranch(private=True)
+ private_branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
branch = self.factory.makeAnyBranch(stacked_on=private_branch)
revision = self.factory.makeRevision()
branch.createBranchRevision(1, revision)
@@ -929,8 +932,9 @@
def test_existing_private_revisions_with_public_branch(self):
# If a revision is in both public and private branches, there is a
# revision cache row for both public and private.
- private_branch = self.factory.makeAnyBranch(private=True)
- public_branch = self.factory.makeAnyBranch(private=False)
+ private_branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
+ public_branch = self.factory.makeAnyBranch()
revision = self.factory.makeRevision()
private_branch.createBranchRevision(1, revision)
RevisionSet.updateRevisionCacheForBranch(private_branch)
@@ -947,10 +951,11 @@
# If a revision is in both public and private branches, there is a
# revision cache row for both public and private. A branch is private
# if it is stacked on a private branch.
- stacked_on_branch = self.factory.makeAnyBranch(private=True)
+ stacked_on_branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
private_branch = self.factory.makeAnyBranch(
stacked_on=stacked_on_branch)
- public_branch = self.factory.makeAnyBranch(private=False)
+ public_branch = self.factory.makeAnyBranch()
revision = self.factory.makeRevision()
private_branch.createBranchRevision(1, revision)
RevisionSet.updateRevisionCacheForBranch(private_branch)
=== modified file 'lib/lp/code/model/tests/test_sourcepackagerecipe.py'
--- lib/lp/code/model/tests/test_sourcepackagerecipe.py 2012-05-24 02:16:59 +0000
+++ lib/lp/code/model/tests/test_sourcepackagerecipe.py 2012-05-31 03:58:20 +0000
@@ -141,7 +141,8 @@
"""An exception should be raised if the base branch is private."""
owner = self.factory.makePerson()
with person_logged_in(owner):
- branch = self.factory.makeAnyBranch(private=True, owner=owner)
+ branch = self.factory.makeAnyBranch(
+ owner=owner, information_type=InformationType.USERDATA)
components = self.makeRecipeComponents(branches=[branch])
recipe_source = getUtility(ISourcePackageRecipeSource)
e = self.assertRaises(
@@ -156,7 +157,7 @@
with person_logged_in(owner):
base_branch = self.factory.makeAnyBranch(owner=owner)
referenced_branch = self.factory.makeAnyBranch(
- private=True, owner=owner)
+ owner=owner, information_type=InformationType.USERDATA)
branches = [base_branch, referenced_branch]
components = self.makeRecipeComponents(branches=branches)
recipe_source = getUtility(ISourcePackageRecipeSource)
@@ -698,7 +699,8 @@
source_package_recipe = self.factory.makeSourcePackageRecipe()
with person_logged_in(source_package_recipe.owner):
branch = self.factory.makeAnyBranch(
- private=True, owner=source_package_recipe.owner)
+ owner=source_package_recipe.owner,
+ information_type=InformationType.USERDATA)
recipe_text = self.factory.makeRecipeText(branch)
e = self.assertRaises(
PrivateBranchRecipe, source_package_recipe.setRecipeText,
@@ -713,7 +715,8 @@
base_branch = self.factory.makeAnyBranch(
owner=source_package_recipe.owner)
referenced_branch = self.factory.makeAnyBranch(
- private=True, owner=source_package_recipe.owner)
+ owner=source_package_recipe.owner,
+ information_type=InformationType.USERDATA)
recipe_text = self.factory.makeRecipeText(
base_branch, referenced_branch)
e = self.assertRaises(
=== modified file 'lib/lp/code/stories/branches/xx-private-branch-listings.txt'
--- lib/lp/code/stories/branches/xx-private-branch-listings.txt 2011-12-30 06:14:56 +0000
+++ lib/lp/code/stories/branches/xx-private-branch-listings.txt 2012-05-31 03:58:20 +0000
@@ -25,16 +25,16 @@
>>> from zope.component import getUtility
>>> from lp.services.database.sqlbase import flush_database_updates
>>> from lp.code.enums import BranchType
+ >>> from lp.registry.enums import InformationType
>>> from lp.registry.interfaces.person import IPersonSet
>>> from lp.registry.interfaces.product import IProductSet
>>> login('no-priv@xxxxxxxxxxxxx')
>>> no_priv = getUtility(IPersonSet).getByName('no-priv')
>>> landscape = getUtility(IProductSet).getByName('landscape')
- >>> branch = factory.makePersonalBranch(
- ... branch_type=BranchType.HOSTED, name='testing-branch',
- ... owner=no_priv, title='A Private Branch', private=True)
- >>> from zope.security.proxy import removeSecurityProxy
- >>> removeSecurityProxy(branch).product = landscape
+ >>> branch = factory.makeBranch(
+ ... product=landscape, branch_type=BranchType.HOSTED,
+ ... name='testing-branch', owner=no_priv,
+ ... information_type=InformationType.USERDATA)
>>> flush_database_updates()
>>> logout()
=== modified file 'lib/lp/code/tests/helpers.py'
--- lib/lp/code/tests/helpers.py 2012-01-15 13:32:27 +0000
+++ lib/lp/code/tests/helpers.py 2012-05-31 03:58:20 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Helper functions for code testing live here."""
@@ -38,6 +38,7 @@
from lp.code.model.seriessourcepackagebranch import (
SeriesSourcePackageBranchSet,
)
+from lp.registry.enums import InformationType
from lp.registry.interfaces.pocket import PackagePublishingPocket
from lp.registry.interfaces.series import SeriesStatus
from lp.services.database.sqlbase import cursor
@@ -266,7 +267,12 @@
"""Make a new branch with revisions."""
if revision_count is None:
revision_count = 5
- branch = factory.makeProductBranch(product=product, private=private)
+ if private:
+ information_type = InformationType.USERDATA
+ else:
+ information_type = InformationType.PUBLIC
+ branch = factory.makeProductBranch(
+ product=product, information_type=information_type)
naked_branch = removeSecurityProxy(branch)
factory.makeRevisionsForBranch(
naked_branch, count=revision_count, date_generator=date_generator)
=== modified file 'lib/lp/code/tests/test_branch.py'
--- lib/lp/code/tests/test_branch.py 2012-01-01 02:58:52 +0000
+++ lib/lp/code/tests/test_branch.py 2012-05-31 03:58:20 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Unit tests for methods of Branch and BranchSet."""
@@ -14,6 +14,7 @@
)
from lp.code.interfaces.codehosting import SUPPORTED_SCHEMES
from lp.code.tests.helpers import make_official_package_branch
+from lp.registry.enums import InformationType
from lp.services.webapp.authorization import check_permission
from lp.soyuz.interfaces.archivepermission import IArchivePermissionSet
from lp.testing import (
@@ -106,13 +107,15 @@
def test_privateBranchUnauthenticated(self):
# Private branches cannot be accessed without authentication.
- branch = self.factory.makeAnyBranch(private=True)
+ branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
self.assertUnauthenticatedView(branch, False)
def test_privateBranchOwner(self):
# The owner of a branch can always access it.
owner = self.factory.makePerson()
- branch = self.factory.makeAnyBranch(private=True, owner=owner)
+ branch = self.factory.makeAnyBranch(
+ owner=owner, information_type=InformationType.USERDATA)
self.assertAuthenticatedView(branch, owner, True)
def test_privateBranchOwnerMember(self):
@@ -121,18 +124,21 @@
team = self.factory.makeTeam(team_owner)
person = self.factory.makePerson()
removeSecurityProxy(team).addMember(person, team_owner)
- branch = self.factory.makeAnyBranch(private=True, owner=team)
+ branch = self.factory.makeAnyBranch(
+ owner=team, information_type=InformationType.USERDATA)
self.assertAuthenticatedView(branch, person, True)
def test_privateBranchAdmins(self):
# Launchpad admins can access any branch.
celebs = getUtility(ILaunchpadCelebrities)
- branch = self.factory.makeAnyBranch(private=True)
+ branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
self.assertAuthenticatedView(branch, celebs.admin.teamowner, True)
def test_privateBranchSubscriber(self):
# If you are subscribed to a branch, you can access it.
- branch = self.factory.makeAnyBranch(private=True)
+ branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
person = self.factory.makePerson()
removeSecurityProxy(branch).subscribe(
person, BranchSubscriptionNotificationLevel.NOEMAIL,
@@ -142,14 +148,16 @@
def test_privateBranchAnyoneElse(self):
# In general, you can't access a private branch.
- branch = self.factory.makeAnyBranch(private=True)
+ branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
person = self.factory.makePerson()
self.assertAuthenticatedView(branch, person, False)
def test_stackedOnPrivateBranchUnauthenticated(self):
# If a branch is stacked on a private branch, then you cannot access
# it when unauthenticated.
- stacked_on_branch = self.factory.makeAnyBranch(private=True)
+ stacked_on_branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
stacked_branch = self.factory.makeAnyBranch(
stacked_on=stacked_on_branch)
self.assertUnauthenticatedView(stacked_branch, False)
@@ -157,7 +165,8 @@
def test_stackedOnPrivateBranchAuthenticated(self):
# If a branch is stacked on a private branch, you can only access it
# if you can access both branches.
- stacked_on_branch = self.factory.makeAnyBranch(private=True)
+ stacked_on_branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
stacked_branch = self.factory.makeAnyBranch(
stacked_on=stacked_on_branch)
person = self.factory.makePerson()
@@ -166,7 +175,8 @@
def test_manyLevelsOfStackingUnauthenticated(self):
# If a branch is stacked on a branch stacked on a private branch, you
# still can't access it when unauthenticated.
- stacked_on_branch = self.factory.makeAnyBranch(private=True)
+ stacked_on_branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
branch_a = self.factory.makeAnyBranch(stacked_on=stacked_on_branch)
branch_b = self.factory.makeAnyBranch(stacked_on=branch_a)
self.assertUnauthenticatedView(branch_b, False)
@@ -174,7 +184,8 @@
def test_manyLevelsOfStackingAuthenticated(self):
# If a branch is stacked on a branch stacked on a private branch, you
# still can't access it when unauthenticated.
- stacked_on_branch = self.factory.makeAnyBranch(private=True)
+ stacked_on_branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
branch_a = self.factory.makeAnyBranch(stacked_on=stacked_on_branch)
branch_b = self.factory.makeAnyBranch(stacked_on=branch_a)
person = self.factory.makePerson()
@@ -195,7 +206,8 @@
# loop. e.g., branch A is stacked on branch B is stacked on branch A.
# If all of these branches are private, then only people who can
# access all of them can get to them.
- stacked_branch = self.factory.makeAnyBranch(private=True)
+ stacked_branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
removeSecurityProxy(stacked_branch).stacked_on = stacked_branch
person = self.factory.makePerson()
self.assertAuthenticatedView(stacked_branch, person, False)
@@ -368,7 +380,8 @@
def test_composePublicURL_http_private(self):
# Private branches don't have public http URLs.
- branch = self.factory.makeAnyBranch(private=True)
+ branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
self.assertRaises(AssertionError, branch.composePublicURL, 'http')
def test_composePublicURL_no_https(self):
=== modified file 'lib/lp/code/tests/test_branch_webservice.py'
--- lib/lp/code/tests/test_branch_webservice.py 2012-02-06 05:33:31 +0000
+++ lib/lp/code/tests/test_branch_webservice.py 2012-05-31 03:58:20 +0000
@@ -10,6 +10,7 @@
from lp.code.interfaces.branch import IBranchSet
from lp.code.interfaces.linkedbranch import ICanHasLinkedBranch
+from lp.registry.enums import InformationType
from lp.registry.interfaces.pocket import PackagePublishingPocket
from lp.testing import (
api_url,
@@ -55,7 +56,8 @@
owner = self.factory.makePerson()
visible_branch = self.factory.makeBranch()
visible_name = visible_branch.unique_name
- invisible_branch = self.factory.makeBranch(owner=owner, private=True)
+ invisible_branch = self.factory.makeBranch(
+ owner=owner, information_type=InformationType.USERDATA)
invisible_name = removeSecurityProxy(invisible_branch).unique_name
branches = [
visible_branch.unique_name,
=== modified file 'lib/lp/code/xmlrpc/tests/test_branch.py'
--- lib/lp/code/xmlrpc/tests/test_branch.py 2012-05-24 02:16:59 +0000
+++ lib/lp/code/xmlrpc/tests/test_branch.py 2012-05-31 03:58:20 +0000
@@ -303,7 +303,8 @@
# Invisible branches are resolved as if they didn't exist, so that we
# reveal the least possile amount of information about them.
# For fully specified branch names, this means resolving the lp url.
- branch = self.factory.makeAnyBranch(private=True)
+ branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
# Removing security proxy to get at the unique_name attribute of a
# private branch, and tests are currently running as an anonymous
# user.
@@ -316,7 +317,8 @@
# Removing security proxy because we need to be able to get at
# attributes of a private branch and these tests are running as an
# anonymous user.
- branch = self.factory.makeAnyBranch(private=True)
+ branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
series = self.factory.makeProductSeries(branch=branch)
lp_path = '%s/%s' % (series.product.name, series.name)
self.assertOnlyWritableResolves(lp_path)
@@ -339,7 +341,8 @@
# Create the owner explicitly so that we can get its email without
# resorting to removeSecurityProxy.
owner = self.factory.makePerson()
- branch = self.factory.makeAnyBranch(owner=owner, private=True)
+ branch = self.factory.makeAnyBranch(
+ owner=owner, information_type=InformationType.USERDATA)
path = removeSecurityProxy(branch).unique_name
self.assertOnlyWritableResolves(path)
=== modified file 'lib/lp/code/xmlrpc/tests/test_codehosting.py'
--- lib/lp/code/xmlrpc/tests/test_codehosting.py 2012-03-27 14:11:03 +0000
+++ lib/lp/code/xmlrpc/tests/test_codehosting.py 2012-05-31 03:58:20 +0000
@@ -43,6 +43,7 @@
run_with_login,
)
from lp.codehosting.inmemory import InMemoryFrontend
+from lp.registry.enums import InformationType
from lp.services.database.constants import UTC_NOW
from lp.services.scripts.interfaces.scriptactivity import IScriptActivitySet
from lp.services.webapp.interfaces import ILaunchBag
@@ -580,7 +581,8 @@
# requestMirror can be used to request the mirror of a private branch.
requester = self.factory.makePerson()
branch = self.factory.makeAnyBranch(
- owner=requester, private=True, branch_type=BranchType.MIRRORED)
+ owner=requester, branch_type=BranchType.MIRRORED,
+ information_type=InformationType.USERDATA)
branch = removeSecurityProxy(branch)
self.codehosting_api.requestMirror(requester.id, branch.id)
self.assertSqlAttributeEqualsDate(
@@ -690,7 +692,12 @@
:return: The new Product and the new Branch.
"""
product = self.factory.makeProduct()
- branch = self.factory.makeProductBranch(private=private)
+ if private:
+ information_type = InformationType.USERDATA
+ else:
+ information_type = InformationType.PUBLIC
+ branch = self.factory.makeProductBranch(
+ information_type=information_type)
self.factory.enableDefaultStackingForProduct(product, branch)
target = IBranchTarget(removeSecurityProxy(product))
self.assertEqual(target.default_stacked_on_branch, branch)
@@ -793,7 +800,8 @@
requester = self.factory.makePerson()
branch = removeSecurityProxy(
self.factory.makeAnyBranch(
- branch_type=BranchType.HOSTED, private=True, owner=requester))
+ branch_type=BranchType.HOSTED, owner=requester,
+ information_type=InformationType.USERDATA))
path = escape(u'/%s' % branch.unique_name)
translation = self.codehosting_api.translatePath(requester.id, path)
login(ANONYMOUS)
@@ -803,7 +811,8 @@
def test_translatePath_cant_see_private_branch(self):
requester = self.factory.makePerson()
- branch = removeSecurityProxy(self.factory.makeAnyBranch(private=True))
+ branch = removeSecurityProxy(self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA))
path = escape(u'/%s' % branch.unique_name)
self.assertPermissionDenied(requester, path)
@@ -814,7 +823,8 @@
self.assertNotFound(requester, path)
def test_translatePath_launchpad_services_private(self):
- branch = removeSecurityProxy(self.factory.makeAnyBranch(private=True))
+ branch = removeSecurityProxy(self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA))
path = escape(u'/%s' % branch.unique_name)
translation = self.codehosting_api.translatePath(
LAUNCHPAD_SERVICES, path)
@@ -824,7 +834,8 @@
translation)
def test_translatePath_anonymous_cant_see_private_branch(self):
- branch = removeSecurityProxy(self.factory.makeAnyBranch(private=True))
+ branch = removeSecurityProxy(self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA))
path = escape(u'/%s' % branch.unique_name)
self.assertPermissionDenied(LAUNCHPAD_ANONYMOUS, path)
@@ -1059,7 +1070,8 @@
requester = self.factory.makePerson()
branch = removeSecurityProxy(
self.factory.makeAnyBranch(
- branch_type=BranchType.HOSTED, private=True, owner=requester))
+ branch_type=BranchType.HOSTED, owner=requester,
+ information_type=InformationType.USERDATA))
path = escape(branch_id_alias(branch))
translation = self.codehosting_api.translatePath(requester.id, path)
self.assertEqual(
@@ -1071,7 +1083,8 @@
requester = self.factory.makePerson()
branch = removeSecurityProxy(
self.factory.makeAnyBranch(
- branch_type=BranchType.HOSTED, private=True))
+ branch_type=BranchType.HOSTED,
+ information_type=InformationType.USERDATA))
path = escape(branch_id_alias(branch))
self.assertPermissionDenied(requester, path)
@@ -1230,7 +1243,7 @@
# branch.
product = self.factory.makeProduct()
default_branch = self.factory.makeProductBranch(
- product=product, private=True)
+ product=product, information_type=InformationType.USERDATA)
self.factory.enableDefaultStackingForProduct(product, default_branch)
mirrored_branch = self.factory.makeProductBranch(
branch_type=BranchType.MIRRORED, product=product)
=== modified file 'lib/lp/codehosting/codeimport/tests/test_worker.py'
--- lib/lp/codehosting/codeimport/tests/test_worker.py 2012-02-27 23:59:14 +0000
+++ lib/lp/codehosting/codeimport/tests/test_worker.py 2012-05-31 03:58:20 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for the code import worker."""
@@ -87,6 +87,7 @@
SafeBranchOpener,
)
from lp.codehosting.tests.helpers import create_branch_with_one_revision
+from lp.registry.enums import InformationType
from lp.services.config import config
from lp.services.log.logger import BufferLogger
from lp.testing import (
@@ -1544,7 +1545,7 @@
arguments)
def test_bzr_stacked(self):
- devfocus = self.factory.makeAnyBranch(private=False)
+ devfocus = self.factory.makeAnyBranch()
code_import = self.factory.makeCodeImport(
bzr_branch_url='bzr://bzr.example.com/foo',
target=devfocus.target)
@@ -1559,7 +1560,8 @@
def test_bzr_stacked_private(self):
# Code imports can't be stacked on private branches.
- devfocus = self.factory.makeAnyBranch(private=True)
+ devfocus = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
code_import = self.factory.makeCodeImport(
target=devfocus.target,
bzr_branch_url='bzr://bzr.example.com/foo')
=== modified file 'lib/lp/codehosting/puller/tests/test_acceptance.py'
--- lib/lp/codehosting/puller/tests/test_acceptance.py 2012-01-01 02:58:52 +0000
+++ lib/lp/codehosting/puller/tests/test_acceptance.py 2012-05-31 03:58:20 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""End-to-end tests for the branch puller."""
@@ -32,6 +32,7 @@
from lp.codehosting.puller.tests import PullerBranchTestCase
from lp.codehosting.tests.helpers import LoomTestMixin
from lp.codehosting.vfs import get_lp_server
+from lp.registry.enums import InformationType
from lp.services.config import config
from lp.services.scripts.interfaces.scriptactivity import IScriptActivitySet
from lp.testing.layers import ZopelessAppServerLayer
@@ -221,8 +222,12 @@
"""
# Make the branch in the database.
product = self.factory.makeProduct()
+ if private:
+ information_type = InformationType.USERDATA
+ else:
+ information_type = InformationType.PUBLIC
default_branch = self.factory.makeProductBranch(
- product=product, private=private)
+ product=product, information_type=information_type)
transaction.commit()
# Create the underlying bzr branch.
lp_server = self.getLPServerForUser(default_branch.owner)
=== modified file 'lib/lp/codehosting/tests/test_rewrite.py'
--- lib/lp/codehosting/tests/test_rewrite.py 2012-01-01 02:58:52 +0000
+++ lib/lp/codehosting/tests/test_rewrite.py 2012-05-31 03:58:20 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for the dynamic RewriteMap used to serve branches over HTTP."""
@@ -16,6 +16,7 @@
from lp.code.interfaces.codehosting import branch_id_alias
from lp.codehosting.rewrite import BranchRewriter
from lp.codehosting.vfs import branch_id_to_path
+from lp.registry.enums import InformationType
from lp.services.config import config
from lp.services.log.logger import BufferLogger
from lp.testing import (
@@ -85,7 +86,8 @@
# rewritten to codebrowse, which will then redirect them to https and
# handle them there.
rewriter = self.makeRewriter()
- branch = self.factory.makeAnyBranch(private=True)
+ branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
unique_name = removeSecurityProxy(branch).unique_name
transaction.commit()
output = [
@@ -102,9 +104,9 @@
# branches are served from by ID if they are public.
rewriter = self.makeRewriter()
branches = [
- self.factory.makeProductBranch(private=False),
- self.factory.makePersonalBranch(private=False),
- self.factory.makePackageBranch(private=False)]
+ self.factory.makeProductBranch(),
+ self.factory.makePersonalBranch(),
+ self.factory.makePackageBranch()]
transaction.commit()
output = [
rewriter.rewriteLine(
@@ -120,7 +122,8 @@
# All requests for /+branch-id/$id/... for private branches return
# 'NULL'. This is translated by apache to a 404.
rewriter = self.makeRewriter()
- branch = self.factory.makeAnyBranch(private=True)
+ branch = self.factory.makeAnyBranch(
+ information_type=InformationType.USERDATA)
path = branch_id_alias(removeSecurityProxy(branch))
transaction.commit()
output = [
=== modified file 'lib/lp/registry/browser/tests/test_pillar_sharing.py'
--- lib/lp/registry/browser/tests/test_pillar_sharing.py 2012-05-30 04:59:36 +0000
+++ lib/lp/registry/browser/tests/test_pillar_sharing.py 2012-05-31 03:58:20 +0000
@@ -88,7 +88,8 @@
if with_branch and self.pillar_type == 'product':
branch = self.factory.makeBranch(
- product=self.pillar, owner=self.pillar.owner, private=True)
+ product=self.pillar, owner=self.pillar.owner,
+ information_type=InformationType.USERDATA)
artifacts.append(
self.factory.makeAccessArtifact(concrete=branch))
=== modified file 'lib/lp/registry/services/tests/test_sharingservice.py'
--- lib/lp/registry/services/tests/test_sharingservice.py 2012-05-30 20:45:41 +0000
+++ lib/lp/registry/services/tests/test_sharingservice.py 2012-05-31 03:58:20 +0000
@@ -685,7 +685,8 @@
product = self.factory.makeProduct(owner=owner)
login_person(owner)
branch = self.factory.makeBranch(
- product=product, owner=owner, private=True)
+ product=product, owner=owner,
+ information_type=InformationType.USERDATA)
self._assert_revokeAccessGrants(product, None, [branch])
def _assert_revokeAccessGrantsUnauthorized(self):
@@ -741,7 +742,8 @@
branches = []
for x in range(0, 10):
branch = self.factory.makeBranch(
- product=product, owner=owner, private=True)
+ product=product, owner=owner,
+ information_type=InformationType.USERDATA)
branches.append(branch)
# Grant access to grantee as well as the person who will be doing the
=== modified file 'lib/lp/registry/tests/test_distro_webservice.py'
--- lib/lp/registry/tests/test_distro_webservice.py 2012-01-01 02:58:52 +0000
+++ lib/lp/registry/tests/test_distro_webservice.py 2012-05-31 03:58:20 +0000
@@ -1,4 +1,4 @@
-# Copyright 2011 Canonical Ltd. This software is licensed under the
+# Copyright 2011-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
@@ -20,6 +20,7 @@
from lp.code.model.seriessourcepackagebranch import (
SeriesSourcePackageBranchSet,
)
+from lp.registry.enums import InformationType
from lp.registry.interfaces.pocket import PackagePublishingPocket
from lp.testing import (
api_url,
@@ -147,7 +148,8 @@
series = self.factory.makeDistroSeries(distro)
source_package = self.factory.makeSourcePackage(distroseries=series)
branch = self.factory.makeBranch(
- sourcepackage=source_package, private=True, **kwargs)
+ sourcepackage=source_package,
+ information_type=InformationType.USERDATA, **kwargs)
return branch, distro
def test_private_branch_hidden(self):
=== modified file 'lib/lp/registry/tests/test_private_team_visibility.py'
--- lib/lp/registry/tests/test_private_team_visibility.py 2012-05-02 05:25:11 +0000
+++ lib/lp/registry/tests/test_private_team_visibility.py 2012-05-31 03:58:20 +0000
@@ -177,8 +177,12 @@
the branch (and hence team) to be visible.
"""
login_person(self.priv_owner)
+ if private:
+ information_type = InformationType.USERDATA
+ else:
+ information_type = InformationType.PUBLIC
private_team_branch = self.factory.makeBranch(
- owner=self.priv_team, private=private)
+ owner=self.priv_team, information_type=information_type)
some_person = self.factory.makePerson()
# All users can see public branches, so in that case, the team is
# now visible, else team is still not visible.
@@ -202,8 +206,12 @@
the private team will be granted limited view permission on the team.
"""
branch_owner = self.factory.makePerson()
+ if private:
+ information_type = InformationType.USERDATA
+ else:
+ information_type = InformationType.PUBLIC
private_branch = self.factory.makeBranch(
- owner=branch_owner, private=private)
+ owner=branch_owner, information_type=information_type)
some_person = self.factory.makePerson()
# Initially no visibility.
self._check_permission(some_person, False)
@@ -236,8 +244,13 @@
# Make the merge proposal.
login_person(self.priv_owner)
product = self.factory.makeProduct()
+ if private:
+ information_type = InformationType.USERDATA
+ else:
+ information_type = InformationType.PUBLIC
target_branch = self.factory.makeBranch(
- owner=self.priv_owner, private=private, product=product)
+ owner=self.priv_owner, product=product,
+ information_type=information_type)
source_branch = self.factory.makeBranch(
owner=self.priv_owner, product=product)
self.factory.makeBranchMergeProposal(
=== modified file 'lib/lp/registry/tests/test_productjob.py'
--- lib/lp/registry/tests/test_productjob.py 2012-05-24 20:25:54 +0000
+++ lib/lp/registry/tests/test_productjob.py 2012-05-31 03:58:20 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for ProductJobs."""
@@ -19,31 +19,33 @@
from zope.security.proxy import removeSecurityProxy
from lp.app.interfaces.launchpad import ILaunchpadCelebrities
-from lp.registry.enums import ProductJobType
-from lp.registry.interfaces.product import (
- License,
+from lp.registry.enums import (
+ InformationType,
+ ProductJobType,
)
+from lp.registry.interfaces.person import TeamSubscriptionPolicy
+from lp.registry.interfaces.product import License
from lp.registry.interfaces.productjob import (
+ ICommercialExpiredJob,
+ ICommercialExpiredJobSource,
IProductJob,
IProductJobSource,
IProductNotificationJobSource,
- ICommercialExpiredJob,
- ICommercialExpiredJobSource,
ISevenDayCommercialExpirationJob,
ISevenDayCommercialExpirationJobSource,
IThirtyDayCommercialExpirationJob,
IThirtyDayCommercialExpirationJobSource,
)
-from lp.registry.interfaces.person import TeamSubscriptionPolicy
from lp.registry.interfaces.teammembership import TeamMembershipStatus
from lp.registry.model.productjob import (
+ CommercialExpiredJob,
ProductJob,
ProductJobDerived,
ProductNotificationJob,
- CommercialExpiredJob,
SevenDayCommercialExpirationJob,
ThirtyDayCommercialExpirationJob,
)
+from lp.services.webapp.publisher import canonical_url
from lp.testing import (
person_logged_in,
TestCaseWithFactory,
@@ -53,7 +55,6 @@
LaunchpadZopelessLayer,
)
from lp.testing.mail_helpers import pop_notifications
-from lp.services.webapp.publisher import canonical_url
class ProductJobTestCase(TestCaseWithFactory):
@@ -529,7 +530,8 @@
public_branch = self.factory.makeBranch(
owner=product.owner, product=product)
private_branch = self.factory.makeBranch(
- owner=product.owner, product=product, private=True)
+ owner=product.owner, product=product,
+ information_type=InformationType.USERDATA)
with person_logged_in(product.owner):
product.setPrivateBugs(True, product.owner)
public_series = product.development_focus
=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py 2012-05-30 14:17:37 +0000
+++ lib/lp/testing/factory.py 2012-05-31 03:58:20 +0000
@@ -1074,7 +1074,7 @@
def makeBranch(self, branch_type=None, owner=None,
name=None, product=_DEFAULT, url=_DEFAULT, registrant=None,
- private=None, information_type=None, stacked_on=None,
+ information_type=None, stacked_on=None,
sourcepackage=None, reviewer=None, **optional_branch_args):
"""Create and return a new, arbitrary Branch of the given type.
@@ -1121,12 +1121,6 @@
branch = namespace.createBranch(
branch_type=branch_type, name=name, registrant=registrant,
url=url, **optional_branch_args)
- assert information_type is None or private is None, (
- "Can not specify both information_type and private")
- if private is not None:
- information_type = (
- InformationType.USERDATA if private else
- InformationType.PUBLIC)
if information_type is not None:
removeSecurityProxy(branch).transitionToInformationType(
information_type, registrant, verify_policy=False)
=== modified file 'lib/lp/translations/browser/tests/test_productserieslanguage_views.py'
--- lib/lp/translations/browser/tests/test_productserieslanguage_views.py 2012-01-01 02:58:52 +0000
+++ lib/lp/translations/browser/tests/test_productserieslanguage_views.py 2012-05-31 03:58:20 +0000
@@ -1,10 +1,11 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
from zope.security.proxy import removeSecurityProxy
+from lp.registry.enums import InformationType
from lp.services.webapp.servers import LaunchpadTestRequest
from lp.testing import (
login_person,
@@ -206,7 +207,8 @@
def test_has_imports_enabled_private_branch_non_privileged(self):
# Private branches are hidden from non-privileged users. The view
# pretends that it is not used for imports.
- self.productseries.branch = self.factory.makeBranch(private=True)
+ self.productseries.branch = self.factory.makeBranch(
+ information_type=InformationType.USERDATA)
self.productseries.translations_autoimport_mode = (
TranslationsBranchImportMode.IMPORT_TRANSLATIONS)
view = self._createView()
@@ -214,7 +216,8 @@
def test_has_imports_enabled_private_branch_privileged(self):
# Private branches are visible for privileged users.
- self.productseries.branch = self.factory.makeBranch(private=True)
+ self.productseries.branch = self.factory.makeBranch(
+ information_type=InformationType.USERDATA)
self.productseries.translations_autoimport_mode = (
TranslationsBranchImportMode.IMPORT_TRANSLATIONS)
with person_logged_in(self.productseries.branch.owner):
@@ -230,14 +233,14 @@
# Private branches are hidden from non-privileged users. The view
# pretends that it is not used for exports.
self.productseries.translations_branch = self.factory.makeBranch(
- private=True)
+ information_type=InformationType.USERDATA)
view = self._createView()
self.assertFalse(view.has_exports_enabled)
def test_has_exports_enabled_private_branch_privileged(self):
# Private branches are visible for privileged users.
self.productseries.translations_branch = self.factory.makeBranch(
- private=True)
+ information_type=InformationType.USERDATA)
with person_logged_in(self.productseries.translations_branch.owner):
view = self._createView()
self.assertTrue(view.has_exports_enabled)
=== modified file 'lib/lp/translations/stories/productseries/xx-productseries-translations.txt'
--- lib/lp/translations/stories/productseries/xx-productseries-translations.txt 2012-01-15 13:32:27 +0000
+++ lib/lp/translations/stories/productseries/xx-productseries-translations.txt 2012-05-31 03:58:20 +0000
@@ -277,8 +277,10 @@
If the branch is private, though the page pretends to non-privileged users
that no synchronization has been set up.
+ >>> from lp.registry.enums import InformationType
>>> login('foo.bar@xxxxxxxxxxxxx')
- >>> private_branch = factory.makeBranch(product=frobnicator, private=True)
+ >>> private_branch = factory.makeBranch(
+ ... product=frobnicator, information_type=InformationType.USERDATA)
>>> frobnicator_trunk.translations_branch = private_branch
>>> logout()
Follow ups