Commit b6ddfde8 authored by Tres Seaver's avatar Tres Seaver

 - Try harder to reduce global side effects in the 'createDB' bit
   (note that this piece of ugliness is due entirely to the hardwired
   dependency on FieldIndex &c in ZCatalog's ctor;  this should *go
   away*!


 - Move security manager handling to setUp/tearDown, to ensure exception-
   safe cleanup.
parent 2e30ffdf
......@@ -8,9 +8,8 @@ import ZODB, OFS.Application
from ZODB.DemoStorage import DemoStorage
from ZODB.DB import DB
from Products.ZCatalog import ZCatalog,Vocabulary
from Products.ZCatalog.Catalog import Catalog,CatalogError
from Products.ZCatalog.Catalog import Catalog, CatalogError
import ExtensionClass
from zLOG import LOG
from Products.PluginIndexes.FieldIndex.FieldIndex import FieldIndex
from Products.PluginIndexes.TextIndex.TextIndex import TextIndex
......@@ -34,7 +33,8 @@ def createDatabase():
get_transaction().commit()
# Init products
OFS.Application.initialize(app)
#OFS.Application.initialize(app)
OFS.Application.install_products(app) # XXX: this is still icky
return app
......@@ -127,15 +127,15 @@ class TestZCatalogObject(unittest.TestCase):
class dummy(ExtensionClass.Base):
pass
self.dummy = dummy()
newSecurityManager( None, DummyUser( 'phred' ) )
def tearDown(self):
noSecurityManager()
self.dummy = None
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__
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment