[Zope-Checkins] CVS: Zope/lib/python/Products/ZCatalog/tests - testCatalog.py:1.6.4.3

Tres Seaver tseaver@zope.com
Fri, 12 Oct 2001 01:45:18 -0400


Update of /cvs-repository/Zope/lib/python/Products/ZCatalog/tests
In directory cvs.zope.org:/tmp/cvs-serv22632

Modified Files:
      Tag: Zope-2_4-branch
	testCatalog.py 
Log Message:


  - Ensure that a stub user is available when creating a catalog
    without a vocabulary, so that the '_setObject' call can succeed.


=== Zope/lib/python/Products/ZCatalog/tests/testCatalog.py 1.6.4.2 => 1.6.4.3 ===
 ################################################################################
 
+from AccessControl.SecurityManagement import newSecurityManager
+from AccessControl.SecurityManagement import noSecurityManager
+
+class DummyUser:
+
+    def __init__( self, name ):
+        self._name = name
+
+    def getUserName( self ):
+        return self._name
+
 
 class CatalogBase:
     def setUp(self):
@@ -103,7 +114,9 @@
 
     def checkInstantiateWithoutVocab(self):
         v = Vocabulary.Vocabulary('Vocabulary', 'Vocabulary', globbing=1)
+        newSecurityManager( None, DummyUser( 'phred' ) )
         zc = ZCatalog.ZCatalog('acatalog')
+        noSecurityManager()
         assert hasattr(zc, 'Vocabulary')
         assert zc.getVocabulary().__class__ == v.__class__