[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security/tests - testPrincipalPermissionManager.py:1.1.2.4

Jim Fulton jim@zope.com
Thu, 3 Jan 2002 14:16:47 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/Security/tests
In directory cvs.zope.org:/tmp/cvs-serv14395

Modified Files:
      Tag: Zope-3x-branch
	testPrincipalPermissionManager.py 
Log Message:
Changed to reflect the fact that the principal-permission manager
works on ids, not instances.


=== Zope3/lib/python/Zope/App/Security/tests/testPrincipalPermissionManager.py 1.1.2.3 => 1.1.2.4 ===
 import unittest
 
-from Zope.App.Security.PermissionRegistry import permissionRegistry as pregistry
+from Zope.App.Security.PermissionRegistry \
+     import permissionRegistry as pregistry
 from Zope.App.Security.PrincipalRegistry import principalRegistry as xregistry
 from Zope.App.Security.PrincipalPermissionManager \
      import principalPermissionManager as manager
@@ -25,10 +26,12 @@
         manager._clear()
         
     def _make_principal(self, id=None, title=None):
-        return xregistry.definePrincipal(
+        xregistry.definePrincipal(
             id or 'APrincipal',
             title or 'A Principal',
             login = id or 'APrincipal')
+        return id or 'APrincipal'
+             
 
     def testUnboundPrincipalPermission(self):
         permission = pregistry.definePermission('APerm', 'title')
@@ -57,7 +60,7 @@
         self.failUnless(perm2 in perms)
 
     def testManyPrincipalsOnePermission(self):
-        perm1 = pregistry.definePermission('Perm One', 'title')
+        perm1 = pregistry.definePermission('Perm One', 'title').getId()
         prin1 = self._make_principal()
         prin2 = self._make_principal('Principal 2', 'Principal Two')
         manager.grantPermissionToPrincipal(perm1, prin1)