Permalink
Browse files

add test for bootstrap policy

which was added in 7c00411
  • Loading branch information...
Reed O'Brien
Reed O'Brien committed Dec 7, 2012
1 parent 33d5e87 commit 31a556ff68afe232ea7994d57910c1c041dd08ce
Showing with 18 additions and 0 deletions.
  1. +18 −0 lumin/tests/test_security.py
@@ -68,3 +68,21 @@ def test_user_exists_with_role(self):
self.assertEqual(result, set(['agroup', 'brole']))
+class TestBootstrapAuthenticationPolicy(unittest.TestCase):
+ def _make_one(self, *principals, **kwargs):
+ from pyramid.authentication import AuthTktAuthenticationPolicy
+ from lumin.security import BootstrapAuthenticationPolicy
+ authpolicy = AuthTktAuthenticationPolicy('asecret', **kwargs)
+ return BootstrapAuthenticationPolicy(authpolicy, *principals)
+
+ def test_it(self):
+ request = pyramid.testing.DummyRequest()
+ inst = self._make_one("one", "two")
+ self.assertEquals(inst.effective_principals(request),
+ ["system.Everyone", "one", "two"])
+
+ def test_attr(self):
+ def dummy():
+ pass
+ inst = self._make_one("one", "two", callback=dummy)
+ self.assertEquals(inst.callback, dummy)

0 comments on commit 31a556f

Please sign in to comment.