[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security/tests - testPrincipalRoleManager.py:1.1.2.2 testRolePermissionManager.py:1.1.2.3 testRoleRegistry.py:1.1.2.3 testSecurityDirectives.py:1.1.2.4
Tres Seaver
tseaver@zope.com
Thu, 13 Dec 2001 17:47:43 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Security/tests
In directory cvs.zope.org:/tmp/cvs-serv26578/tests
Modified Files:
Tag: Zope-3x-branch
testPrincipalRoleManager.py testRolePermissionManager.py
testRoleRegistry.py testSecurityDirectives.py
Log Message:
- 'defineRole()' should take keyword arguments, including mandatory
'role' and 'title'.
=== Zope3/lib/python/Zope/App/Security/tests/testPrincipalRoleManager.py 1.1.2.1 => 1.1.2.2 ===
def testUnboundPrincipalRole(self):
- role = rregistry.defineRole('ARole')
+ role = rregistry.defineRole('ARole', 'A Role')
principal = self._make_principal()
self.assertEqual(manager.getPrincipalsForRole(role), [])
self.assertEqual(manager.getRolesForPrincipal(principal), [])
def testPrincipalRole(self):
- role = rregistry.defineRole('ARole')
+ role = rregistry.defineRole('ARole', 'A Role')
principal = self._make_principal()
manager.assignRoleToPrincipal(role, principal)
self.assertEqual(manager.getPrincipalsForRole(role),
@@ -45,8 +45,8 @@
[role])
def testManyRolesOnePrincipal(self):
- perm1 = rregistry.defineRole('Role One')
- perm2 = rregistry.defineRole('Role Two')
+ perm1 = rregistry.defineRole('Role One', 'Role #1')
+ perm2 = rregistry.defineRole('Role Two', 'Role #2')
prin1 = self._make_principal()
manager.assignRoleToPrincipal(perm1, prin1)
manager.assignRoleToPrincipal(perm2, prin1)
@@ -56,7 +56,7 @@
self.failUnless(perm2 in perms)
def testManyPrincipalsOneRole(self):
- perm1 = rregistry.defineRole('Role One')
+ perm1 = rregistry.defineRole('Role One', 'Role #1')
prin1 = self._make_principal()
prin2 = self._make_principal('Principal 2', 'Principal Two')
manager.assignRoleToPrincipal(perm1, prin1)
=== Zope3/lib/python/Zope/App/Security/tests/testRolePermissionManager.py 1.1.2.2 => 1.1.2.3 ===
def testUnboundRolePermission(self):
permission = pregistry.definePermission('APerm', 'aPerm title')
- role = rregistry.defineRole('ARole')
+ role = rregistry.defineRole('ARole', 'A Role')
self.assertEqual(manager.getRolesForPermission(permission), [])
self.assertEqual(manager.getPermissionsForRole(role), [])
def testRolePermission(self):
permission = pregistry.definePermission('APerm', 'aPerm title')
- role = rregistry.defineRole('ARole')
+ role = rregistry.defineRole('ARole', 'A Role')
manager.grantPermissionToRole(permission, role)
self.assertEqual(manager.getRolesForPermission(permission), [role])
self.assertEqual(manager.getPermissionsForRole(role), [permission])
@@ -39,7 +39,7 @@
def testManyPermissionsOneRole(self):
perm1 = pregistry.definePermission('Perm One', 'title')
perm2 = pregistry.definePermission('Perm Two', 'title')
- role1 = rregistry.defineRole('Role One')
+ role1 = rregistry.defineRole('Role One', 'Role #1')
manager.grantPermissionToRole(perm1, role1)
manager.grantPermissionToRole(perm2, role1)
perms = manager.getPermissionsForRole(role1)
@@ -49,8 +49,8 @@
def testManyRolesOnePermission(self):
perm1 = pregistry.definePermission('Perm One', 'title')
- role1 = rregistry.defineRole('Role One')
- role2 = rregistry.defineRole('Role Two')
+ role1 = rregistry.defineRole('Role One', 'Role #1')
+ role2 = rregistry.defineRole('Role Two', 'Role #2')
manager.grantPermissionToRole(perm1, role1)
manager.grantPermissionToRole(perm1, role2)
roles = manager.getRolesForPermission(perm1)
=== Zope3/lib/python/Zope/App/Security/tests/testRoleRegistry.py 1.1.2.2 => 1.1.2.3 ===
def testRoleIsAnIRole(self):
- registry.defineRole('Foo')
+ registry.defineRole('Foo', 'Foo role')
role = registry.getRole('Foo')
self.assertEqual(verify(IRole, role), 1)
def testDefineRole(self):
- role = registry.defineRole('Foo')
+ role = registry.defineRole('Foo', 'Foo role')
self.failUnless(verify(IRole, role))
self.failUnless(registry.definedRole('Foo'))
role = registry.getRole('Foo')
- self.assertEquals(role.getTitle(), 'Foo')
+ self.assertEquals(role.getTitle(), 'Foo role')
def testDefineRoleWithTitle(self):
eq = self.assertEqual
=== Zope3/lib/python/Zope/App/Security/tests/testSecurityDirectives.py 1.1.2.3 => 1.1.2.4 ===
f = configfile("""
<security:defineRole
- name="Everyperson"
+ role="Everyperson"
title="Tout le monde"
description="The common man, woman, person, or thing" />
""")
@@ -136,12 +136,12 @@
def testDuplicationRegistration(self):
f = configfile("""
<security:defineRole
- name="Everyperson"
+ role="Everyperson"
title="Tout le monde"
description="The common man, woman, person, or thing" />
<security:defineRole
- name="Everyperson"
+ role="Everyperson"
title="Tout le monde"
description="The common man, woman, person, or thing" />
""")