Commit f765bbe5 authored by Tres Seaver's avatar Tres Seaver

- Repair tests, adding dummy user for _setObject's sake.

parent e46e090f
...@@ -24,6 +24,17 @@ import whrandom,string, unittest ...@@ -24,6 +24,17 @@ import whrandom,string, unittest
# Stuff of Chris # Stuff of Chris
################################################################################ ################################################################################
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: class CatalogBase:
def setUp(self): def setUp(self):
...@@ -34,7 +45,7 @@ class CatalogBase: ...@@ -34,7 +45,7 @@ class CatalogBase:
def tearDown(self): def tearDown(self):
self._vocabulary = self._catalog = None self._vocabulary = self._catalog = None
class TestAddDelColumn(unittest.TestCase,CatalogBase): class TestAddDelColumn(CatalogBase,unittest.TestCase):
def testAdd(self): def testAdd(self):
self._catalog.addColumn('id') self._catalog.addColumn('id')
assert self._catalog.schema.has_key('id') == 1, 'add column failed' assert self._catalog.schema.has_key('id') == 1, 'add column failed'
...@@ -101,7 +112,9 @@ class TestZCatalogObject(unittest.TestCase): ...@@ -101,7 +112,9 @@ class TestZCatalogObject(unittest.TestCase):
def testInstantiateWithoutVocab(self): def testInstantiateWithoutVocab(self):
v = Vocabulary.Vocabulary('Vocabulary', 'Vocabulary', globbing=1) v = Vocabulary.Vocabulary('Vocabulary', 'Vocabulary', globbing=1)
newSecurityManager( None, DummyUser( 'phred' ) )
zc = ZCatalog.ZCatalog('acatalog') zc = ZCatalog.ZCatalog('acatalog')
noSecurityManager()
assert hasattr(zc, 'Vocabulary') assert hasattr(zc, 'Vocabulary')
assert zc.getVocabulary().__class__ == v.__class__ 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