Esempio n. 1
0
 def test_team_scope_in_team(self):
     request = LaunchpadTestRequest()
     scopes = webapp.ScopesFromRequest(request)
     member = self.factory.makePerson()
     team = self.factory.makeTeam(members=[member])
     login_as(member, request)
     self.assertTrue(scopes.lookup('team:%s' % team.name))
Esempio n. 2
0
 def test_pageid_scope_empty(self):
     request = LaunchpadTestRequest()
     scopes = webapp.ScopesFromRequest(request)
     request.setInWSGIEnvironment('launchpad.pageid', '')
     self.assertTrue(scopes.lookup('pageid:'))
     self.assertFalse(scopes.lookup('pageid:foo'))
     self.assertFalse(scopes.lookup('pageid:foo:bar'))
Esempio n. 3
0
 def test_pageid_scope_collection(self):
     request = LaunchpadTestRequest()
     scopes = webapp.ScopesFromRequest(request)
     request.setInWSGIEnvironment('launchpad.pageid', 'scoped:thing:#type')
     self.assertTrue(scopes.lookup('pageid:'))
     self.assertTrue(scopes.lookup('pageid:scoped'))
     self.assertTrue(scopes.lookup('pageid:scoped:thing'))
     self.assertTrue(scopes.lookup('pageid:scoped:thing:#type'))
     self.assertFalse(scopes.lookup('pageid:scoped:thing:#type:other'))
Esempio n. 4
0
 def test_server(self):
     request = LaunchpadTestRequest()
     scopes = webapp.ScopesFromRequest(request)
     self.assertFalse(scopes.lookup('server.lpnet'))
     config.push(
         'ensure_lpnet',
         dedent("""\
         [launchpad]
         is_lpnet: True
         """))
     try:
         self.assertTrue(scopes.lookup('server.lpnet'))
     finally:
         config.pop('ensure_lpnet')
Esempio n. 5
0
 def test_team_scope_outside_team(self):
     request = LaunchpadTestRequest()
     scopes = webapp.ScopesFromRequest(request)
     self.factory.loginAsAnyone(request)
     self.assertFalse(scopes.lookup('team:nonexistent'))
Esempio n. 6
0
 def test_unknown_scope(self):
     # Asking about an unknown scope is not an error.
     request = LaunchpadTestRequest()
     scopes = webapp.ScopesFromRequest(request)
     scopes.lookup('not-a-real-scope')
Esempio n. 7
0
 def test_server_missing_key(self):
     request = LaunchpadTestRequest()
     scopes = webapp.ScopesFromRequest(request)
     # There is no such key in the config, so this returns False.
     self.assertFalse(scopes.lookup('server.pink'))
Esempio n. 8
0
 def test_default(self):
     request = LaunchpadTestRequest()
     scopes = webapp.ScopesFromRequest(request)
     self.assertTrue(scopes.lookup('default'))