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

Casey Duncan casey_duncan@yahoo.com
Mon, 11 Feb 2002 13:48:49 -0500


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

Modified Files:
      Tag: Zope-3x-security_defactor-branch
	testZSP.py 
Log Message:
Security manager *almost* working...Still failing one test when trying to get the playful RolePermission adapter. 8^/


=== Zope3/lib/python/Zope/App/Security/tests/testZSP.py 1.1.2.8.2.1 => 1.1.2.8.2.2 ===
 from Zope.App.Security.PrincipalRoleManager \
     import PrincipalRoleManager 
+from Zope.App.Security.AttributeRolePermissionManager \
+    import AttributeRolePermissionManager 
 from Zope.App.Security.IPrincipalRoleManager import IPrincipalRoleManager 
 from Zope.Exceptions import Unauthorized, Forbidden
 
@@ -143,20 +145,11 @@
             self.policy.checkPermission(self.write, None, Context(self.jim)))
 
     def testPlayfulRolePermissions(self):
-        # This is currently busticated. It thinks roles and permissions and
-        # principals are strings, they are NOT.
-
-        # Roles, permissions, and principals are not strings, however,
-        # their ids ARE and the security polict deals almost
-        # exclusively with ids, so these tests are NOT busted.
-        # Jim
         
+        Adaptor = AttributeRolePermissionManager
+        provideAdapter(ITest, IRolePermissionManager, Adaptor)
         test = permissionRegistry.definePermission('test', 'Test', '')
         test = test.getId()
-        
-        provideAdapter(ITest, IRolePermissionManager, Adaptor)
-        provideAdapter(ITest, IPrincipalRoleManager, 
-                       AttributePrincipalRoleManager)
 
         ob1 = TestClass()
         ob2 = TestClass()
@@ -214,8 +207,7 @@
                           self.policy.validate,
                           'x', Protected(self.write), Context(self.unknown))
         
-        anon = principalRegistry.getPrincipal('Anonymous')
-        rolePermissionManager.grantPermissionToRole(self.read, anon)
+        rolePermissionManager.grantPermissionToRole(self.read, 'Anonymous')
         
         self.policy.validate('_', Protected(self.read), Context(self.unknown))