[CMF-checkins] SVN: CMF/trunk/ - switched tests to layer based ZCML
setup
Yvo Schubbe
y.2006_ at wcm-solutions.de
Mon Nov 20 14:28:52 EST 2006
Log message for revision 71214:
- switched tests to layer based ZCML setup
Changed:
U CMF/trunk/CMFActionIcons/tests/test_exportimport.py
U CMF/trunk/CMFCore/exportimport/tests/test_actions.py
U CMF/trunk/CMFCore/exportimport/tests/test_cachingpolicymgr.py
U CMF/trunk/CMFCore/exportimport/tests/test_catalog.py
U CMF/trunk/CMFCore/exportimport/tests/test_contenttyperegistry.py
U CMF/trunk/CMFCore/exportimport/tests/test_cookieauth.py
U CMF/trunk/CMFCore/exportimport/tests/test_mailhost.py
U CMF/trunk/CMFCore/exportimport/tests/test_properties.py
U CMF/trunk/CMFCore/exportimport/tests/test_skins.py
U CMF/trunk/CMFCore/exportimport/tests/test_typeinfo.py
U CMF/trunk/CMFCore/exportimport/tests/test_workflow.py
U CMF/trunk/CMFCore/testing.py
U CMF/trunk/CMFTopic/tests/test_exportimport.py
U CMF/trunk/DCWorkflow/tests/test_exportimport.py
-=-
Modified: CMF/trunk/CMFActionIcons/tests/test_exportimport.py
===================================================================
--- CMF/trunk/CMFActionIcons/tests/test_exportimport.py 2006-11-20 19:27:53 UTC (rev 71213)
+++ CMF/trunk/CMFActionIcons/tests/test_exportimport.py 2006-11-20 19:28:51 UTC (rev 71214)
@@ -18,6 +18,7 @@
import unittest
import Testing
+from Products.GenericSetup.testing import ExportImportZCMLLayer
from Products.GenericSetup.tests.common import BaseRegistryTests
from Products.GenericSetup.tests.common import DummyExportContext
from Products.GenericSetup.tests.common import DummyImportContext
@@ -73,8 +74,11 @@
)
return site
+
class ActionIconsToolExportConfiguratorTests(_ActionIconsToolSetup):
+ layer = ExportImportZCMLLayer
+
def _getTargetClass(self):
from Products.CMFActionIcons.exportimport \
import ActionIconsToolExportConfigurator
@@ -96,6 +100,8 @@
class ActionIconsToolImportConfiguratorTests(_ActionIconsToolSetup):
+ layer = ExportImportZCMLLayer
+
def _getTargetClass(self):
from Products.CMFActionIcons.exportimport \
import ActionIconsToolImportConfigurator
@@ -123,8 +129,11 @@
self.assertEqual(info['priority'], self.PRIORITY)
self.assertEqual(info['icon_expr'], self.ICON_EXPR)
+
class Test_exportActionIconsTool(_ActionIconsToolSetup):
+ layer = ExportImportZCMLLayer
+
def test_empty(self):
from Products.CMFActionIcons.exportimport \
import exportActionIconsTool
@@ -156,6 +165,8 @@
class Test_importActionIconsTool(_ActionIconsToolSetup):
+ layer = ExportImportZCMLLayer
+
def test_normal(self):
from Products.CMFActionIcons.exportimport \
import importActionIconsTool
@@ -210,5 +221,5 @@
))
if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
-
+ from Products.GenericSetup.testing import run
+ run(test_suite())
Modified: CMF/trunk/CMFCore/exportimport/tests/test_actions.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_actions.py 2006-11-20 19:27:53 UTC (rev 71213)
+++ CMF/trunk/CMFCore/exportimport/tests/test_actions.py 2006-11-20 19:28:51 UTC (rev 71214)
@@ -18,14 +18,11 @@
import unittest
import Testing
-import Products
from Acquisition import Implicit
from Acquisition import aq_parent
from OFS.Folder import Folder
from OFS.OrderedFolder import OrderedFolder
-from Products.Five import zcml
from zope.interface import implements
-from zope.testing.cleanup import cleanUp
from Products.CMFCore.ActionProviderBase import ActionProviderBase
from Products.CMFCore.interfaces import IActionsTool
@@ -38,6 +35,8 @@
from Products.GenericSetup.tests.common import DummyExportContext
from Products.GenericSetup.tests.common import DummyImportContext
+from Products.CMFCore.testing import ExportImportZCMLLayer
+
_ACTION_XML = """\
<object name="foo_action" meta_type="CMF Action">
<property name="title">Foo</property>
@@ -242,6 +241,8 @@
class ActionNodeAdapterTests(NodeAdapterTestCase):
+ layer = ExportImportZCMLLayer
+
def _getTargetClass(self):
from Products.CMFCore.exportimport.actions import ActionNodeAdapter
@@ -269,18 +270,17 @@
self.assertEqual(obj.visible, True)
def setUp(self):
- import Products.CMFCore
from Products.CMFCore.ActionInformation import Action
NodeAdapterTestCase.setUp(self)
- zcml.load_config('configure.zcml', Products.CMFCore)
-
self._obj = Action('foo_action')
self._XML = _ACTION_XML
class ActionCategoryNodeAdapterTests(NodeAdapterTestCase):
+ layer = ExportImportZCMLLayer
+
def _getTargetClass(self):
from Products.CMFCore.exportimport.actions \
import ActionCategoryNodeAdapter
@@ -297,18 +297,17 @@
self.assertEqual(obj.title, '')
def setUp(self):
- import Products.CMFCore
from Products.CMFCore.ActionInformation import ActionCategory
NodeAdapterTestCase.setUp(self)
- zcml.load_config('configure.zcml', Products.CMFCore)
-
self._obj = ActionCategory('foo_category')
self._XML = _ACTIONCATEGORY_XML
class ActionsToolXMLAdapterTests(BodyAdapterTestCase):
+ layer = ExportImportZCMLLayer
+
def _getTargetClass(self):
from Products.CMFCore.exportimport.actions \
import ActionsToolXMLAdapter
@@ -331,12 +330,9 @@
self.assertEqual(obj.action_providers[0], 'portal_actions')
def setUp(self):
- import Products.CMFCore
from Products.CMFCore.ActionsTool import ActionsTool
BodyAdapterTestCase.setUp(self)
- zcml.load_config('configure.zcml', Products.CMFCore)
-
site = DummySite('site')
site._setObject('portal_actions', ActionsTool('portal_actions'))
self._obj = site.portal_actions
@@ -381,19 +377,11 @@
return site
- def setUp(self):
- BaseRegistryTests.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
- zcml.load_config('permissions.zcml', Products.Five)
- zcml.load_config('configure.zcml', Products.CMFCore)
- def tearDown(self):
- BaseRegistryTests.tearDown(self)
- cleanUp()
-
-
class exportActionProvidersTests(_ActionSetup):
+ layer = ExportImportZCMLLayer
+
def test_unchanged(self):
from Products.CMFCore.exportimport.actions \
import exportActionProviders
@@ -425,6 +413,8 @@
class importActionProvidersTests(_ActionSetup):
+ layer = ExportImportZCMLLayer
+
def test_empty_default_purge(self):
from Products.CMFCore.exportimport.actions \
import importActionProviders
@@ -608,4 +598,5 @@
))
if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
+ from Products.CMFCore.testing import run
+ run(test_suite())
Modified: CMF/trunk/CMFCore/exportimport/tests/test_cachingpolicymgr.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_cachingpolicymgr.py 2006-11-20 19:27:53 UTC (rev 71213)
+++ CMF/trunk/CMFCore/exportimport/tests/test_cachingpolicymgr.py 2006-11-20 19:28:51 UTC (rev 71214)
@@ -18,10 +18,7 @@
import unittest
import Testing
-import Products
from OFS.Folder import Folder
-from Products.Five import zcml
-from zope.testing.cleanup import cleanUp
from Products.GenericSetup.testing import BodyAdapterTestCase
from Products.GenericSetup.testing import NodeAdapterTestCase
@@ -29,6 +26,8 @@
from Products.GenericSetup.tests.common import DummyExportContext
from Products.GenericSetup.tests.common import DummyImportContext
+from Products.CMFCore.testing import ExportImportZCMLLayer
+
_CP_XML = """\
<caching-policy name="foo_policy" enable_304s="False" etag_func=""
last_modified="True" max_age_secs="0" mtime_func="object/modified"
@@ -52,6 +51,8 @@
class CachingPolicyNodeAdapterTests(NodeAdapterTestCase):
+ layer = ExportImportZCMLLayer
+
def _getTargetClass(self):
from Products.CMFCore.exportimport.cachingpolicymgr \
import CachingPolicyNodeAdapter
@@ -59,18 +60,17 @@
return CachingPolicyNodeAdapter
def setUp(self):
- import Products.CMFCore.exportimport
from Products.CMFCore.CachingPolicyManager import CachingPolicy
NodeAdapterTestCase.setUp(self)
- zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
-
self._obj = CachingPolicy('foo_policy', max_age_secs=0)
self._XML = _CP_XML
class CachingPolicyManagerXMLAdapterTests(BodyAdapterTestCase):
+ layer = ExportImportZCMLLayer
+
def _getTargetClass(self):
from Products.CMFCore.exportimport.cachingpolicymgr \
import CachingPolicyManagerXMLAdapter
@@ -83,12 +83,9 @@
'object/modified', 600, 0, 0, 0, '', '')
def setUp(self):
- import Products.CMFCore.exportimport
from Products.CMFCore.CachingPolicyManager import CachingPolicyManager
BodyAdapterTestCase.setUp(self)
- zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
-
self._obj = CachingPolicyManager()
self._BODY = _CPM_BODY
@@ -154,18 +151,11 @@
return site
- def setUp(self):
- BaseRegistryTests.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
- zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
- def tearDown(self):
- BaseRegistryTests.tearDown(self)
- cleanUp()
-
-
class exportCachingPolicyManagerTests(_CachingPolicyManagerSetup):
+ layer = ExportImportZCMLLayer
+
def test_empty(self):
from Products.CMFCore.exportimport.cachingpolicymgr \
import exportCachingPolicyManager
@@ -197,6 +187,8 @@
class importCachingPolicyManagerTests(_CachingPolicyManagerSetup):
+ layer = ExportImportZCMLLayer
+
def test_normal(self):
from Products.CMFCore.exportimport.cachingpolicymgr \
import importCachingPolicyManager
@@ -240,4 +232,5 @@
))
if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
+ from Products.CMFCore.testing import run
+ run(test_suite())
Modified: CMF/trunk/CMFCore/exportimport/tests/test_catalog.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_catalog.py 2006-11-20 19:27:53 UTC (rev 71213)
+++ CMF/trunk/CMFCore/exportimport/tests/test_catalog.py 2006-11-20 19:28:51 UTC (rev 71214)
@@ -19,20 +19,18 @@
from Testing import ZopeTestCase
ZopeTestCase.installProduct('ZCTextIndex', 1)
-import Products
from OFS.Folder import Folder
-from Products.Five import zcml
from Products.ZCTextIndex.Lexicon import CaseNormalizer
from Products.ZCTextIndex.Lexicon import Splitter
from Products.ZCTextIndex.Lexicon import StopWordRemover
from Products.ZCTextIndex.ZCTextIndex import PLexicon
-from zope.testing.cleanup import cleanUp
from Products.GenericSetup.tests.common import BaseRegistryTests
from Products.GenericSetup.tests.common import DummyExportContext
from Products.GenericSetup.tests.common import DummyImportContext
from Products.CMFCore.CatalogTool import CatalogTool
+from Products.CMFCore.testing import ExportImportZCMLLayer
_EMPTY_EXPORT = """\
<?xml version="1.0"?>
@@ -102,25 +100,11 @@
return site
- def setUp(self):
- import Products.GenericSetup.PluginIndexes
- import Products.GenericSetup.ZCatalog
- import Products.GenericSetup.ZCTextIndex
- BaseRegistryTests.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
- zcml.load_config('configure.zcml',
- Products.GenericSetup.PluginIndexes)
- zcml.load_config('configure.zcml', Products.GenericSetup.ZCatalog)
- zcml.load_config('configure.zcml', Products.GenericSetup.ZCTextIndex)
-
- def tearDown(self):
- BaseRegistryTests.tearDown(self)
- cleanUp()
-
-
class exportCatalogToolTests(_CatalogToolSetup):
+ layer = ExportImportZCMLLayer
+
def test_unchanged(self):
from Products.CMFCore.exportimport.catalog import exportCatalogTool
@@ -150,6 +134,8 @@
class importCatalogToolTests(_CatalogToolSetup):
+ layer = ExportImportZCMLLayer
+
def test_empty_purge(self):
from Products.CMFCore.exportimport.catalog import importCatalogTool
@@ -241,4 +227,5 @@
))
if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
+ from Products.CMFCore.testing import run
+ run(test_suite())
Modified: CMF/trunk/CMFCore/exportimport/tests/test_contenttyperegistry.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_contenttyperegistry.py 2006-11-20 19:27:53 UTC (rev 71213)
+++ CMF/trunk/CMFCore/exportimport/tests/test_contenttyperegistry.py 2006-11-20 19:28:51 UTC (rev 71214)
@@ -18,16 +18,15 @@
import unittest
import Testing
-import Products
from OFS.Folder import Folder
-from Products.Five import zcml
-from zope.testing.cleanup import cleanUp
from Products.GenericSetup.testing import BodyAdapterTestCase
from Products.GenericSetup.tests.common import BaseRegistryTests
from Products.GenericSetup.tests.common import DummyExportContext
from Products.GenericSetup.tests.common import DummyImportContext
+from Products.CMFCore.testing import ExportImportZCMLLayer
+
_TEST_PREDICATES = (
('plain_text', 'major_minor', ('text', 'plain,javascript'), 'File'),
('stylesheets', 'extension', ('css,xsl,xslt',), 'Text File'),
@@ -61,6 +60,8 @@
class ContentTypeRegistryXMLAdapterTests(BodyAdapterTestCase):
+ layer = ExportImportZCMLLayer
+
def _getTargetClass(self):
from Products.CMFCore.exportimport.contenttyperegistry \
import ContentTypeRegistryXMLAdapter
@@ -82,12 +83,9 @@
obj.assignTypeName('foobar_predicate', 'Foobar Type')
def setUp(self):
- import Products.CMFCore.exportimport
from Products.CMFCore.ContentTypeRegistry import ContentTypeRegistry
BodyAdapterTestCase.setUp(self)
- zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
-
self._obj = ContentTypeRegistry()
self._BODY = _CTR_BODY
@@ -167,18 +165,11 @@
return site
- def setUp(self):
- BaseRegistryTests.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
- zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
- def tearDown(self):
- BaseRegistryTests.tearDown(self)
- cleanUp()
-
-
class exportContentTypeRegistryTests(_ContentTypeRegistrySetup):
+ layer = ExportImportZCMLLayer
+
def test_empty(self):
from Products.CMFCore.exportimport.contenttyperegistry \
import exportContentTypeRegistry
@@ -210,6 +201,8 @@
class importContentTypeRegistryTests(_ContentTypeRegistrySetup):
+ layer = ExportImportZCMLLayer
+
def test_normal(self):
from Products.CMFCore.exportimport.contenttyperegistry \
import importContentTypeRegistry
@@ -254,4 +247,5 @@
))
if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
+ from Products.CMFCore.testing import run
+ run(test_suite())
Modified: CMF/trunk/CMFCore/exportimport/tests/test_cookieauth.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_cookieauth.py 2006-11-20 19:27:53 UTC (rev 71213)
+++ CMF/trunk/CMFCore/exportimport/tests/test_cookieauth.py 2006-11-20 19:28:51 UTC (rev 71214)
@@ -18,10 +18,7 @@
import unittest
import Testing
-import Products
from OFS.Folder import Folder
-from Products.Five import zcml
-from zope.testing.cleanup import cleanUp
from Products.GenericSetup.testing import BodyAdapterTestCase
from Products.GenericSetup.tests.common import BaseRegistryTests
@@ -29,6 +26,7 @@
from Products.GenericSetup.tests.common import DummyImportContext
from Products.CMFCore.CookieCrumbler import CookieCrumbler
+from Products.CMFCore.testing import ExportImportZCMLLayer
_COOKIECRUMBLER_BODY = """\
<?xml version="1.0"?>
@@ -81,6 +79,8 @@
class CookieCrumblerXMLAdapterTests(BodyAdapterTestCase):
+ layer = ExportImportZCMLLayer
+
def _getTargetClass(self):
from Products.CMFCore.exportimport.cookieauth \
import CookieCrumblerXMLAdapter
@@ -88,12 +88,9 @@
return CookieCrumblerXMLAdapter
def setUp(self):
- import Products.CMFCore.exportimport
from Products.CMFCore.CookieCrumbler import CookieCrumbler
BodyAdapterTestCase.setUp(self)
- zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
-
self._obj = CookieCrumbler('foo_cookiecrumbler')
self._BODY = _COOKIECRUMBLER_BODY
@@ -119,18 +116,11 @@
return site
- def setUp(self):
- BaseRegistryTests.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
- zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
- def tearDown(self):
- BaseRegistryTests.tearDown(self)
- cleanUp()
-
-
class exportCookieCrumblerTests(_CookieCrumblerSetup):
+ layer = ExportImportZCMLLayer
+
def test_unchanged(self):
from Products.CMFCore.exportimport.cookieauth \
import exportCookieCrumbler
@@ -162,6 +152,8 @@
class importCookieCrumblerTests(_CookieCrumblerSetup):
+ layer = ExportImportZCMLLayer
+
def test_normal(self):
from Products.CMFCore.exportimport.cookieauth \
import importCookieCrumbler
@@ -193,4 +185,5 @@
))
if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
+ from Products.CMFCore.testing import run
+ run(test_suite())
Modified: CMF/trunk/CMFCore/exportimport/tests/test_mailhost.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_mailhost.py 2006-11-20 19:27:53 UTC (rev 71213)
+++ CMF/trunk/CMFCore/exportimport/tests/test_mailhost.py 2006-11-20 19:28:51 UTC (rev 71214)
@@ -19,13 +19,13 @@
import Testing
from OFS.Folder import Folder
-from Products.Five import zcml
-from zope.testing.cleanup import cleanUp
from Products.GenericSetup.tests.common import BaseRegistryTests
from Products.GenericSetup.tests.common import DummyExportContext
from Products.GenericSetup.tests.common import DummyImportContext
+from Products.CMFCore.testing import ExportImportZCMLLayer
+
_DEFAULT_EXPORT = """\
<?xml version="1.0"?>
<object name="MailHost" meta_type="Mail Host" smtp_host="localhost"
@@ -56,20 +56,11 @@
return site
- def setUp(self):
- import Products.GenericSetup.MailHost
- BaseRegistryTests.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
- zcml.load_config('configure.zcml', Products.GenericSetup.MailHost)
-
- def tearDown(self):
- BaseRegistryTests.tearDown(self)
- cleanUp()
-
-
class exportMailHostTests(_MailHostSetup):
+ layer = ExportImportZCMLLayer
+
def test_unchanged(self):
from Products.CMFCore.exportimport.mailhost import exportMailHost
@@ -99,6 +90,8 @@
class importMailHostTests(_MailHostSetup):
+ layer = ExportImportZCMLLayer
+
def test_normal(self):
from Products.CMFCore.exportimport.mailhost import importMailHost
@@ -122,4 +115,5 @@
))
if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
+ from Products.CMFCore.testing import run
+ run(test_suite())
Modified: CMF/trunk/CMFCore/exportimport/tests/test_properties.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_properties.py 2006-11-20 19:27:53 UTC (rev 71213)
+++ CMF/trunk/CMFCore/exportimport/tests/test_properties.py 2006-11-20 19:28:51 UTC (rev 71214)
@@ -18,14 +18,13 @@
import unittest
import Testing
-from Products.Five import zcml
-from zope.testing.cleanup import cleanUp
-
from Products.GenericSetup.testing import BodyAdapterTestCase
from Products.GenericSetup.tests.common import BaseRegistryTests
from Products.GenericSetup.tests.common import DummyExportContext
from Products.GenericSetup.tests.common import DummyImportContext
+from Products.CMFCore.testing import ExportImportZCMLLayer
+
_PROPERTIES_BODY = """\
<?xml version="1.0"?>
<site>
@@ -59,6 +58,8 @@
class PropertiesXMLAdapterTests(BodyAdapterTestCase):
+ layer = ExportImportZCMLLayer
+
def _getTargetClass(self):
from Products.CMFCore.exportimport.properties \
import PropertiesXMLAdapter
@@ -71,12 +72,9 @@
obj._setProperty('foo_boolean', False, 'boolean')
def setUp(self):
- import Products.CMFCore.exportimport
from Products.CMFCore.PortalObject import PortalObjectBase
BodyAdapterTestCase.setUp(self)
- zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
-
self._obj = PortalObjectBase('foo_site')
self._BODY = _PROPERTIES_BODY
@@ -103,20 +101,11 @@
return site
- def setUp(self):
- import Products.CMFCore.exportimport
- BaseRegistryTests.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
- zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
-
- def tearDown(self):
- BaseRegistryTests.tearDown(self)
- cleanUp()
-
-
class exportSitePropertiesTests(_SitePropertiesSetup):
+ layer = ExportImportZCMLLayer
+
def test_empty(self):
from Products.CMFCore.exportimport.properties \
import exportSiteProperties
@@ -148,6 +137,8 @@
class importSitePropertiesTests(_SitePropertiesSetup):
+ layer = ExportImportZCMLLayer
+
def test_empty_default_purge(self):
from Products.CMFCore.exportimport.properties \
import importSiteProperties
@@ -233,4 +224,5 @@
))
if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
+ from Products.CMFCore.testing import run
+ run(test_suite())
Modified: CMF/trunk/CMFCore/exportimport/tests/test_skins.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_skins.py 2006-11-20 19:27:53 UTC (rev 71213)
+++ CMF/trunk/CMFCore/exportimport/tests/test_skins.py 2006-11-20 19:28:51 UTC (rev 71214)
@@ -21,11 +21,8 @@
import os
-import Products
from OFS.Folder import Folder
-from Products.Five import zcml
from zope.interface import implements
-from zope.testing.cleanup import cleanUp
from Products.GenericSetup.testing import BodyAdapterTestCase
from Products.GenericSetup.testing import NodeAdapterTestCase
@@ -35,6 +32,7 @@
from Products.GenericSetup.tests.common import DummyImportContext
from Products.CMFCore.interfaces import ISkinsTool
+from Products.CMFCore.testing import ExportImportZCMLLayer
_TESTS_PATH = os.path.split(__file__)[0]
@@ -192,6 +190,8 @@
class DirectoryViewAdapterTests(_DVRegistrySetup, NodeAdapterTestCase):
+ layer = ExportImportZCMLLayer
+
def _getTargetClass(self):
from Products.CMFCore.exportimport.skins \
import DirectoryViewNodeAdapter
@@ -202,13 +202,10 @@
obj._dirpath = 'CMFCore/exportimport/tests/one'
def setUp(self):
- import Products.CMFCore.exportimport
from Products.CMFCore.DirectoryView import DirectoryView
NodeAdapterTestCase.setUp(self)
_DVRegistrySetup.setUp(self)
- zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
-
self._obj = DirectoryView('foo_directoryview').__of__(Folder())
self._XML = _DIRECTORYVIEW_XML
@@ -219,6 +216,8 @@
class SkinsToolXMLAdapterTests(_DVRegistrySetup, BodyAdapterTestCase):
+ layer = ExportImportZCMLLayer
+
def _getTargetClass(self):
from Products.CMFCore.exportimport.skins import SkinsToolXMLAdapter
@@ -236,14 +235,11 @@
pass
def setUp(self):
- import Products.CMFCore.exportimport
from Products.CMFCore import DirectoryView
from Products.CMFCore.SkinsTool import SkinsTool
BodyAdapterTestCase.setUp(self)
_DVRegistrySetup.setUp(self)
- zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
-
self._obj = SkinsTool()
self._BODY = _SKINSTOOL_BODY
@@ -267,17 +263,16 @@
def setUp(self):
BaseRegistryTests.setUp(self)
_DVRegistrySetup.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
- zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
def tearDown(self):
_DVRegistrySetup.tearDown(self)
BaseRegistryTests.tearDown(self)
- cleanUp()
class exportSkinsToolTests(_SkinsSetup):
+ layer = ExportImportZCMLLayer
+
def test_empty(self):
from Products.CMFCore.exportimport.skins import exportSkinsTool
@@ -316,6 +311,8 @@
class importSkinsToolTests(_SkinsSetup):
+ layer = ExportImportZCMLLayer
+
_EMPTY_EXPORT = _EMPTY_EXPORT
_FRAGMENT1_IMPORT = _FRAGMENT1_IMPORT
_FRAGMENT2_IMPORT = _FRAGMENT2_IMPORT
@@ -545,4 +542,5 @@
))
if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
+ from Products.CMFCore.testing import run
+ run(test_suite())
Modified: CMF/trunk/CMFCore/exportimport/tests/test_typeinfo.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_typeinfo.py 2006-11-20 19:27:53 UTC (rev 71213)
+++ CMF/trunk/CMFCore/exportimport/tests/test_typeinfo.py 2006-11-20 19:28:51 UTC (rev 71214)
@@ -18,10 +18,7 @@
import unittest
import Testing
-import Products
from OFS.Folder import Folder
-from Products.Five import zcml
-from zope.testing.cleanup import cleanUp
from Products.GenericSetup.testing import BodyAdapterTestCase
from Products.GenericSetup.tests.common import BaseRegistryTests
@@ -31,6 +28,7 @@
from Products.CMFCore.permissions import View
from Products.CMFCore.permissions import AccessContentsInformation
from Products.CMFCore.permissions import ModifyPortalContent
+from Products.CMFCore.testing import ExportImportZCMLLayer
from Products.CMFCore.TypesTool import FactoryTypeInformation
from Products.CMFCore.TypesTool import ScriptableTypeInformation
from Products.CMFCore.TypesTool import TypesTool
@@ -259,6 +257,8 @@
class TypeInformationXMLAdapterTests(BodyAdapterTestCase):
+ layer = ExportImportZCMLLayer
+
def _getTargetClass(self):
from Products.CMFCore.exportimport.typeinfo \
import TypeInformationXMLAdapter
@@ -288,18 +288,17 @@
self.assertEqual(obj._actions[0].condition.text, 'python:1')
def setUp(self):
- import Products.CMFCore
from Products.CMFCore.TypesTool import FactoryTypeInformation
BodyAdapterTestCase.setUp(self)
- zcml.load_config('configure.zcml', Products.CMFCore)
-
self._obj = FactoryTypeInformation('foo_fti')
self._BODY = _FTI_BODY
class TypesToolXMLAdapterTests(BodyAdapterTestCase):
+ layer = ExportImportZCMLLayer
+
def _getTargetClass(self):
from Products.CMFCore.exportimport.typeinfo \
import TypesToolXMLAdapter
@@ -312,12 +311,9 @@
obj._setObject('foo_type', FactoryTypeInformation('foo_type'))
def setUp(self):
- import Products.CMFCore
from Products.CMFCore.TypesTool import TypesTool
BodyAdapterTestCase.setUp(self)
- zcml.load_config('configure.zcml', Products.CMFCore)
-
self._obj = TypesTool()
self._BODY = _TYPESTOOL_BODY
@@ -342,19 +338,11 @@
return site
- def setUp(self):
- BaseRegistryTests.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
- zcml.load_config('permissions.zcml', Products.Five)
- zcml.load_config('configure.zcml', Products.CMFCore)
- def tearDown(self):
- BaseRegistryTests.tearDown(self)
- cleanUp()
-
-
class exportTypesToolTests(_TypeInfoSetup):
+ layer = ExportImportZCMLLayer
+
def test_empty(self):
from Products.CMFCore.exportimport.typeinfo import exportTypesTool
@@ -415,6 +403,8 @@
class importTypesToolTests(_TypeInfoSetup):
+ layer = ExportImportZCMLLayer
+
_EMPTY_TOOL_EXPORT = _EMPTY_TOOL_EXPORT
_FILENAME_EXPORT = _FILENAME_EXPORT
_NORMAL_TOOL_EXPORT = _NORMAL_TOOL_EXPORT
@@ -538,4 +528,5 @@
))
if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
+ from Products.CMFCore.testing import run
+ run(test_suite())
Modified: CMF/trunk/CMFCore/exportimport/tests/test_workflow.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_workflow.py 2006-11-20 19:27:53 UTC (rev 71213)
+++ CMF/trunk/CMFCore/exportimport/tests/test_workflow.py 2006-11-20 19:28:51 UTC (rev 71214)
@@ -18,44 +18,18 @@
import unittest
import Testing
-import Products
from OFS.Folder import Folder
-from OFS.SimpleItem import SimpleItem
-from Products.Five import zcml
from zope.interface import implements
-from zope.testing.cleanup import cleanUp
from Products.GenericSetup.testing import BodyAdapterTestCase
from Products.GenericSetup.tests.common import BaseRegistryTests
from Products.GenericSetup.tests.common import DummyExportContext
from Products.GenericSetup.tests.common import DummyImportContext
-from Products.GenericSetup.utils import BodyAdapterBase
-from Products.CMFCore.interfaces import IWorkflowDefinition
from Products.CMFCore.interfaces import IConfigurableWorkflowTool
+from Products.CMFCore.testing import DummyWorkflow
+from Products.CMFCore.testing import ExportImportZCMLLayer
-_DUMMY_ZCML = """\
-<configure
- xmlns="http://namespaces.zope.org/zope"
- xmlns:five="http://namespaces.zope.org/five"
- i18n_domain="dummy">
- <permission id="dummy.add" title="Add Dummy Workflow"/>
- <five:registerClass
- class="Products.CMFCore.exportimport.tests.test_workflow.DummyWorkflow"
- meta_type="Dummy Workflow"
- permission="dummy.add"
- addview="addDummyWorkflow.html"
- global="false"
- />
- <adapter
- factory="Products.CMFCore.exportimport.tests.test_workflow.DummyWorkflowBodyAdapter"
- provides="Products.GenericSetup.interfaces.IBody"
- for="Products.CMFCore.interfaces.IWorkflowDefinition
- Products.GenericSetup.interfaces.ISetupEnviron"
- />
-</configure>
-"""
-
_WORKFLOWTOOL_BODY = """\
<?xml version="1.0"?>
<object name="portal_workflow" meta_type="CMF Workflow Tool">
@@ -160,26 +134,10 @@
self._chains_by_type[pt_name] = chain
-class DummyWorkflow(SimpleItem):
-
- implements(IWorkflowDefinition)
-
- meta_type = 'Dummy Workflow'
-
- def __init__(self, id):
- self._id = id
-
- def getId(self):
- return self._id
-
-
-class DummyWorkflowBodyAdapter(BodyAdapterBase):
-
- body = property(BodyAdapterBase._exportBody, BodyAdapterBase._importBody)
-
-
class WorkflowToolXMLAdapterTests(BodyAdapterTestCase):
+ layer = ExportImportZCMLLayer
+
def _getTargetClass(self):
from Products.CMFCore.exportimport.workflow \
import WorkflowToolXMLAdapter
@@ -192,13 +150,9 @@
obj.setChainForPortalTypes(('Foo Type',), '', verify=False)
def setUp(self):
- import Products.CMFCore.exportimport
from Products.CMFCore.WorkflowTool import WorkflowTool
BodyAdapterTestCase.setUp(self)
- zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
- zcml.load_string(_DUMMY_ZCML)
-
self._obj = WorkflowTool()
self._BODY = _WORKFLOWTOOL_BODY
@@ -211,19 +165,11 @@
self.root.site.portal_workflow = DummyWorkflowTool()
return site
- def setUp(self):
- BaseRegistryTests.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
- zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
- zcml.load_string(_DUMMY_ZCML)
- def tearDown(self):
- BaseRegistryTests.tearDown(self)
- cleanUp()
-
-
class exportWorkflowToolTests(_WorkflowSetup):
+ layer = ExportImportZCMLLayer
+
def test_empty(self):
from Products.CMFCore.exportimport.workflow import exportWorkflowTool
@@ -261,6 +207,8 @@
class importWorkflowToolTests(_WorkflowSetup):
+ layer = ExportImportZCMLLayer
+
_BINDINGS_TOOL_EXPORT = _BINDINGS_TOOL_EXPORT
_EMPTY_TOOL_EXPORT = _EMPTY_TOOL_EXPORT
_FRAGMENT_IMPORT = _FRAGMENT_IMPORT
@@ -414,4 +362,5 @@
))
if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
+ from Products.CMFCore.testing import run
+ run(test_suite())
Modified: CMF/trunk/CMFCore/testing.py
===================================================================
--- CMF/trunk/CMFCore/testing.py 2006-11-20 19:27:53 UTC (rev 71213)
+++ CMF/trunk/CMFCore/testing.py 2006-11-20 19:28:51 UTC (rev 71214)
@@ -16,6 +16,7 @@
"""
from Acquisition import aq_acquire
+from OFS.SimpleItem import SimpleItem
from Products.Five import i18n
from Products.Five import zcml
from zope.component import adapts
@@ -26,7 +27,10 @@
from zope.testing import testrunner
from zope.testing.cleanup import cleanUp
+from Products.CMFCore.interfaces import IWorkflowDefinition
+from Products.GenericSetup.utils import BodyAdapterBase
+
class ConformsToFolder:
def test_folder_z2interfaces(self):
@@ -165,6 +169,68 @@
cleanUp()
+_DUMMY_ZCML = """\
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:five="http://namespaces.zope.org/five"
+ i18n_domain="dummy">
+ <permission id="dummy.add" title="Add Dummy Workflow"/>
+ <five:registerClass
+ class="Products.CMFCore.testing.DummyWorkflow"
+ meta_type="Dummy Workflow"
+ permission="dummy.add"
+ addview="addDummyWorkflow.html"
+ global="false"
+ />
+ <adapter
+ factory="Products.CMFCore.testing.DummyWorkflowBodyAdapter"
+ provides="Products.GenericSetup.interfaces.IBody"
+ for="Products.CMFCore.interfaces.IWorkflowDefinition
+ Products.GenericSetup.interfaces.ISetupEnviron"
+ />
+</configure>
+"""
+
+
+class DummyWorkflow(SimpleItem):
+
+ implements(IWorkflowDefinition)
+
+ meta_type = 'Dummy Workflow'
+
+ def __init__(self, id):
+ self._id = id
+
+ def getId(self):
+ return self._id
+
+
+class DummyWorkflowBodyAdapter(BodyAdapterBase):
+
+ body = property(BodyAdapterBase._exportBody, BodyAdapterBase._importBody)
+
+
+class ExportImportZCMLLayer:
+
+ @classmethod
+ def setUp(cls):
+ import Products.Five
+ import Products.GenericSetup
+ import Products.CMFCore
+ import Products.CMFCore.exportimport
+
+ zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('permissions.zcml', Products.Five)
+ zcml.load_config('configure.zcml', Products.GenericSetup)
+ zcml.load_config('tool.zcml', Products.CMFCore)
+ zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
+ zcml.load_string(_DUMMY_ZCML)
+
+ @classmethod
+ def tearDown(cls):
+ cleanUp()
+
+
def run(test_suite):
options = testrunner.get_options()
options.resume_layer = None
Modified: CMF/trunk/CMFTopic/tests/test_exportimport.py
===================================================================
--- CMF/trunk/CMFTopic/tests/test_exportimport.py 2006-11-20 19:27:53 UTC (rev 71213)
+++ CMF/trunk/CMFTopic/tests/test_exportimport.py 2006-11-20 19:28:51 UTC (rev 71214)
@@ -14,10 +14,12 @@
$Id$
"""
+
import unittest
from DateTime.DateTime import DateTime
+from Products.GenericSetup.testing import ExportImportZCMLLayer
from Products.GenericSetup.tests.conformance \
import ConformsToIFilesystemExporter
from Products.GenericSetup.tests.conformance \
@@ -39,12 +41,15 @@
('e', 'Sort Criterion', {'reversed': 0}),
)
+
class TopicExportImportTests(SecurityRequestTest,
DOMComparator,
ConformsToIFilesystemExporter,
ConformsToIFilesystemImporter,
):
+ layer = ExportImportZCMLLayer
+
def _getTargetClass(self):
from Products.CMFTopic.exportimport import TopicExportImport
return TopicExportImport
@@ -508,11 +513,12 @@
</criteria>
""" % int(DateTime(_DATE_STR))
+
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(TopicExportImportTests),
))
if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
-
+ from Products.GenericSetup.testing import run
+ run(test_suite())
Modified: CMF/trunk/DCWorkflow/tests/test_exportimport.py
===================================================================
--- CMF/trunk/DCWorkflow/tests/test_exportimport.py 2006-11-20 19:27:53 UTC (rev 71213)
+++ CMF/trunk/DCWorkflow/tests/test_exportimport.py 2006-11-20 19:28:51 UTC (rev 71214)
@@ -18,22 +18,20 @@
import unittest
import Testing
-import Products
from Products.PythonScripts.PythonScript import PythonScript
from Products.ExternalMethod.ExternalMethod import ExternalMethod
-from Products.Five import zcml
from Products.CMFCore.exportimport.tests.test_workflow \
import _BINDINGS_TOOL_EXPORT
-from Products.CMFCore.exportimport.tests.test_workflow import _DUMMY_ZCML
from Products.CMFCore.exportimport.tests.test_workflow \
import _EMPTY_TOOL_EXPORT
from Products.CMFCore.exportimport.tests.test_workflow \
import _WorkflowSetup as WorkflowSetupBase
-from Products.CMFCore.exportimport.tests.test_workflow import DummyWorkflow
from Products.CMFCore.exportimport.tests.test_workflow \
import DummyWorkflowTool
+from Products.CMFCore.testing import DummyWorkflow
from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition
+from Products.DCWorkflow.testing import ExportImportZCMLLayer
from Products.DCWorkflow.Transitions import TRIGGER_USER_ACTION
from Products.DCWorkflow.Transitions import TRIGGER_AUTOMATIC
from Products.GenericSetup.tests.common import DummyExportContext
@@ -75,13 +73,6 @@
class _WorkflowSetup(WorkflowSetupBase):
- def setUp(self):
- WorkflowSetupBase.setUp(self)
- zcml.load_config('permissions.zcml', Products.Five)
- zcml.load_config('meta.zcml', Products.GenericSetup)
- zcml.load_config('configure.zcml', Products.GenericSetup)
- zcml.load_config('configure.zcml', Products.DCWorkflow)
-
def _initDCWorkflow( self, workflow_id ):
wf_tool = self.root.site.portal_workflow
@@ -202,6 +193,8 @@
class WorkflowDefinitionConfiguratorTests( _WorkflowSetup, _GuardChecker ):
+ layer = ExportImportZCMLLayer
+
def _getTargetClass( self ):
from Products.DCWorkflow.exportimport \
import WorkflowDefinitionConfigurator
@@ -1750,10 +1743,11 @@
</dc-workflow>
"""
-class Test_exportWorkflow( _WorkflowSetup
- , _GuardChecker
- ):
+class Test_exportWorkflow(_WorkflowSetup, _GuardChecker):
+
+ layer = ExportImportZCMLLayer
+
def test_empty( self ):
from Products.CMFCore.exportimport.workflow import exportWorkflowTool
@@ -1870,10 +1864,11 @@
self.assertEqual( text, _AFTER_CLOSE_SCRIPT)
self.assertEqual( content_type, 'text/plain' )
-class Test_importWorkflow( _WorkflowSetup
- , _GuardChecker
- ):
+class Test_importWorkflow(_WorkflowSetup, _GuardChecker):
+
+ layer = ExportImportZCMLLayer
+
def _importNormalWorkflow( self, wf_id, wf_title, wf_initial_state ):
from Products.CMFCore.exportimport.workflow import importWorkflowTool
@@ -2378,4 +2373,5 @@
))
if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
+ from Products.CMFCore.testing import run
+ run(test_suite())
More information about the CMF-checkins
mailing list