[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security/tests - testPrincipalPermissionManager.py:1.1.2.10.2.1
Jim Fulton
jim@zope.com
Mon, 11 Feb 2002 10:24:29 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Security/tests
In directory cvs.zope.org:/tmp/cvs-serv19744
Modified Files:
Tag: Zope-3x-security_defactor-branch
testPrincipalPermissionManager.py
Log Message:
Changed tests (back) to use ids, rather than objects in security
assertions.
I'm in the process of changing all the security tests to use ids in
security assertions. The plan is to change and check in all the tests
and then to work together on making them pass again. When this is
done, we'll merge the changes back into the 3x branch.
Note that there might be bugs in the tests since we are intentionally
checking in failing tests (in this branch off the 3x branch).
=== Zope3/lib/python/Zope/App/Security/tests/testPrincipalPermissionManager.py 1.1.2.10 => 1.1.2.10.2.1 ===
def _make_principal(self, id=None, title=None):
- prinregistry.definePrincipal(
+ p = prinregistry.definePrincipal(
id or 'APrincipal',
title or 'A Principal',
login = id or 'APrincipal')
- return id or 'APrincipal'
+ return p.getId()
def testUnboundPrincipalPermission(self):
- permission = permregistry.definePermission('APerm', 'title')
+ permission = permregistry.definePermission('APerm', 'title').getId()
principal = self._make_principal()
self.assertEqual(manager.getPrincipalsForPermission(permission), [])
self.assertEqual(manager.getPermissionsForPrincipal(principal), [])
def testPrincipalPermission(self):
- permission = permregistry.definePermission('APerm', 'title')
+ permission = permregistry.definePermission('APerm', 'title').getId()
principal = self._make_principal()
# check that an allow permission is saved correctly
manager.grantPermissionToPrincipal(permission, principal)
@@ -86,8 +86,8 @@
self.assertEqual(manager.getSetting(permission, principal), Deny)
def testManyPermissionsOnePrincipal(self):
- perm1 = permregistry.definePermission('Perm One', 'title')
- perm2 = permregistry.definePermission('Perm Two', 'title')
+ perm1 = permregistry.definePermission('Perm One', 'title').getId()
+ perm2 = permregistry.definePermission('Perm Two', 'title').getId()
prin1 = self._make_principal()
manager.grantPermissionToPrincipal(perm1, prin1)
manager.grantPermissionToPrincipal(perm2, prin1)