[Zope-Checkins] CVS: Zope/lib/python/AccessControl/tests - testSecurity.py:1.7 testZopeSecurityPolicy.py:1.2

Shane Hathaway shane@digicool.com
Thu, 18 Oct 2001 16:22:33 -0400


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

Modified Files:
	testSecurity.py testZopeSecurityPolicy.py 
Log Message:
- Moved a ZopeSecurityPolicy test from testSecurity to testZopeSecurityPolicy.

- Revert to old Unauthorized exceptions when zExceptions module is not present.


=== Zope/lib/python/AccessControl/tests/testSecurity.py 1.6 => 1.7 ===
         assert res == '10', res
 
-    def testAqNames(self):
-        from AccessControl.ZopeSecurityPolicy import ZopeSecurityPolicy
-        policy = ZopeSecurityPolicy()
-        assert not policy.validate('', '', 'aq_self', '', None)
-        assert not policy.validate('', '', 'aq_base', '', None)
-        assert policy.validate('', '', 'aq_parent', '', None)
-        assert policy.validate('', '', 'aq_explicit', '', None)
-
     # Note: we need more tests!
 
 def test_suite():


=== Zope/lib/python/AccessControl/tests/testZopeSecurityPolicy.py 1.1 => 1.2 ===
 
 import ZODB
-from zExceptions import Unauthorized
+try:
+    from zExceptions import Unauthorized
+except ImportError:
+    Unauthorized = 'Unauthorized'
 from AccessControl.ZopeSecurityPolicy import ZopeSecurityPolicy
 from AccessControl.User import UserFolder
 from AccessControl.SecurityManagement import SecurityContext
@@ -286,7 +289,12 @@
         v = self.policy.checkPermission('View', r_item, o_context)
         assert v, '_View_Permission should grant access to theowner'
         
-        
+    def testAqNames(self):
+        policy = self.policy
+        assert not policy.validate('', '', 'aq_self', '', None)
+        assert not policy.validate('', '', 'aq_base', '', None)
+        assert policy.validate('', '', 'aq_parent', '', None)
+        assert policy.validate('', '', 'aq_explicit', '', None)
 
     if 0:
         # This test purposely generates a log entry.