~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/services/features/tests/test_webapp.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-09-29 05:18:32 UTC
  • mfrom: (14011.3.5 feature-flag-xmlrpc-2)
  • Revision ID: launchpad@pqm.canonical.com-20110929051832-1zqe0t36f6r22mhl
[r=lifeless][bug=853635] Add a private XML-RPC interface to query
        feature flags

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
    def test_pageid_scope_normal(self):
26
26
        request = LaunchpadTestRequest()
 
27
        scopes = webapp.ScopesFromRequest(request)
27
28
        request.setInWSGIEnvironment('launchpad.pageid', 'foo:bar')
28
 
        scopes = webapp.ScopesFromRequest(request)
29
29
        self.assertTrue(scopes.lookup('pageid:'))
30
30
        self.assertTrue(scopes.lookup('pageid:foo'))
31
31
        self.assertTrue(scopes.lookup('pageid:foo:bar'))
33
33
 
34
34
    def test_pageid_scope_collection(self):
35
35
        request = LaunchpadTestRequest()
 
36
        scopes = webapp.ScopesFromRequest(request)
36
37
        request.setInWSGIEnvironment('launchpad.pageid', 'scoped:thing:#type')
37
 
        scopes = webapp.ScopesFromRequest(request)
38
38
        self.assertTrue(scopes.lookup('pageid:'))
39
39
        self.assertTrue(scopes.lookup('pageid:scoped'))
40
40
        self.assertTrue(scopes.lookup('pageid:scoped:thing'))
43
43
 
44
44
    def test_pageid_scope_empty(self):
45
45
        request = LaunchpadTestRequest()
 
46
        scopes = webapp.ScopesFromRequest(request)
46
47
        request.setInWSGIEnvironment('launchpad.pageid', '')
47
 
        scopes = webapp.ScopesFromRequest(request)
48
48
        self.assertTrue(scopes.lookup('pageid:'))
49
49
        self.assertFalse(scopes.lookup('pageid:foo'))
50
50
        self.assertFalse(scopes.lookup('pageid:foo:bar'))
87
87
    def test_team_scope_outside_team(self):
88
88
        request = LaunchpadTestRequest()
89
89
        scopes = webapp.ScopesFromRequest(request)
90
 
        self.factory.loginAsAnyone()
 
90
        self.factory.loginAsAnyone(request)
91
91
        self.assertFalse(scopes.lookup('team:nonexistent'))
92
92
 
93
93
    def test_team_scope_in_team(self):
95
95
        scopes = webapp.ScopesFromRequest(request)
96
96
        member = self.factory.makePerson()
97
97
        team = self.factory.makeTeam(members=[member])
98
 
        login_as(member)
 
98
        login_as(member, request)
99
99
        self.assertTrue(scopes.lookup('team:%s' % team.name))