[Zope-Checkins] CVS: Zope/lib/python/AccessControl/securitySuite - SecurityBase.py:1.4 regressionSecurity.py:1.2

Andreas Jung andreas@zope.com
Thu, 18 Oct 2001 10:30:51 -0400


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

Modified Files:
	SecurityBase.py regressionSecurity.py 
Log Message:
-fixed some tests
-removed redundant test for attributes
-minor tweakings


=== Zope/lib/python/AccessControl/securitySuite/SecurityBase.py 1.3 => 1.4 ===
 
         if roles==None or len(roles)==0: 
-            roles=(None,)
-    
-        for r in roles:
-            if not r in expected_roles:
-                raise AssertionError, self._roles_debug(hier,roles,expected_roles)
+            roles=()
+        
+        roles = list(roles)
+        roles.sort()
+
+        expected_roles = list(expected_roles)
+        expected_roles.sort()
+
+        if roles != expected_roles: 
+            raise AssertionError, self._roles_debug(hier,roles,expected_roles)
     
     def _checkRequest(self,*args,**kw):
         """ perform a ZPublisher request """


=== Zope/lib/python/AccessControl/securitySuite/regressionSecurity.py 1.1 => 1.2 ===
 # $Id$
 
-import os, sys
-execfile(os.path.join(sys.path[0],'framework.py'))
+import os, sys, unittest
 
 import Zope
 from OFS.Folder import Folder
@@ -259,29 +258,6 @@
         get_transaction().commit()
 
 
-    def testAttributeAccess(self):
-        """ check access to attributes """
-
-        obj = self.root.test.f2.f3.obj3
-
-        try:    
-            x = obj.public_attr
-            obj.public_attr = 'blabla'
-        except: raise AssertionError,'this should work !'    
-
-        try:    
-            x = obj._protected_attr
-            raise AssertionError,'this should not work !'    
-        except AssertionError: 
-                raise
-            
-        try:    
-            obj._protected_attr = "blalbla"
-            raise AssertionError,'this should not work !'    
-        except AssertionError: 
-                raise
-
-
     def testNobody(self):
         """ check permissions for nobody user """
 
@@ -296,10 +272,10 @@
     def testPermissionAccess(self):
         """ check permission based access """
 
-        self._checkRoles('test.f2.f3.obj3.public_func',     (None,))    
+        self._checkRoles('test.f2.f3.obj3.public_func',     ())    
         self._checkRoles('test.f2.f3.obj3.protected_func',  ('Manager','Owner'))    
         self._checkRoles('test.f2.f3.obj3.manage_func',     ('Manager',))    
-        self._checkRoles('test.f2.f3.obj3.private_func',    ('Manager',))    
+        self._checkRoles('test.f2.f3.obj3.private_func',    ())    
 
 
     def testZPublisherAccess(self):
@@ -338,5 +314,13 @@
             else:
                 res = self._checkRequest(path,expected=expected)
 
+
+def test_suite():
+    return unittest.makeSuite(AVeryBasicSecurityTest)
+
         
-framework()
+def main():
+    unittest.TextTestRunner().run(test_suite())
+
+if __name__ == '__main__':
+    main()