[CMF-checkins] SVN: CMF/trunk/CMFCore/tests/test_ - fixed tests
Yvo Schubbe
y.2007- at wcm-solutions.de
Wed Mar 7 18:40:37 EST 2007
Log message for revision 73042:
- fixed tests
Changed:
U CMF/trunk/CMFCore/tests/test_ActionProviderBase.py
U CMF/trunk/CMFCore/tests/test_DynamicType.py
-=-
Modified: CMF/trunk/CMFCore/tests/test_ActionProviderBase.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_ActionProviderBase.py 2007-03-07 22:43:06 UTC (rev 73041)
+++ CMF/trunk/CMFCore/tests/test_ActionProviderBase.py 2007-03-07 23:40:36 UTC (rev 73042)
@@ -19,6 +19,7 @@
import Testing
from zope.component import getSiteManager
+from zope.testing.cleanup import cleanUp
from Products.CMFCore.interfaces import IMembershipTool
from Products.CMFCore.interfaces import IURLTool
@@ -63,15 +64,18 @@
class ActionProviderBaseTests(SecurityRequestTest):
- def setUp( self ):
+ def setUp(self):
SecurityRequestTest.setUp(self)
self.site = DummySite('site').__of__(self.root)
sm = getSiteManager()
utool = self.site._setObject( 'portal_url', DummyTool() )
sm.registerUtility(self.site.portal_url, IURLTool)
- mtool = self.site._setObject( 'portal_membership', DummyTool() )
- sm.registerUtility(self.site.portal_membership, IMembershipTool)
+ sm.registerUtility(DummyTool(), IMembershipTool)
+ def tearDown(self):
+ cleanUp()
+ SecurityRequestTest.tearDown(self)
+
def _makeProvider( self, dummy=0 ):
klass = dummy and DummyProvider or ActionProviderBase
Modified: CMF/trunk/CMFCore/tests/test_DynamicType.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_DynamicType.py 2007-03-07 22:43:06 UTC (rev 73041)
+++ CMF/trunk/CMFCore/tests/test_DynamicType.py 2007-03-07 23:40:36 UTC (rev 73042)
@@ -21,11 +21,17 @@
from StringIO import StringIO
from Acquisition import Implicit
+from Products.Five.browser import BrowserView
+from zope.component import getSiteManager
+from zope.component import provideAdapter
+from zope.component.interfaces import IDefaultViewName
+from zope.interface import alsoProvides
+from zope.publisher.interfaces.browser import IBrowserRequest
+from zope.publisher.interfaces.browser import IBrowserView
+from zope.testing.cleanup import cleanUp
from ZPublisher.HTTPRequest import HTTPRequest
from ZPublisher.HTTPResponse import HTTPResponse
-from zope.component import getSiteManager
-
from Products.CMFCore.DynamicType import DynamicType
from Products.CMFCore.interfaces import IMembershipTool
from Products.CMFCore.interfaces import ITypesTool
@@ -38,16 +44,9 @@
from Products.CMFCore.TypesTool import FactoryTypeInformation as FTI
from Products.CMFCore.TypesTool import TypesTool
-import zope.component
-from zope.testing.cleanup import CleanUp
-from zope.interface import alsoProvides
-from zope.component.interfaces import IDefaultViewName
-from zope.publisher.interfaces.browser import IBrowserRequest, IBrowserView
-from Products.Five.browser import BrowserView
def defineDefaultViewName(name, for_=None):
- zope.component.provideAdapter(name, (for_, IBrowserRequest),
- IDefaultViewName, '')
+ provideAdapter(name, (for_, IBrowserRequest), IDefaultViewName, '')
class DummyContent(DynamicType, Implicit):
@@ -63,15 +62,6 @@
class DynamicTypeTests(unittest.TestCase):
- def setUp(self):
- sm = getSiteManager()
- self.site = DummySite('site')
- self.site._setObject( 'portal_types', TypesTool() )
- sm.registerUtility(self.site.portal_types, ITypesTool)
- fti = FTIDATA_CMF15[0].copy()
- self.site.portal_types._setObject( 'Dummy Content 15', FTI(**fti) )
- self.site._setObject( 'foo', DummyContent() )
-
def test_z2interfaces(self):
from Interface.Verify import verifyClass
from Products.CMFCore.interfaces.Dynamic \
@@ -84,16 +74,22 @@
from Products.CMFCore.interfaces import IDynamicType
verifyClass(IDynamicType, DynamicType)
-class DynamicTypeDefaultTraversalTests(CleanUp, unittest.TestCase):
+class DynamicTypeDefaultTraversalTests(unittest.TestCase):
+
def setUp(self):
+ sm = getSiteManager()
self.site = DummySite('site')
self.site._setObject( 'portal_types', TypesTool() )
+ sm.registerUtility(self.site.portal_types, ITypesTool)
fti = FTIDATA_CMF15[0].copy()
self.site.portal_types._setObject( 'Dummy Content 15', FTI(**fti) )
self.site._setObject( 'foo', DummyContent() )
dummy_view = self.site._setObject( 'dummy_view', DummyObject() )
+ def tearDown(self):
+ cleanUp()
+
def test_default_view_from_fti(self):
response = HTTPResponse()
environment = { 'URL': '',
@@ -152,7 +148,7 @@
# we define a Zope3-style default view name for which a view
# actually exists
defineDefaultViewName('index.html', DummyContent)
- zope.component.provideAdapter(
+ provideAdapter(
DummyView, (DummyContent, IBrowserRequest), IBrowserView,
'index.html')
@@ -177,6 +173,10 @@
self.site.portal_types._setObject( 'Dummy Content 15', FTI(**fti) )
self.site._setObject( 'foo', DummyContent() )
+ def tearDown(self):
+ cleanUp()
+ SecurityRequestTest.tearDown(self)
+
def test_getTypeInfo(self):
foo = self.site.foo
self.assertEqual( foo.getTypeInfo().getId(), 'Dummy Content 15' )
More information about the CMF-checkins
mailing list