Merge lp:~adeuring/launchpad/bug-1071589 into lp:launchpad

Proposed by Abel Deuring on 2012-12-03
Status: Merged
Approved by: Abel Deuring on 2012-12-03
Approved revision: no longer in the source branch.
Merged at revision: 16336
Proposed branch: lp:~adeuring/launchpad/bug-1071589
Merge into: lp:launchpad
Diff against target: 82 lines (+42/-4)
2 files modified
lib/lp/registry/browser/tests/test_pillar_sharing.py (+32/-1)
lib/lp/registry/templates/pillar-sharing.pt (+10/-3)
To merge this branch: bzr merge lp:~adeuring/launchpad/bug-1071589
Reviewer Review Type Date Requested Status
Benji York (community) code 2012-12-03 Approve on 2012-12-03
Review via email: mp+137659@code.launchpad.net

Commit Message

correct message 'who it's shared with' on the +sharing page for private products

Description of the Change

This branch fixes bug 1071589: +sharing "Who it's shared with" section inaccurate on pure Proprietary projects

The fix is simple: The text shown below "Who it's shared with" is now different for private products.

Getting the "condition variable" info_type is a bit cumbersome because IDistribution and IProjectGroup do not define the attribute information_type, wo we must also check the piller type.

test: ./bin/test registry -vvt test_who_its_shared_with

no lint

To post a comment you must log in.
Benji York (benji) wrote :

Looks good.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/browser/tests/test_pillar_sharing.py'
2--- lib/lp/registry/browser/tests/test_pillar_sharing.py 2012-12-02 14:48:02 +0000
3+++ lib/lp/registry/browser/tests/test_pillar_sharing.py 2012-12-03 18:49:25 +0000
4@@ -161,7 +161,8 @@
5 pillarperson.pillar.name, pillarperson.person.name)
6 browser = self.getUserBrowser(user=self.owner, url=url)
7 self.assertIn(
8- 'There are no shared bugs, branches, or blueprints.', browser.contents)
9+ 'There are no shared bugs, branches, or blueprints.',
10+ browser.contents)
11
12 def test_init_works(self):
13 # The view works with a feature flag.
14@@ -334,6 +335,30 @@
15 ['Private Security', 'Private'],
16 cache.objects.get('invisible_information_types'))
17
18+ def run_sharing_message_test(self, pillar, owner, public):
19+ with person_logged_in(owner):
20+ public_pillar_sharing_info = (
21+ "Everyone can see %s's public information."
22+ % pillar.displayname)
23+ url = canonical_url(pillar, view_name='+sharing')
24+ browser = setupBrowserForUser(user=owner)
25+ browser.open(url)
26+ if public:
27+ self.assertTrue(public_pillar_sharing_info in browser.contents)
28+ self.assertFalse(
29+ "This project has no public information." in browser.contents)
30+ else:
31+ self.assertFalse(public_pillar_sharing_info in browser.contents)
32+ self.assertTrue(
33+ "This project has no public information." in browser.contents)
34+
35+ def test_who_its_shared_with__public_pillar(self):
36+ # For public projects and distributions, the sharing page
37+ # shows the message "Everyone can see project's public
38+ # information".
39+ self.run_sharing_message_test(
40+ self.pillar, self.pillar.owner, public=True)
41+
42
43 class TestProductSharingView(PillarSharingViewTestMixin,
44 SharingBaseTestCase):
45@@ -374,6 +399,12 @@
46 self.assertIsNotNone(commercial_text)
47 self.assertIsNone(non_commercial_text)
48
49+ def test_who_its_shared_with__proprietary_product(self):
50+ owner = self.factory.makePerson()
51+ product = self.factory.makeProduct(
52+ owner=owner, information_type=InformationType.PROPRIETARY)
53+ self.run_sharing_message_test(product, owner, public=False)
54+
55
56 class TestDistributionSharingView(PillarSharingViewTestMixin,
57 SharingBaseTestCase):
58
59=== modified file 'lib/lp/registry/templates/pillar-sharing.pt'
60--- lib/lp/registry/templates/pillar-sharing.pt 2012-11-21 19:38:47 +0000
61+++ lib/lp/registry/templates/pillar-sharing.pt 2012-12-03 18:49:25 +0000
62@@ -95,10 +95,17 @@
63
64 </table>
65 <h2>Who it's shared with</h2>
66- <div id="sharing-header">
67- <p tal:content="string:
68+ <div id="sharing-header"
69+ tal:define="info_type
70+ python: 'Public' if context.pillar_category != 'Project' else
71+ context.information_type.title">
72+ <p tal:condition="python: info_type == 'Public'"
73+ tal:content="string:
74 Everyone can see ${context/displayname}'s public information. You can
75- choose who can see the private bugs and branches.">
76+ choose who can see the private bugs, branches and blueprints.">
77+ </p>
78+ <p tal:condition="python: info_type != 'Public'"
79+ tal:content="string: This project has no public information.">
80 </p>
81 </div>
82 <ul class="horizontal">