From 1431f7bdfa0b1325cbbb87b6cfaa2c6afc2f2dc0 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Tue, 24 Dec 2019 14:57:50 -0600 Subject: security policy docs and legacy policy improvements - Added `set_security_policy`` to more places in the docs. - Ensure that the authn/authz policies are not used at all if the legacy policy is not in effect to avoid edge cases where the code would skip the security policy and use the authn/authz policy on accident. - Change deprecation warnings in code to reference the docs by name instead of by URL. --- tests/test_predicates.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests/test_predicates.py') diff --git a/tests/test_predicates.py b/tests/test_predicates.py index 4029faf9d..c0a6c59ec 100644 --- a/tests/test_predicates.py +++ b/tests/test_predicates.py @@ -454,8 +454,9 @@ class Test_EffectivePrincipalsPredicate(unittest.TestCase): return EffectivePrincipalsPredicate(val, config) def _testing_authn_policy(self, userid, groupids=tuple()): - from pyramid.interfaces import IAuthenticationPolicy + from pyramid.interfaces import IAuthenticationPolicy, ISecurityPolicy from pyramid.security import Everyone, Authenticated + from pyramid.security import LegacySecurityPolicy class DummyPolicy: def effective_principals(self, request): @@ -468,6 +469,7 @@ class Test_EffectivePrincipalsPredicate(unittest.TestCase): registry = self.config.registry registry.registerUtility(DummyPolicy(), IAuthenticationPolicy) + registry.registerUtility(LegacySecurityPolicy(), ISecurityPolicy) def test_text(self): inst = self._makeOne(('verna', 'fred'), None) -- cgit v1.2.3