[CMF-checkins] CVS: CMF - test_PortalFolder.py:1.4

tseaver@digicool.com tseaver@digicool.com
Fri, 8 Jun 2001 11:07:22 -0400 (EDT)


Update of /cvs-repository/CMF/CMFCore/tests
In directory korak.digicool.com:/tmp/cvs-serv19450/CMFCore/tests

Modified Files:
	test_PortalFolder.py 
Log Message:

 - Work around breakage in SecurityManager.checkPermission (members
   were failing permission checks which Anonymous passed).



--- Updated File test_PortalFolder.py in package CMF --
--- test_PortalFolder.py	2001/06/02 03:45:02	1.3
+++ test_PortalFolder.py	2001/06/08 15:07:22	1.4
@@ -3,6 +3,8 @@
 import re, new
 import OFS.Folder, OFS.SimpleItem
 from AccessControl import SecurityManager
+from AccessControl.SecurityManagement import newSecurityManager
+import Acquisition
 from Products.CMFCore.TypesTool import TypesTool
 from Products.CMFCore.CatalogTool import CatalogTool
 from Products.CMFCore.PortalContent import PortalContent
@@ -22,6 +24,18 @@
     def checkPermission( self, permission, object, context) :
         return 1
 
+class UnitTestUser( Acquisition.Implicit ):
+    """
+        Stubbed out manager for unit testing purposes.
+    """
+    def getId( self ):
+        return 'unit_tester'
+    
+    getUserName = getId
+
+    def allowed( self, object, object_roles=None ):
+        return 1
+
 class DummyContent( PortalContent, OFS.SimpleItem.Item ):
     """
     """
@@ -57,6 +71,7 @@
         self._policy = UnitTestSecurityPolicy()
         SecurityManager.setSecurityPolicy(self._policy)
         self.root = Zope.app()
+        newSecurityManager( None, UnitTestUser().__of__( self.root ) )
     
     def tearDown( self ):
         get_transaction().abort()
@@ -158,6 +173,7 @@
         assert 'foo' in catalog.uniqueValuesFor( 'id' )
         assert has_path( catalog._catalog, '/test/folder/sub/foo' )
 
+        #import pdb; pdb.set_trace()
         folder.manage_renameObject( id='sub', new_id='new_sub' )
         assert 'foo' in catalog.uniqueValuesFor( 'id' )
         assert len( catalog ) == 1