[Zope3-checkins] CVS: Zope3/src/zope/app/security/tests -
test_securitydirectives.py:1.12.4.1 mapping.zcml:NONE
test_zopepolicy.py:NONE
Steve Alexander
steve at cat-box.net
Tue Jan 13 18:34:58 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/security/tests
In directory cvs.zope.org:/tmp/cvs-serv25567/src/zope/app/security/tests
Modified Files:
Tag: steveachrismcd-securitypolicy-branch
test_securitydirectives.py
Removed Files:
Tag: steveachrismcd-securitypolicy-branch
mapping.zcml test_zopepolicy.py
Log Message:
Initial move of things related to the security policy.
=== Zope3/src/zope/app/security/tests/test_securitydirectives.py 1.12 => 1.12.4.1 ===
--- Zope3/src/zope/app/security/tests/test_securitydirectives.py:1.12 Sun Dec 14 03:25:35 2003
+++ Zope3/src/zope/app/security/tests/test_securitydirectives.py Tue Jan 13 18:34:20 2004
@@ -34,12 +34,12 @@
from zope.app.security.registries.permissionregistry \
import permissionRegistry as pregistry
from zope.app.security.registries.roleregistry import roleRegistry as rregistry
-from zope.app.security.grants.rolepermission \
+from zope.products.securitypolicy.rolepermission \
import rolePermissionManager as role_perm_mgr
-from zope.app.security.grants.principalpermission \
+from zope.products.securitypolicy.principalpermission \
import principalPermissionManager as principal_perm_mgr
-from zope.app.security.grants.principalrole \
- import principalRoleManager as principal_role_mgr
+from zope.products.securitypolicy.principalrole \
+ import principalRoleManager as principal_role_mgr
class TestBase(CleanUp):
@@ -89,68 +89,10 @@
"perm_duplicate.zcml", zope.app.security.tests)
-class TestRoleDirective(TestBase, unittest.TestCase):
-
- def testRegister(self):
- context = xmlconfig.file("role.zcml", zope.app.security.tests)
-
- role = rregistry.getRole("zope.Everyperson")
- self.failUnless(role.getId().endswith('Everyperson'))
- self.assertEqual(role.getTitle(), 'Tout le monde')
- self.assertEqual(role.getDescription(),
- 'The common man, woman, person, or thing')
-
- def testDuplicationRegistration(self):
- self.assertRaises(ConfigurationConflictError, xmlconfig.file,
- "role_duplicate.zcml", zope.app.security.tests)
-
-
-class TestSecurityMapping(TestBase, unittest.TestCase):
-
- def setUp(self):
- TestBase.setUp(self)
- pregistry.definePermission("zope.Foo", '', '')
- rregistry.defineRole("zope.Bar", '', '')
- principalRegistry.definePrincipal("zope.Blah", '', '')
- self.context = xmlconfig.file("mapping.zcml", zope.app.security.tests)
-
- def test_PermRoleMap(self):
- roles = role_perm_mgr.getRolesForPermission("zope.Foo")
- perms = role_perm_mgr.getPermissionsForRole("zope.Bar")
-
- self.assertEqual(len(roles), 1)
- self.failUnless(("zope.Bar",Allow) in roles)
-
- self.assertEqual(len(perms), 1)
- self.failUnless(("zope.Foo",Allow) in perms)
-
- def test_PermPrincipalMap(self):
- principals = principal_perm_mgr.getPrincipalsForPermission("zope.Foo")
- perms = principal_perm_mgr.getPermissionsForPrincipal("zope.Blah")
-
- self.assertEqual(len(principals), 1)
- self.failUnless(("zope.Blah", Allow) in principals)
-
- self.assertEqual(len(perms), 1)
- self.failUnless(("zope.Foo", Allow) in perms)
-
- def test_RolePrincipalMap(self):
- principals = principal_role_mgr.getPrincipalsForRole("zope.Bar")
- roles = principal_role_mgr.getRolesForPrincipal("zope.Blah")
-
- self.assertEqual(len(principals), 1)
- self.failUnless(("zope.Blah", Allow) in principals)
-
- self.assertEqual(len(roles), 1)
- self.failUnless(("zope.Bar", Allow) in roles)
-
-
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(TestPrincipalDirective),
unittest.makeSuite(TestPermissionDirective),
- unittest.makeSuite(TestRoleDirective),
- unittest.makeSuite(TestSecurityMapping),
))
if __name__ == '__main__':
=== Removed File Zope3/src/zope/app/security/tests/mapping.zcml ===
=== Removed File Zope3/src/zope/app/security/tests/test_zopepolicy.py ===
More information about the Zope3-Checkins
mailing list