~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/browser/tests/test_team.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-12-19 20:39:48 UTC
  • mfrom: (14515.2.29 limited-view-pages-0)
  • Revision ID: launchpad@pqm.canonical.com-20111219203948-bgiz214cd8ox1dej
[r=wallyworld][bug=904283] Users can see pages when they have
        limitedview.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
from zope.component import getUtility
7
7
from zope.security.proxy import removeSecurityProxy
8
8
 
 
9
from canonical.launchpad.testing.pages import (
 
10
    extract_text,
 
11
    find_tag_by_id,
 
12
    )
9
13
from canonical.launchpad.webapp.publisher import canonical_url
10
14
from canonical.testing.layers import DatabaseFunctionalLayer
11
15
from lp.registry.browser.team import TeamOverviewMenu
 
16
from lp.registry.interfaces.person import PersonVisibility
12
17
from lp.registry.interfaces.persontransferjob import IPersonMergeJobSource
13
18
from lp.registry.interfaces.teammembership import (
14
19
    ITeamMembershipSet,
183
188
            'in a few minutes.')
184
189
        self.assertEqual(1, len(notifications))
185
190
        self.assertEqual(message, notifications[0].message)
 
191
 
 
192
    def test_user_without_launchpad_view(self):
 
193
        # When the user does not have launchpad.View on the context,
 
194
        user = self.factory.makePerson()
 
195
        owner = self.factory.makePerson()
 
196
        with person_logged_in(owner):
 
197
            team = self.factory.makeTeam(
 
198
                displayname='Waffles', owner=owner,
 
199
                visibility=PersonVisibility.PRIVATE)
 
200
            archive = self.factory.makeArchive(private=True, owner=team)
 
201
            archive.newSubscription(user, registrant=owner)
 
202
        with person_logged_in(user):
 
203
            view = create_initialized_view(
 
204
                team, name="+index",  server_url=canonical_url(team),
 
205
                path_info='', principal=user)
 
206
            document = find_tag_by_id(view(), 'document')
 
207
        self.assertIsNone(document.find(True, id='side-portlets'))
 
208
        self.assertIsNone(document.find(True, id='registration'))
 
209
        self.assertEndsWith(
 
210
            extract_text(document.find(True, id='maincontent')),
 
211
            'The information in this page is not shared with you.')