Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add test for bootstrap policy

which was added in 7c00411
  • Loading branch information...
commit 31a556ff68afe232ea7994d57910c1c041dd08ce 1 parent 33d5e87
@reedobrien reedobrien authored
Showing with 18 additions and 0 deletions.
  1. +18 −0 lumin/tests/test_security.py
View
18 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)
Please sign in to comment.
Something went wrong with that request. Please try again.