[Zope-Checkins] CVS: Zope/lib/python/AccessControl/tests - testUserFolder.py:1.9

Brian Lloyd brian at zope.com
Fri Jan 30 11:58:45 EST 2004


Update of /cvs-repository/Zope/lib/python/AccessControl/tests
In directory cvs.zope.org:/tmp/cvs-serv18047/lib/python/AccessControl/tests

Modified Files:
	testUserFolder.py 
Log Message:
fixed wrong test in testUserFolder


=== Zope/lib/python/AccessControl/tests/testUserFolder.py 1.8 => 1.9 ===
--- Zope/lib/python/AccessControl/tests/testUserFolder.py:1.8	Fri Jan 30 09:00:32 2004
+++ Zope/lib/python/AccessControl/tests/testUserFolder.py	Fri Jan 30 11:58:45 2004
@@ -29,11 +29,6 @@
 from AccessControl.User import BasicUserFolder
 from AccessControl.User import User
 
-# XXX: Uncomment to enforce C implementation
-#from AccessControl.SecurityManager import setSecurityPolicy
-#from AccessControl.cAccessControl import ZopeSecurityPolicy
-#setSecurityPolicy(ZopeSecurityPolicy(True, True))
-
 
 class UserFolderTests(unittest.TestCase):
 
@@ -140,9 +135,16 @@
         user = self.uf.validate(self.app.REQUEST, '', ['role1'])
         self.assertEqual(user, None)
 
-    def testNotValidateWithoutRoles(self):
+    def testValidateWithoutRoles(self):
+        # Note - calling uf.validate without specifying roles will cause
+        # the security machinery to determine the needed roles by looking
+        # at the object itself (or its container). I'm putting this note
+        # in to clarify because the original test expected failure but it
+        # really should have expected success, since the user and the
+        # object being checked both have the role 'role1', even though no
+        # roles are passed explicitly to the userfolder validate method.
         user = self.uf.validate(self.app.REQUEST, self.basic)
-        self.assertEqual(user, None)
+        self.assertEqual(user.getUserName(), 'user1')
 
     def testNotValidateWithEmptyRoles(self):
         user = self.uf.validate(self.app.REQUEST, self.basic, [])
@@ -240,4 +242,3 @@
 
 if __name__ == '__main__':
     unittest.main(defaultTest='test_suite')
-




More information about the Zope-Checkins mailing list