[Zope-CVS] CVS: Products/CompositePage/tests - test_tool.py:1.2

Shane Hathaway shane at zope.com
Wed Oct 1 15:00:03 EDT 2003


Update of /cvs-repository/Products/CompositePage/tests
In directory cvs.zope.org:/tmp/cvs-serv28549/tests

Modified Files:
	test_tool.py 
Log Message:
Preparation for the first release:

- Finished the initial documentation.

- Added security checks.



=== Products/CompositePage/tests/test_tool.py 1.1 => 1.2 ===
--- Products/CompositePage/tests/test_tool.py:1.1	Fri Sep 26 17:21:06 2003
+++ Products/CompositePage/tests/test_tool.py	Wed Oct  1 14:59:32 2003
@@ -24,6 +24,18 @@
 from Products.CompositePage.slot import Slot
 from Products.CompositePage.interfaces import CompositeError
 
+from AccessControl.SecurityManagement import noSecurityManager
+from AccessControl.SecurityManager import setSecurityPolicy
+
+
+
+class PermissiveSecurityPolicy:
+    def validate(*args, **kw):
+        return 1
+
+    def checkPermission(*args, **kw):
+        return 1
+
 
 
 class ToolTests(unittest.TestCase):
@@ -34,6 +46,7 @@
         self.root.getPhysicalRoot = lambda: self.root
         self.root.composite_tool = CompositeTool()
         self.tool = self.root.composite_tool
+        self.tool._check_security = 0
         self.root.slot = Slot("slot")
         self.slot = self.root.slot
         f = Folder()
@@ -43,7 +56,12 @@
         g._setId("g")
         self.slot._setObject(g.id, g)
         self.root.otherslot = Slot("otherslot")
+        self.old_policy = setSecurityPolicy(PermissiveSecurityPolicy())
+        noSecurityManager()
 
+    def tearDown(self):
+        setSecurityPolicy(self.old_policy)
+        noSecurityManager()
 
     def testPreventParentageLoop(self):
         self.assertRaises(CompositeError, self.tool.moveElements,




More information about the Zope-CVS mailing list