summaryrefslogtreecommitdiff
path: root/tests/test_config
diff options
context:
space:
mode:
authorTheron Luhn <theron@luhn.com>2019-02-17 12:44:02 -0800
committerTheron Luhn <theron@luhn.com>2019-02-17 13:04:53 -0800
commita6234e4e19efab838b202d0935de0de92c2ee00f (patch)
tree845e7783fc091c139c75191e97daeea234567c4e /tests/test_config
parente47e7f457a6143dda28f9dd1674c53b1ece67f9d (diff)
downloadpyramid-a6234e4e19efab838b202d0935de0de92c2ee00f.tar.gz
pyramid-a6234e4e19efab838b202d0935de0de92c2ee00f.tar.bz2
pyramid-a6234e4e19efab838b202d0935de0de92c2ee00f.zip
Implement setting ISecurityPolicy in the configurator.
Diffstat (limited to 'tests/test_config')
-rw-r--r--tests/test_config/test_init.py9
-rw-r--r--tests/test_config/test_security.py9
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_config/test_init.py b/tests/test_config/test_init.py
index ce2b042ec..661654ef0 100644
--- a/tests/test_config/test_init.py
+++ b/tests/test_config/test_init.py
@@ -205,6 +205,15 @@ class ConfiguratorTests(unittest.TestCase):
result = config.registry.getUtility(IDebugLogger)
self.assertEqual(logger, result)
+ def test_ctor_security_policy(self):
+ from pyramid.interfaces import ISecurityPolicy
+
+ policy = object()
+ config = self._makeOne(security_policy=policy)
+ config.commit()
+ result = config.registry.getUtility(ISecurityPolicy)
+ self.assertEqual(policy, result)
+
def test_ctor_authentication_policy(self):
from pyramid.interfaces import IAuthenticationPolicy
diff --git a/tests/test_config/test_security.py b/tests/test_config/test_security.py
index 5ebd78f8d..3062ea154 100644
--- a/tests/test_config/test_security.py
+++ b/tests/test_config/test_security.py
@@ -11,6 +11,15 @@ class ConfiguratorSecurityMethodsTests(unittest.TestCase):
config = Configurator(*arg, **kw)
return config
+ def test_set_security_policy(self):
+ from pyramid.interfaces import ISecurityPolicy
+
+ config = self._makeOne()
+ policy = object()
+ config.set_security_policy(policy)
+ config.commit()
+ self.assertEqual(config.registry.getUtility(ISecurityPolicy), policy)
+
def test_set_authentication_policy_no_authz_policy(self):
config = self._makeOne()
policy = object()