[CMF-checkins] SVN: CMF/trunk/CMF - made sure tests don't break if
five:traversable is set for PortalContent
Yvo Schubbe
y.2005- at wcm-solutions.de
Thu Dec 1 11:56:35 EST 2005
Log message for revision 40451:
- made sure tests don't break if five:traversable is set for PortalContent
Changed:
U CMF/trunk/CMFCore/tests/base/testcase.py
U CMF/trunk/CMFCore/tests/test_ActionInformation.py
U CMF/trunk/CMFCore/tests/test_CachingPolicyManager.py
U CMF/trunk/CMFCore/tests/test_TypesTool.py
U CMF/trunk/CMFDefault/tests/test_DiscussionReply.py
-=-
Modified: CMF/trunk/CMFCore/tests/base/testcase.py
===================================================================
--- CMF/trunk/CMFCore/tests/base/testcase.py 2005-12-01 16:56:13 UTC (rev 40450)
+++ CMF/trunk/CMFCore/tests/base/testcase.py 2005-12-01 16:56:35 UTC (rev 40451)
@@ -30,6 +30,28 @@
from zope.app.tests.placelesssetup import setUp as placelessSetUp
from zope.app.tests.placelesssetup import tearDown as placelessTearDown
+_TRAVERSE_ZCML = """
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:five="http://namespaces.zope.org/five"
+ >
+
+ <adapter
+ for="*"
+ factory=".traversable.FiveTraversable"
+ provides="zope.app.traversing.interfaces.ITraversable"
+ />
+
+ <adapter
+ for="*"
+ factory="zope.app.traversing.adapters.Traverser"
+ provides="zope.app.traversing.interfaces.ITraverser"
+ />
+
+</configure>
+"""
+
+
class LogInterceptor:
_old_log_write = None
Modified: CMF/trunk/CMFCore/tests/test_ActionInformation.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_ActionInformation.py 2005-12-01 16:56:13 UTC (rev 40450)
+++ CMF/trunk/CMFCore/tests/test_ActionInformation.py 2005-12-01 16:56:35 UTC (rev 40451)
@@ -15,12 +15,12 @@
$Id$
"""
-from unittest import TestCase, TestSuite, makeSuite, main
+import unittest
import Testing
-import Zope2
-Zope2.startup()
+import Products.Five
from OFS.Folder import manage_addFolder
+from Products.Five import zcml
from Products.PythonScripts.PythonScript import manage_addPythonScript
from Products.CMFCore.Expression import createExprContext
@@ -28,11 +28,13 @@
from Products.CMFCore.tests.base.dummy import DummyContent
from Products.CMFCore.tests.base.dummy import DummySite
from Products.CMFCore.tests.base.dummy import DummyTool as DummyMembershipTool
+from Products.CMFCore.tests.base.testcase import _TRAVERSE_ZCML
+from Products.CMFCore.tests.base.testcase import PlacelessSetup
from Products.CMFCore.tests.base.testcase import SecurityTest
from Products.CMFCore.tests.base.testcase import TransactionalTest
-class ActionCategoryTests(TestCase):
+class ActionCategoryTests(unittest.TestCase):
def _makeOne(self, *args, **kw):
from Products.CMFCore.ActionInformation import ActionCategory
@@ -57,7 +59,7 @@
self.assertEqual( ac.listActions(), (baz,) )
-class ActionTests(TestCase):
+class ActionTests(unittest.TestCase):
def _makeOne(self, *args, **kw):
from Products.CMFCore.ActionInformation import Action
@@ -96,7 +98,7 @@
self.assertEqual( a.getInfoData(), WANTED )
-class ActionInfoTests(TestCase):
+class ActionInfoTests(unittest.TestCase):
def _makeOne(self, *args, **kw):
from Products.CMFCore.ActionInformation import ActionInfo
@@ -287,12 +289,17 @@
self.assertEqual( ai2['allowed'], True )
-class ActionInformationTests(TransactionalTest):
+class ActionInformationTests(PlacelessSetup, TransactionalTest):
- def setUp( self ):
+ def setUp(self):
+ import Products.CMFCore
+ PlacelessSetup.setUp(self)
+ TransactionalTest.setUp(self)
+ zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('permissions.zcml', Products.Five)
+ zcml.load_config('configure.zcml', Products.CMFCore)
+ zcml.load_string(_TRAVERSE_ZCML)
- TransactionalTest.setUp( self )
-
root = self.root
root._setObject('portal', DummyContent('portal', 'url_portal'))
portal = self.portal = root.portal
@@ -300,6 +307,10 @@
self.folder = DummyContent('foo', 'url_foo')
self.object = DummyContent('bar', 'url_bar')
+ def tearDown(self):
+ TransactionalTest.tearDown(self)
+ PlacelessSetup.tearDown(self)
+
def _makeOne(self, *args, **kw):
from Products.CMFCore.ActionInformation import ActionInformation
@@ -416,13 +427,13 @@
def test_suite():
- return TestSuite((
- makeSuite(ActionCategoryTests),
- makeSuite(ActionTests),
- makeSuite(ActionInfoTests),
- makeSuite(ActionInfoSecurityTests),
- makeSuite(ActionInformationTests),
+ return unittest.TestSuite((
+ unittest.makeSuite(ActionCategoryTests),
+ unittest.makeSuite(ActionTests),
+ unittest.makeSuite(ActionInfoTests),
+ unittest.makeSuite(ActionInfoSecurityTests),
+ unittest.makeSuite(ActionInformationTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFCore/tests/test_CachingPolicyManager.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_CachingPolicyManager.py 2005-12-01 16:56:13 UTC (rev 40450)
+++ CMF/trunk/CMFCore/tests/test_CachingPolicyManager.py 2005-12-01 16:56:35 UTC (rev 40451)
@@ -21,20 +21,22 @@
import base64
import os
+import Products.Five
from AccessControl.SecurityManagement import newSecurityManager
from App.Common import rfc1123_date
from DateTime.DateTime import DateTime
+from Products.Five import zcml
from Products.CMFCore.FSPageTemplate import FSPageTemplate
from Products.CMFCore.tests.base.dummy import DummyContent
from Products.CMFCore.tests.base.dummy import DummySite
from Products.CMFCore.tests.base.dummy import DummyTool
from Products.CMFCore.tests.base.dummy import DummyUserFolder
+from Products.CMFCore.tests.base.testcase import _TRAVERSE_ZCML
from Products.CMFCore.tests.base.testcase import FSDVTest
+from Products.CMFCore.tests.base.testcase import PlacelessSetup
from Products.CMFCore.tests.base.testcase import RequestTest
-from Products.CMFCore.tests.test_FSPageTemplate import FSPTMaker
-
ACCLARK = DateTime( '2001/01/01' )
portal_owner = 'portal_owner'
@@ -600,13 +602,18 @@
self.assertEqual( headers[2][1] , 'max-age=86400' )
-class CachingPolicyManager304Tests(RequestTest, FSDVTest):
+class CachingPolicyManager304Tests(PlacelessSetup, RequestTest, FSDVTest):
def setUp(self):
from Products.CMFCore import CachingPolicyManager
+ PlacelessSetup.setUp(self)
RequestTest.setUp(self)
FSDVTest.setUp(self)
+ zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('permissions.zcml', Products.Five)
+ zcml.load_config('configure.zcml', Products.CMFCore)
+ zcml.load_string(_TRAVERSE_ZCML)
now = DateTime()
@@ -681,6 +688,7 @@
def tearDown(self):
RequestTest.tearDown(self)
FSDVTest.tearDown(self)
+ PlacelessSetup.tearDown(self)
def _cleanup(self):
# Clean up request and response
Modified: CMF/trunk/CMFCore/tests/test_TypesTool.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_TypesTool.py 2005-12-01 16:56:13 UTC (rev 40450)
+++ CMF/trunk/CMFCore/tests/test_TypesTool.py 2005-12-01 16:56:35 UTC (rev 40451)
@@ -15,7 +15,7 @@
$Id$
"""
-from unittest import TestCase, TestSuite, makeSuite, main
+import unittest
import Testing
import Products
@@ -38,6 +38,7 @@
from Products.CMFCore.tests.base.dummy import DummyUserFolder
from Products.CMFCore.tests.base.security import OmnipotentUser
from Products.CMFCore.tests.base.security import UserWithRoles
+from Products.CMFCore.tests.base.testcase import _TRAVERSE_ZCML
from Products.CMFCore.tests.base.testcase import PlacelessSetup
from Products.CMFCore.tests.base.testcase import SecurityTest
from Products.CMFCore.tests.base.testcase import WarningInterceptor
@@ -53,28 +54,6 @@
from Products.CMFCore.tests.base.tidata import STI_SCRIPT
-_TRAVERSE_ZCML = """
-<configure
- xmlns="http://namespaces.zope.org/zope"
- xmlns:five="http://namespaces.zope.org/five"
- >
-
- <adapter
- for="*"
- factory=".traversable.FiveTraversable"
- provides="zope.app.traversing.interfaces.ITraversable"
- />
-
- <adapter
- for="*"
- factory="zope.app.traversing.adapters.Traverser"
- provides="zope.app.traversing.interfaces.ITraverser"
- />
-
-</configure>
-"""
-
-
class TypesToolTests(PlacelessSetup, SecurityTest, WarningInterceptor):
def _makeOne(self):
@@ -175,7 +154,7 @@
'Unauthorized raised' )
-class TypeInfoTests(TestCase):
+class TypeInfoTests(unittest.TestCase):
def _makeTypesTool(self):
from Products.CMFCore.TypesTool import TypesTool
@@ -496,7 +475,7 @@
self.assertEqual( ti.constructor_path, 'foo_add' )
-class FTIConstructionTests(TestCase):
+class FTIConstructionTests(unittest.TestCase):
def setUp( self ):
noSecurityManager()
@@ -543,7 +522,7 @@
self.failIf( ti.isConstructionAllowed( folder ) )
-class FTIConstructionTests_w_Roles(TestCase):
+class FTIConstructionTests_w_Roles(unittest.TestCase):
def tearDown( self ):
noSecurityManager()
@@ -646,13 +625,13 @@
def test_suite():
- return TestSuite((
- makeSuite(TypesToolTests),
- makeSuite(FTIDataTests),
- makeSuite(STIDataTests),
- makeSuite(FTIConstructionTests),
- makeSuite(FTIConstructionTests_w_Roles),
+ return unittest.TestSuite((
+ unittest.makeSuite(TypesToolTests),
+ unittest.makeSuite(FTIDataTests),
+ unittest.makeSuite(STIDataTests),
+ unittest.makeSuite(FTIConstructionTests),
+ unittest.makeSuite(FTIConstructionTests_w_Roles),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/trunk/CMFDefault/tests/test_DiscussionReply.py
===================================================================
--- CMF/trunk/CMFDefault/tests/test_DiscussionReply.py 2005-12-01 16:56:13 UTC (rev 40450)
+++ CMF/trunk/CMFDefault/tests/test_DiscussionReply.py 2005-12-01 16:56:35 UTC (rev 40451)
@@ -23,6 +23,7 @@
from AccessControl.SecurityManagement import noSecurityManager
from Products.Five import zcml
+from Products.CMFCore.tests.base.testcase import _TRAVERSE_ZCML
from Products.CMFCore.tests.base.testcase import PlacelessSetup
from Products.CMFCore.tests.base.testcase import RequestTest
@@ -37,6 +38,7 @@
zcml.load_config('configure.zcml', Products.GenericSetup)
zcml.load_config('configure.zcml', Products.CMFCore)
zcml.load_config('configure.zcml', Products.DCWorkflow)
+ zcml.load_string(_TRAVERSE_ZCML)
try:
factory = self.root.manage_addProduct['CMFDefault'].addConfiguredSite
factory('cmf', 'CMFDefault:default', snapshot=False)
More information about the CMF-checkins
mailing list