[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security/tests - testPrincipalPermissionManager.py:1.1.2.7
Anthony Baxter
anthony@interlink.com.au
Fri, 8 Feb 2002 15:48:28 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Security/tests
In directory cvs.zope.org:/tmp/cvs-serv8963/tests
Modified Files:
Tag: Zope-3x-branch
testPrincipalPermissionManager.py
Log Message:
PrincipalPermissionManager now has a getSetting.
=== Zope3/lib/python/Zope/App/Security/tests/testPrincipalPermissionManager.py 1.1.2.6 => 1.1.2.7 ===
from Zope.App.Security.PrincipalPermissionManager \
import principalPermissionManager as manager
-from Zope.App.Security.Settings import Allow, Deny
+from Zope.App.Security.Settings import Allow, Deny, Unset
class Test(unittest.TestCase):
@@ -76,6 +76,14 @@
manager.unsetPermissionForPrincipal(permission, principal)
self.assertEqual(manager.getPrincipalsForPermission(permission), [])
self.assertEqual(manager.getPermissionsForPrincipal(principal), [])
+ # check the result of getSetting() when it's empty.
+ self.assertEqual(manager.getSetting(permission, principal), Unset)
+ # check the result of getSetting() when it's allowed.
+ manager.grantPermissionToPrincipal(permission, principal)
+ self.assertEqual(manager.getSetting(permission, principal), Allow)
+ # check the result of getSetting() when it's denied.
+ manager.denyPermissionToPrincipal(permission, principal)
+ self.assertEqual(manager.getSetting(permission, principal), Deny)
def testManyPermissionsOnePrincipal(self):
perm1 = permregistry.definePermission('Perm One', 'title')