From 791730715832038c1666683e37fef8bb67830045 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Sun, 12 Jan 2020 20:49:35 -0600 Subject: move doc references from pyramid.security to pyramid.authorization --- tests/test_authentication.py | 40 ++++++++++----------- tests/test_authorization.py | 84 ++++++++++++++++++++++---------------------- tests/test_predicates.py | 4 +-- 3 files changed, 64 insertions(+), 64 deletions(-) (limited to 'tests') diff --git a/tests/test_authentication.py b/tests/test_authentication.py index ec3aef4ef..5b67a30da 100644 --- a/tests/test_authentication.py +++ b/tests/test_authentication.py @@ -321,15 +321,15 @@ class TestRepozeWho1AuthenticationPolicy(unittest.TestCase): self.assertEqual(policy.authenticated_userid(request), None) def test_effective_principals_None(self): - from pyramid.security import Everyone + from pyramid.authorization import Everyone request = DummyRequest({}) policy = self._makeOne() self.assertEqual(policy.effective_principals(request), [Everyone]) def test_effective_principals_userid_only(self): - from pyramid.security import Everyone - from pyramid.security import Authenticated + from pyramid.authorization import Everyone + from pyramid.authorization import Authenticated request = DummyRequest( {'repoze.who.identity': {'repoze.who.userid': 'fred'}} @@ -341,8 +341,8 @@ class TestRepozeWho1AuthenticationPolicy(unittest.TestCase): ) def test_effective_principals_userid_and_groups(self): - from pyramid.security import Everyone - from pyramid.security import Authenticated + from pyramid.authorization import Everyone + from pyramid.authorization import Authenticated request = DummyRequest( { @@ -363,7 +363,7 @@ class TestRepozeWho1AuthenticationPolicy(unittest.TestCase): ) def test_effective_principals_userid_callback_returns_None(self): - from pyramid.security import Everyone + from pyramid.authorization import Everyone request = DummyRequest( { @@ -381,7 +381,7 @@ class TestRepozeWho1AuthenticationPolicy(unittest.TestCase): self.assertEqual(policy.effective_principals(request), [Everyone]) def test_effective_principals_repoze_who_userid_is_None(self): - from pyramid.security import Everyone + from pyramid.authorization import Everyone request = DummyRequest( {'repoze.who.identity': {'repoze.who.userid': None}} @@ -390,7 +390,7 @@ class TestRepozeWho1AuthenticationPolicy(unittest.TestCase): self.assertEqual(policy.effective_principals(request), [Everyone]) def test_effective_principals_repoze_who_userid_is_unclean_Everyone(self): - from pyramid.security import Everyone + from pyramid.authorization import Everyone request = DummyRequest( {'repoze.who.identity': {'repoze.who.userid': 'system.Everyone'}} @@ -401,7 +401,7 @@ class TestRepozeWho1AuthenticationPolicy(unittest.TestCase): def test_effective_principals_repoze_who_userid_is_unclean_Authenticated( self, ): - from pyramid.security import Everyone + from pyramid.authorization import Everyone request = DummyRequest( { @@ -498,15 +498,15 @@ class TestRemoteUserAuthenticationPolicy(unittest.TestCase): self.assertEqual(policy.authenticated_userid(request), 'fred') def test_effective_principals_None(self): - from pyramid.security import Everyone + from pyramid.authorization import Everyone request = DummyRequest({}) policy = self._makeOne() self.assertEqual(policy.effective_principals(request), [Everyone]) def test_effective_principals(self): - from pyramid.security import Everyone - from pyramid.security import Authenticated + from pyramid.authorization import Everyone + from pyramid.authorization import Authenticated request = DummyRequest({'REMOTE_USER': 'fred'}) policy = self._makeOne() @@ -601,14 +601,14 @@ class TestAuthTktAuthenticationPolicy(unittest.TestCase): self.assertEqual(policy.authenticated_userid(request), 'fred') def test_effective_principals_no_cookie_identity(self): - from pyramid.security import Everyone + from pyramid.authorization import Everyone request = DummyRequest({}) policy = self._makeOne(None, None) self.assertEqual(policy.effective_principals(request), [Everyone]) def test_effective_principals_callback_returns_None(self): - from pyramid.security import Everyone + from pyramid.authorization import Everyone request = DummyRequest({}) @@ -619,8 +619,8 @@ class TestAuthTktAuthenticationPolicy(unittest.TestCase): self.assertEqual(policy.effective_principals(request), [Everyone]) def test_effective_principals(self): - from pyramid.security import Everyone - from pyramid.security import Authenticated + from pyramid.authorization import Everyone + from pyramid.authorization import Authenticated request = DummyRequest({}) @@ -1640,14 +1640,14 @@ class TestSessionAuthenticationPolicy(unittest.TestCase): self.assertEqual(policy.authenticated_userid(request), 'fred') def test_effective_principals_no_identity(self): - from pyramid.security import Everyone + from pyramid.authorization import Everyone request = DummyRequest() policy = self._makeOne() self.assertEqual(policy.effective_principals(request), [Everyone]) def test_effective_principals_callback_returns_None(self): - from pyramid.security import Everyone + from pyramid.authorization import Everyone request = DummyRequest(session={'userid': 'fred'}) @@ -1658,8 +1658,8 @@ class TestSessionAuthenticationPolicy(unittest.TestCase): self.assertEqual(policy.effective_principals(request), [Everyone]) def test_effective_principals(self): - from pyramid.security import Everyone - from pyramid.security import Authenticated + from pyramid.authorization import Everyone + from pyramid.authorization import Authenticated request = DummyRequest(session={'userid': 'fred'}) diff --git a/tests/test_authorization.py b/tests/test_authorization.py index 399b3da60..aea651501 100644 --- a/tests/test_authorization.py +++ b/tests/test_authorization.py @@ -36,12 +36,12 @@ class TestACLAuthorizationPolicy(unittest.TestCase): self.assertEqual(policy.permits(context, [], 'view'), False) def test_permits(self): - from pyramid.security import Deny - from pyramid.security import Allow - from pyramid.security import Everyone - from pyramid.security import Authenticated - from pyramid.security import ALL_PERMISSIONS - from pyramid.security import DENY_ALL + from pyramid.authorization import Deny + from pyramid.authorization import Allow + from pyramid.authorization import Everyone + from pyramid.authorization import Authenticated + from pyramid.authorization import ALL_PERMISSIONS + from pyramid.authorization import DENY_ALL root = DummyContext() community = DummyContext(__name__='community', __parent__=root) @@ -132,7 +132,7 @@ class TestACLAuthorizationPolicy(unittest.TestCase): ) def test_permits_string_permissions_in_acl(self): - from pyramid.security import Allow + from pyramid.authorization import Allow root = DummyContext() root.__acl__ = [(Allow, 'wilma', 'view_stuff')] @@ -145,8 +145,8 @@ class TestACLAuthorizationPolicy(unittest.TestCase): self.assertEqual(result, False) def test_principals_allowed_by_permission_direct(self): - from pyramid.security import Allow - from pyramid.security import DENY_ALL + from pyramid.authorization import Allow + from pyramid.authorization import DENY_ALL context = DummyContext() acl = [ @@ -162,8 +162,8 @@ class TestACLAuthorizationPolicy(unittest.TestCase): self.assertEqual(result, ['chrism']) def test_principals_allowed_by_permission_callable_acl(self): - from pyramid.security import Allow - from pyramid.security import DENY_ALL + from pyramid.authorization import Allow + from pyramid.authorization import DENY_ALL context = DummyContext() acl = lambda: [ @@ -179,7 +179,7 @@ class TestACLAuthorizationPolicy(unittest.TestCase): self.assertEqual(result, ['chrism']) def test_principals_allowed_by_permission_string_permission(self): - from pyramid.security import Allow + from pyramid.authorization import Allow context = DummyContext() acl = [(Allow, 'chrism', 'read_it')] @@ -191,10 +191,10 @@ class TestACLAuthorizationPolicy(unittest.TestCase): self.assertEqual(list(result), []) def test_principals_allowed_by_permission(self): - from pyramid.security import Allow - from pyramid.security import Deny - from pyramid.security import DENY_ALL - from pyramid.security import ALL_PERMISSIONS + from pyramid.authorization import Allow + from pyramid.authorization import Deny + from pyramid.authorization import DENY_ALL + from pyramid.authorization import ALL_PERMISSIONS root = DummyContext(__name__='', __parent__=None) community = DummyContext(__name__='community', __parent__=root) @@ -236,8 +236,8 @@ class TestACLAuthorizationPolicy(unittest.TestCase): self.assertEqual(result, []) def test_principals_allowed_by_permission_deny_not_permission_in_acl(self): - from pyramid.security import Deny - from pyramid.security import Everyone + from pyramid.authorization import Deny + from pyramid.authorization import Everyone context = DummyContext() acl = [(Deny, Everyone, 'write')] @@ -249,8 +249,8 @@ class TestACLAuthorizationPolicy(unittest.TestCase): self.assertEqual(result, []) def test_principals_allowed_by_permission_deny_permission_in_acl(self): - from pyramid.security import Deny - from pyramid.security import Everyone + from pyramid.authorization import Deny + from pyramid.authorization import Everyone context = DummyContext() acl = [(Deny, Everyone, 'read')] @@ -262,7 +262,7 @@ class TestACLAuthorizationPolicy(unittest.TestCase): self.assertEqual(result, []) def test_callable_acl(self): - from pyramid.security import Allow + from pyramid.authorization import Allow context = DummyContext() fn = lambda self: [(Allow, 'bob', 'read')] @@ -290,12 +290,12 @@ class TestACLHelper(unittest.TestCase): def test_acl(self): from pyramid.authorization import ACLHelper - from pyramid.security import Deny - from pyramid.security import Allow - from pyramid.security import Everyone - from pyramid.security import Authenticated - from pyramid.security import ALL_PERMISSIONS - from pyramid.security import DENY_ALL + from pyramid.authorization import Deny + from pyramid.authorization import Allow + from pyramid.authorization import Everyone + from pyramid.authorization import Authenticated + from pyramid.authorization import ALL_PERMISSIONS + from pyramid.authorization import DENY_ALL helper = ACLHelper() root = DummyContext() @@ -386,7 +386,7 @@ class TestACLHelper(unittest.TestCase): def test_string_permissions_in_acl(self): from pyramid.authorization import ACLHelper - from pyramid.security import Allow + from pyramid.authorization import Allow helper = ACLHelper() root = DummyContext() @@ -399,7 +399,7 @@ class TestACLHelper(unittest.TestCase): def test_callable_acl(self): from pyramid.authorization import ACLHelper - from pyramid.security import Allow + from pyramid.authorization import Allow helper = ACLHelper() context = DummyContext() @@ -410,8 +410,8 @@ class TestACLHelper(unittest.TestCase): def test_principals_allowed_by_permission_direct(self): from pyramid.authorization import ACLHelper - from pyramid.security import Allow - from pyramid.security import DENY_ALL + from pyramid.authorization import Allow + from pyramid.authorization import DENY_ALL helper = ACLHelper() context = DummyContext() @@ -428,8 +428,8 @@ class TestACLHelper(unittest.TestCase): def test_principals_allowed_by_permission_callable_acl(self): from pyramid.authorization import ACLHelper - from pyramid.security import Allow - from pyramid.security import DENY_ALL + from pyramid.authorization import Allow + from pyramid.authorization import DENY_ALL helper = ACLHelper() context = DummyContext() @@ -446,7 +446,7 @@ class TestACLHelper(unittest.TestCase): def test_principals_allowed_by_permission_string_permission(self): from pyramid.authorization import ACLHelper - from pyramid.security import Allow + from pyramid.authorization import Allow helper = ACLHelper() context = DummyContext() @@ -459,10 +459,10 @@ class TestACLHelper(unittest.TestCase): def test_principals_allowed_by_permission(self): from pyramid.authorization import ACLHelper - from pyramid.security import Allow - from pyramid.security import Deny - from pyramid.security import DENY_ALL - from pyramid.security import ALL_PERMISSIONS + from pyramid.authorization import Allow + from pyramid.authorization import Deny + from pyramid.authorization import DENY_ALL + from pyramid.authorization import ALL_PERMISSIONS helper = ACLHelper() root = DummyContext(__name__='', __parent__=None) @@ -506,8 +506,8 @@ class TestACLHelper(unittest.TestCase): def test_principals_allowed_by_permission_deny_not_permission_in_acl(self): from pyramid.authorization import ACLHelper - from pyramid.security import Deny - from pyramid.security import Everyone + from pyramid.authorization import Deny + from pyramid.authorization import Everyone helper = ACLHelper() context = DummyContext() @@ -520,8 +520,8 @@ class TestACLHelper(unittest.TestCase): def test_principals_allowed_by_permission_deny_permission_in_acl(self): from pyramid.authorization import ACLHelper - from pyramid.security import Deny - from pyramid.security import Everyone + from pyramid.authorization import Deny + from pyramid.authorization import Everyone helper = ACLHelper() context = DummyContext() diff --git a/tests/test_predicates.py b/tests/test_predicates.py index b0ee65bcf..533667d75 100644 --- a/tests/test_predicates.py +++ b/tests/test_predicates.py @@ -454,7 +454,7 @@ class Test_EffectivePrincipalsPredicate(unittest.TestCase): def _testing_authn_policy(self, userid, groupids=tuple()): from pyramid.interfaces import IAuthenticationPolicy, ISecurityPolicy - from pyramid.security import Everyone, Authenticated + from pyramid.authorization import Everyone, Authenticated from pyramid.security import LegacySecurityPolicy class DummyPolicy: @@ -500,7 +500,7 @@ class Test_EffectivePrincipalsPredicate(unittest.TestCase): self.assertTrue(inst(context, request)) def test_it_call_authentication_policy_provides_superset_implicit(self): - from pyramid.security import Authenticated + from pyramid.authorization import Authenticated request = testing.DummyRequest() self._testing_authn_policy('fred', groupids=('verna', 'bambi')) -- cgit v1.2.3