launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #11540
[Merge] lp:~stevenk/launchpad/branches-are-more-than-private into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/branches-are-more-than-private into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1045154 in Launchpad itself: "PillarPersonSharingView reports all branches as Private"
https://bugs.launchpad.net/launchpad/+bug/1045154
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/branches-are-more-than-private/+merge/122436
No longer override all branches to USERDATA in PillarPersonSharingView, and add a test for that case.
I have also done some other clean-up -- we no longer need to special case creating the bug, since makeBug now just takes a target argument. We also don't need to create APAs, so I've removed that too.
--
https://code.launchpad.net/~stevenk/launchpad/branches-are-more-than-private/+merge/122436
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/branches-are-more-than-private into lp:launchpad.
=== modified file 'lib/lp/registry/browser/pillar.py'
--- lib/lp/registry/browser/pillar.py 2012-08-24 05:09:51 +0000
+++ lib/lp/registry/browser/pillar.py 2012-09-03 03:19:19 +0000
@@ -46,10 +46,7 @@
from lp.bugs.browser.structuralsubscription import (
StructuralSubscriptionMenuMixin,
)
-from lp.registry.enums import (
- EXCLUSIVE_TEAM_POLICY,
- InformationType,
- )
+from lp.registry.enums import EXCLUSIVE_TEAM_POLICY
from lp.registry.interfaces.distributionsourcepackage import (
IDistributionSourcePackage,
)
@@ -423,15 +420,12 @@
def _build_branch_template_data(self, branches, request):
branch_data = []
for branch in branches:
- # At the moment, all branches displayed on the sharing details
- # page are private.
- information_type = InformationType.USERDATA.title
branch_data.append(dict(
self_link=absoluteURL(branch, request),
web_link=canonical_url(branch, path_only_if_possible=True),
branch_name=branch.unique_name,
branch_id=branch.id,
- information_type=information_type))
+ information_type=branch.information_type.title))
return branch_data
def _build_bug_template_data(self, bugtasks, request):
=== modified file 'lib/lp/registry/browser/tests/test_pillar_sharing.py'
--- lib/lp/registry/browser/tests/test_pillar_sharing.py 2012-08-24 05:09:51 +0000
+++ lib/lp/registry/browser/tests/test_pillar_sharing.py 2012-09-03 03:19:19 +0000
@@ -75,7 +75,8 @@
return grantee
def makeArtifactGrantee(self, grantee=None, with_bug=True,
- with_branch=False, security=False):
+ with_branch=False, security=False,
+ information_type=InformationType.USERDATA):
if grantee is None:
grantee = self.factory.makePerson()
@@ -86,7 +87,7 @@
if with_branch and self.pillar_type == 'product':
branch = self.factory.makeBranch(
product=self.pillar, owner=self.pillar.owner,
- information_type=InformationType.USERDATA)
+ information_type=information_type)
artifacts.append(
self.factory.makeAccessArtifact(concrete=branch))
@@ -95,24 +96,15 @@
owner = self.factory.makePerson()
else:
owner = self.pillar.owner
- if self.pillar_type == 'product':
- bug = self.factory.makeBug(
- target=self.pillar, owner=owner,
- information_type=InformationType.USERDATA)
- elif self.pillar_type == 'distribution':
- bug = self.factory.makeBug(
- target=self.pillar, owner=owner,
- information_type=InformationType.USERDATA)
+ bug = self.factory.makeBug(
+ target=self.pillar, owner=owner,
+ information_type=information_type)
artifacts.append(
self.factory.makeAccessArtifact(concrete=bug))
for artifact in artifacts:
- self.factory.makeAccessPolicyArtifact(
- artifact=artifact, policy=self.access_policy)
self.factory.makeAccessArtifactGrant(
- artifact=artifact,
- grantee=grantee,
- grantor=self.pillar.owner)
+ artifact=artifact, grantee=grantee, grantor=self.pillar.owner)
return grantee
def setupSharing(self, grantees):
@@ -212,6 +204,19 @@
'self_link': absoluteURL(branch, request),
}, cache.objects.get('branches')[0])
+ def test_view_data_model_proprietary_branch(self):
+ # Test that branches show as the correct information type.
+ if self.pillar_type != 'product':
+ return
+ person = self.makeArtifactGrantee(
+ with_bug=False, with_branch=True,
+ information_type=InformationType.PROPRIETARY)
+ pillarperson = PillarPerson(self.pillar, person)
+ view = create_initialized_view(pillarperson, '+index')
+ cache = IJSONRequestCache(view.request)
+ information_type = cache.objects.get('branches')[0]['information_type']
+ self.assertEqual(InformationType.PROPRIETARY.title, information_type)
+
def test_view_query_count(self):
# Test that the view bulk loads artifacts.
person = self.factory.makePerson()
Follow ups