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

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


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

Modified Files:
	testCatalog.py 
Log Message:
 - Repair tests, adding dummy user for _setObject's sake.

=== Zope/lib/python/Products/ZCatalog/tests/testCatalog.py 1.8 => 1.9 ===
 ################################################################################
 
+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):
@@ -34,7 +45,7 @@
     def tearDown(self):
         self._vocabulary = self._catalog = None
 
-class TestAddDelColumn(unittest.TestCase,CatalogBase):
+class TestAddDelColumn(CatalogBase,unittest.TestCase):
     def testAdd(self):
         self._catalog.addColumn('id')
         assert self._catalog.schema.has_key('id') == 1, 'add column failed'
@@ -101,7 +112,9 @@
 
     def testInstantiateWithoutVocab(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__