[CMF-checkins] CVS: Products/CMFCore/tests -
test_ActionInformation.py:1.13
test_ActionProviderBase.py:1.19 test_ActionsTool.py:1.19
test_CachingPolicyManager.py:1.15 test_CatalogTool.py:1.10
test_ContentTypeRegistry.py:1.12 test_DiscussionTool.py:1.7
test_DynamicType.py:1.7 test_MemberDataTool.py:1.7
test_MembershipTool.py:1.11 test_PortalContent.py:1.10
test_PortalFolder.py:1.42 test_RegistrationTool.py:1.6
test_SkinsTool.py:1.7 test_TypesTool.py:1.38
test_URLTool.py:1.8 test_UndoTool.py:1.5 test_WorkflowTool.py:1.12
Yvo Schubbe
y.2005- at wcm-solutions.de
Mon Jun 13 13:32:36 EDT 2005
Update of /cvs-repository/Products/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv26464/CMFCore/tests
Modified Files:
test_ActionInformation.py test_ActionProviderBase.py
test_ActionsTool.py test_CachingPolicyManager.py
test_CatalogTool.py test_ContentTypeRegistry.py
test_DiscussionTool.py test_DynamicType.py
test_MemberDataTool.py test_MembershipTool.py
test_PortalContent.py test_PortalFolder.py
test_RegistrationTool.py test_SkinsTool.py test_TypesTool.py
test_URLTool.py test_UndoTool.py test_WorkflowTool.py
Log Message:
ported newstyle (Zope 3) interfaces from CMFonFive:
- added ZCML-files that bridge z2 to z3 interfaces
- added conformance tests
- fixed the Criterion interface
- added missing license headers
- cleaned up related tests a bit
=== Products/CMFCore/tests/test_ActionInformation.py 1.12 => 1.13 ===
--- Products/CMFCore/tests/test_ActionInformation.py:1.12 Tue Jan 25 14:49:41 2005
+++ Products/CMFCore/tests/test_ActionInformation.py Mon Jun 13 13:32:04 2005
@@ -1,8 +1,24 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" Unit tests for ActionInformation module.
+
+$Id$
+"""
+
from unittest import TestCase, TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
-from Interface.Verify import verifyClass
from Products.PythonScripts.PythonScript import manage_addPythonScript
@@ -22,10 +38,22 @@
return ActionCategory(*args, **kw)
- def test_interface(self):
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.ActionInformation import ActionCategory
from Products.CMFCore.interfaces.portal_actions \
import ActionCategory as IActionCategory
+
+ verifyClass(IActionCategory, ActionCategory)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
from Products.CMFCore.ActionInformation import ActionCategory
+ from Products.CMFCore.interfaces import IActionCategory
verifyClass(IActionCategory, ActionCategory)
@@ -47,10 +75,22 @@
return Action(*args, **kw)
- def test_interface(self):
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.ActionInformation import Action
from Products.CMFCore.interfaces.portal_actions \
import Action as IAction
+
+ verifyClass(IAction, Action)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
from Products.CMFCore.ActionInformation import Action
+ from Products.CMFCore.interfaces import IAction
verifyClass(IAction, Action)
@@ -86,10 +126,22 @@
return ActionInfo(*args, **kw)
- def test_interface(self):
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.ActionInformation import ActionInfo
from Products.CMFCore.interfaces.portal_actions \
import ActionInfo as IActionInfo
+
+ verifyClass(IActionInfo, ActionInfo)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
from Products.CMFCore.ActionInformation import ActionInfo
+ from Products.CMFCore.interfaces import IActionInfo
verifyClass(IActionInfo, ActionInfo)
@@ -201,10 +253,22 @@
return ActionInformation(*args, **kw)
- def test_interface(self):
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.ActionInformation import ActionInformation
from Products.CMFCore.interfaces.portal_actions \
import Action as IAction
+
+ verifyClass(IAction, ActionInformation)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
from Products.CMFCore.ActionInformation import ActionInformation
+ from Products.CMFCore.interfaces import IAction
verifyClass(IAction, ActionInformation)
@@ -219,7 +283,7 @@
self.assertEqual(ai.getVisibility(), 1)
self.assertEqual(ai.getCategory(), 'object')
self.assertEqual(ai.getPermissions(), ())
-
+
def test_editing(self):
ai = self._makeOne(id='view', category='folder')
ai.edit(id='new_id', title='blah')
=== Products/CMFCore/tests/test_ActionProviderBase.py 1.18 => 1.19 ===
--- Products/CMFCore/tests/test_ActionProviderBase.py:1.18 Tue Jan 25 14:49:41 2005
+++ Products/CMFCore/tests/test_ActionProviderBase.py Mon Jun 13 13:32:04 2005
@@ -1,8 +1,24 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" Unit tests for ActionProviderBase module.
+
+$Id$
+"""
+
from unittest import TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
-from Interface.Verify import verifyClass
from Products.CMFCore.tests.base.dummy import DummySite
from Products.CMFCore.tests.base.dummy import DummyTool
@@ -56,6 +72,23 @@
klass = dummy and DummyProvider or ActionProviderBase
return klass()
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.interfaces.portal_actions \
+ import ActionProvider as IActionProvider
+
+ verifyClass(IActionProvider, ActionProviderBase)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.interfaces import IActionProvider
+
+ verifyClass(IActionProvider, ActionProviderBase)
+
def test_addAction( self ):
apb = self._makeProvider()
@@ -244,12 +277,6 @@
self.assertRaises( ValueError,
apb.getActionInfo,
'object/an_id', check_visibility=1 )
-
- def test_interface(self):
- from Products.CMFCore.interfaces.portal_actions \
- import ActionProvider as IActionProvider
-
- verifyClass(IActionProvider, ActionProviderBase)
def test_suite():
=== Products/CMFCore/tests/test_ActionsTool.py 1.18 => 1.19 ===
--- Products/CMFCore/tests/test_ActionsTool.py:1.18 Tue Jan 25 14:49:41 2005
+++ Products/CMFCore/tests/test_ActionsTool.py Mon Jun 13 13:32:04 2005
@@ -1,10 +1,25 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" Unit tests for ActionsTool module.
+
+$Id$
+"""
+
from unittest import TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
-from Interface.Verify import verifyClass
-from Products.CMFCore.ActionsTool import ActionsTool
from Products.CMFCore.MembershipTool import MembershipTool
from Products.CMFCore.RegistrationTool import RegistrationTool
from Products.CMFCore.tests.base.testcase import SecurityRequestTest
@@ -14,12 +29,16 @@
class ActionsToolTests( SecurityRequestTest ):
- def setUp( self ):
+ def _makeOne(self, *args, **kw):
+ from Products.CMFCore.ActionsTool import ActionsTool
+
+ return ActionsTool(*args, **kw)
+ def setUp(self):
SecurityRequestTest.setUp(self)
root = self.root
- root._setObject( 'portal_actions', ActionsTool() )
+ root._setObject( 'portal_actions', self._makeOne() )
root._setObject( 'portal_url', URLTool() )
root._setObject( 'foo', URLTool() )
root._setObject('portal_membership', MembershipTool())
@@ -27,6 +46,30 @@
self.tool = root.portal_actions
self.tool.action_providers = ('portal_actions',)
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.ActionsTool import ActionsTool
+ from Products.CMFCore.interfaces.portal_actions \
+ import ActionProvider as IActionProvider
+ from Products.CMFCore.interfaces.portal_actions \
+ import portal_actions as IActionsTool
+
+ verifyClass(IActionProvider, ActionsTool)
+ verifyClass(IActionsTool, ActionsTool)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.ActionsTool import ActionsTool
+ from Products.CMFCore.interfaces import IActionProvider
+ from Products.CMFCore.interfaces import IActionsTool
+
+ verifyClass(IActionProvider, ActionsTool)
+ verifyClass(IActionsTool, ActionsTool)
+
def test_actionProviders(self):
tool = self.tool
self.assertEqual(tool.listActionProviders(), ('portal_actions',))
@@ -69,15 +112,6 @@
'allowed': True,
'category': 'folder'}],
'global': []})
-
- def test_interface(self):
- from Products.CMFCore.interfaces.portal_actions \
- import portal_actions as IActionsTool
- from Products.CMFCore.interfaces.portal_actions \
- import ActionProvider as IActionProvider
-
- verifyClass(IActionsTool, ActionsTool)
- verifyClass(IActionProvider, ActionsTool)
def test_suite():
=== Products/CMFCore/tests/test_CachingPolicyManager.py 1.14 => 1.15 ===
--- Products/CMFCore/tests/test_CachingPolicyManager.py:1.14 Wed Mar 16 06:09:47 2005
+++ Products/CMFCore/tests/test_CachingPolicyManager.py Mon Jun 13 13:32:04 2005
@@ -1,16 +1,28 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" Unit tests for CachingPolicyManager module.
+
+$Id$
+"""
+
from unittest import TestCase, TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
-from Interface.Verify import verifyClass
from App.Common import rfc1123_date
from DateTime.DateTime import DateTime
-from Products.CMFCore.CachingPolicyManager import CachingPolicy
-from Products.CMFCore.CachingPolicyManager import CachingPolicyManager
-from Products.CMFCore.CachingPolicyManager import createCPContext
-
ACCLARK = DateTime( '2001/01/01' )
@@ -34,9 +46,12 @@
self._epoch = DateTime(0)
def _makePolicy( self, policy_id, **kw ):
+ from Products.CMFCore.CachingPolicyManager import CachingPolicy
+
return CachingPolicy( policy_id, **kw )
def _makeContext( self, **kw ):
+ from Products.CMFCore.CachingPolicyManager import createCPContext
return createCPContext( DummyContent(self._epoch)
, 'foo_view', kw, self._epoch )
@@ -241,16 +256,37 @@
class CachingPolicyManagerTests(TestCase):
+ def _makeOne(self, *args, **kw):
+ from Products.CMFCore.CachingPolicyManager import CachingPolicyManager
+
+ return CachingPolicyManager(*args, **kw)
+
def setUp(self):
self._epoch = DateTime()
- def _makeOne( self ):
- return CachingPolicyManager()
-
def assertEqualDelta( self, lhs, rhs, delta ):
self.failUnless( abs( lhs - rhs ) <= delta )
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.CachingPolicyManager import CachingPolicyManager
+ from Products.CMFCore.interfaces.CachingPolicyManager \
+ import CachingPolicyManager as ICachingPolicyManager
+
+ verifyClass(ICachingPolicyManager, CachingPolicyManager)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.CachingPolicyManager import CachingPolicyManager
+ from Products.CMFCore.interfaces import ICachingPolicyManager
+
+ verifyClass(ICachingPolicyManager, CachingPolicyManager)
+
def test_empty( self ):
mgr = self._makeOne()
@@ -405,12 +441,6 @@
self.assertEqual( headers[2][0].lower() , 'cache-control' )
self.assertEqual( headers[2][1] , 'max-age=86400' )
-
- def test_interface(self):
- from Products.CMFCore.interfaces.CachingPolicyManager \
- import CachingPolicyManager as ICachingPolicyManager
-
- verifyClass(ICachingPolicyManager, CachingPolicyManager)
def test_suite():
=== Products/CMFCore/tests/test_CatalogTool.py 1.9 => 1.10 ===
--- Products/CMFCore/tests/test_CatalogTool.py:1.9 Thu Nov 18 10:54:16 2004
+++ Products/CMFCore/tests/test_CatalogTool.py Mon Jun 13 13:32:04 2005
@@ -1,30 +1,89 @@
+##############################################################################
+#
+# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" Unit tests for CatalogTool module.
+
+$Id$
+"""
+
from unittest import TestCase, TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
-from Interface.Verify import verifyClass
+from AccessControl.SecurityManagement import newSecurityManager
from DateTime import DateTime
-from Products.CMFCore.CatalogTool import CatalogTool
-from Products.CMFCore.CatalogTool import IndexableObjectWrapper
+
from Products.CMFCore.tests.base.dummy import DummyContent
-from Products.CMFCore.tests.base.testcase import SecurityTest
-from Products.CMFCore.tests.base.security import UserWithRoles
from Products.CMFCore.tests.base.security import OmnipotentUser
-from AccessControl.SecurityManagement import newSecurityManager
+from Products.CMFCore.tests.base.security import UserWithRoles
+from Products.CMFCore.tests.base.testcase import SecurityTest
class IndexableObjectWrapperTests(TestCase):
- def test_interface(self):
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.CatalogTool import IndexableObjectWrapper
from Products.CMFCore.interfaces.portal_catalog \
import IndexableObjectWrapper as IIndexableObjectWrapper
verifyClass(IIndexableObjectWrapper, IndexableObjectWrapper)
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.CatalogTool import IndexableObjectWrapper
+ from Products.CMFCore.interfaces import IIndexableObjectWrapper
+
+ verifyClass(IIndexableObjectWrapper, IndexableObjectWrapper)
+
class CatalogToolTests(SecurityTest):
+ def _makeOne(self, *args, **kw):
+ from Products.CMFCore.CatalogTool import CatalogTool
+
+ return CatalogTool(*args, **kw)
+
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.CatalogTool import CatalogTool
+ from Products.CMFCore.interfaces.portal_actions \
+ import ActionProvider as IActionProvider
+ from Products.CMFCore.interfaces.portal_catalog \
+ import portal_catalog as ICatalogTool
+ from Products.ZCatalog.IZCatalog import IZCatalog
+
+ verifyClass(IActionProvider, CatalogTool)
+ verifyClass(ICatalogTool, CatalogTool)
+ verifyClass(IZCatalog, CatalogTool)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.CatalogTool import CatalogTool
+ from Products.CMFCore.interfaces import IActionProvider
+ from Products.CMFCore.interfaces import ICatalogTool
+
+ verifyClass(IActionProvider, CatalogTool)
+ verifyClass(ICatalogTool, CatalogTool)
+
def loginWithRoles(self, *roles):
user = UserWithRoles(*roles).__of__(self.root)
newSecurityManager(None, user)
@@ -38,25 +97,14 @@
Tracker #405: CatalogTool doesn't accept optional third
argument, 'idxs', to 'catalog_object'.
"""
- tool = CatalogTool()
+ tool = self._makeOne()
dummy = DummyContent(catalog=1)
tool.catalog_object( dummy, '/dummy' )
tool.catalog_object( dummy, '/dummy', [ 'SearchableText' ] )
- def test_interface(self):
- from Products.CMFCore.interfaces.portal_catalog \
- import portal_catalog as ICatalogTool
- from Products.CMFCore.interfaces.portal_actions \
- import ActionProvider as IActionProvider
- from Products.ZCatalog.IZCatalog import IZCatalog
-
- verifyClass(ICatalogTool, CatalogTool)
- verifyClass(IActionProvider, CatalogTool)
- verifyClass(IZCatalog, CatalogTool)
-
def test_search_anonymous(self):
- catalog = CatalogTool()
+ catalog = self._makeOne()
dummy = DummyContent(catalog=1)
catalog.catalog_object(dummy, '/dummy')
@@ -64,7 +112,7 @@
self.assertEqual(0, len(catalog.searchResults()))
def test_search_inactive(self):
- catalog = CatalogTool()
+ catalog = self._makeOne()
now = DateTime()
dummy = DummyContent(catalog=1)
dummy._View_Permission = ('Blob',)
@@ -86,7 +134,7 @@
self.assertEqual(0, len(catalog.searchResults()))
def test_search_restrict_manager(self):
- catalog = CatalogTool()
+ catalog = self._makeOne()
now = DateTime()
dummy = DummyContent(catalog=1)
@@ -117,7 +165,7 @@
expires={'query': now-2, 'range': None})))
def test_search_restrict_inactive(self):
- catalog = CatalogTool()
+ catalog = self._makeOne()
now = DateTime()
dummy = DummyContent(catalog=1)
dummy._View_Permission = ('Blob',)
@@ -147,7 +195,7 @@
expires={'query': now-2, 'range': None})))
def test_search_restrict_visible(self):
- catalog = CatalogTool()
+ catalog = self._makeOne()
now = DateTime()
dummy = DummyContent(catalog=1)
dummy._View_Permission = ('Blob',)
@@ -224,7 +272,7 @@
expires={'query': now+3, 'range': 'min'})))
def test_convertQuery(self):
- convert = CatalogTool()._convertQuery
+ convert = self._makeOne()._convertQuery
kw = {}
convert(kw)
=== Products/CMFCore/tests/test_ContentTypeRegistry.py 1.11 => 1.12 ===
--- Products/CMFCore/tests/test_ContentTypeRegistry.py:1.11 Mon Apr 26 08:14:17 2004
+++ Products/CMFCore/tests/test_ContentTypeRegistry.py Mon Jun 13 13:32:04 2005
@@ -1,26 +1,61 @@
+##############################################################################
+#
+# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" Unit tests for ContentTypeRegistry module.
+
+$Id$
+"""
+
from unittest import TestCase, TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
-from Interface.Verify import verifyClass
-
-from Products.CMFCore.ContentTypeRegistry import ContentTypeRegistry
-from Products.CMFCore.ContentTypeRegistry import ExtensionPredicate
-from Products.CMFCore.ContentTypeRegistry import MajorMinorPredicate
-from Products.CMFCore.ContentTypeRegistry import MimeTypeRegexPredicate
-from Products.CMFCore.ContentTypeRegistry import NameRegexPredicate
class MajorMinorPredicateTests( TestCase ):
+ def _makeOne(self, *args, **kw):
+ from Products.CMFCore.ContentTypeRegistry import MajorMinorPredicate
+
+ return MajorMinorPredicate(*args, **kw)
+
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.ContentTypeRegistry import MajorMinorPredicate
+ from Products.CMFCore.interfaces.ContentTypeRegistry \
+ import ContentTypeRegistryPredicate \
+ as IContentTypeRegistryPredicate
+
+ verifyClass(IContentTypeRegistryPredicate, MajorMinorPredicate)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.ContentTypeRegistry import MajorMinorPredicate
+ from Products.CMFCore.interfaces import IContentTypeRegistryPredicate
+
+ verifyClass(IContentTypeRegistryPredicate, MajorMinorPredicate)
+
def test_empty( self ):
- pred = MajorMinorPredicate( 'empty' )
+ pred = self._makeOne('empty')
assert pred.getMajorType() == 'None'
assert pred.getMinorType() == 'None'
assert not pred( 'foo', 'text/plain', 'asdfljksadf' )
def test_simple( self ):
- pred = MajorMinorPredicate( 'plaintext' )
+ pred = self._makeOne('plaintext')
pred.edit( 'text', 'plain' )
assert pred.getMajorType() == 'text'
assert pred.getMinorType() == 'plain'
@@ -30,7 +65,7 @@
assert not pred( '', 'asdf', '' )
def test_wildcard( self ):
- pred = MajorMinorPredicate( 'alltext' )
+ pred = self._makeOne('alltext')
pred.edit( 'text', '' )
assert pred.getMajorType() == 'text'
assert pred.getMinorType() == ''
@@ -45,25 +80,43 @@
assert pred( 'foo', 'text/html', 'asdfljksadf' )
assert not pred( 'foo', 'image/png', 'asdfljksadf' )
- def test_interface(self):
+
+class ExtensionPredicateTests( TestCase ):
+
+ def _makeOne(self, *args, **kw):
+ from Products.CMFCore.ContentTypeRegistry import ExtensionPredicate
+
+ return ExtensionPredicate(*args, **kw)
+
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.ContentTypeRegistry import ExtensionPredicate
from Products.CMFCore.interfaces.ContentTypeRegistry \
import ContentTypeRegistryPredicate \
as IContentTypeRegistryPredicate
- verifyClass(IContentTypeRegistryPredicate, MajorMinorPredicate)
+ verifyClass(IContentTypeRegistryPredicate, ExtensionPredicate)
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.ContentTypeRegistry import ExtensionPredicate
+ from Products.CMFCore.interfaces import IContentTypeRegistryPredicate
-class ExtensionPredicateTests( TestCase ):
+ verifyClass(IContentTypeRegistryPredicate, ExtensionPredicate)
def test_empty( self ):
- pred = ExtensionPredicate( 'empty' )
+ pred = self._makeOne('empty')
assert pred.getExtensions() == 'None'
assert not pred( 'foo', 'text/plain', 'asdfljksadf' )
assert not pred( 'foo.txt', 'text/plain', 'asdfljksadf' )
assert not pred( 'foo.bar', 'text/html', 'asdfljksadf' )
def test_simple( self ):
- pred = ExtensionPredicate( 'stardottext' )
+ pred = self._makeOne('stardottext')
pred.edit( 'txt' )
assert pred.getExtensions() == 'txt'
assert not pred( 'foo', 'text/plain', 'asdfljksadf' )
@@ -71,7 +124,7 @@
assert not pred( 'foo.bar', 'text/html', 'asdfljksadf' )
def test_multi( self ):
- pred = ExtensionPredicate( 'stardottext' )
+ pred = self._makeOne('stardottext')
pred.edit( 'txt text html htm' )
assert pred.getExtensions() == 'txt text html htm'
assert not pred( 'foo', 'text/plain', 'asdfljksadf' )
@@ -81,53 +134,92 @@
assert pred( 'foo.htm', 'text/plain', 'asdfljksadf' )
assert not pred( 'foo.bar', 'text/html', 'asdfljksadf' )
- def test_interface(self):
+
+class MimeTypeRegexPredicateTests( TestCase ):
+
+ def _makeOne(self, *args, **kw):
+ from Products.CMFCore.ContentTypeRegistry \
+ import MimeTypeRegexPredicate
+
+ return MimeTypeRegexPredicate(*args, **kw)
+
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.ContentTypeRegistry \
+ import MimeTypeRegexPredicate
from Products.CMFCore.interfaces.ContentTypeRegistry \
import ContentTypeRegistryPredicate \
as IContentTypeRegistryPredicate
- verifyClass(IContentTypeRegistryPredicate, ExtensionPredicate)
+ verifyClass(IContentTypeRegistryPredicate, MimeTypeRegexPredicate)
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.ContentTypeRegistry \
+ import MimeTypeRegexPredicate
+ from Products.CMFCore.interfaces import IContentTypeRegistryPredicate
-class MimeTypeRegexPredicateTests( TestCase ):
+ verifyClass(IContentTypeRegistryPredicate, MimeTypeRegexPredicate)
def test_empty( self ):
- pred = MimeTypeRegexPredicate( 'empty' )
+ pred = self._makeOne('empty')
assert pred.getPatternStr() == 'None'
assert not pred( 'foo', 'text/plain', 'asdfljksadf' )
def test_simple( self ):
- pred = MimeTypeRegexPredicate( 'plaintext' )
+ pred = self._makeOne('plaintext')
pred.edit( 'text/plain' )
assert pred.getPatternStr() == 'text/plain'
assert pred( 'foo', 'text/plain', 'asdfljksadf' )
assert not pred( 'foo', 'text/html', 'asdfljksadf' )
def test_pattern( self ):
- pred = MimeTypeRegexPredicate( 'alltext' )
+ pred = self._makeOne('alltext')
pred.edit( 'text/*' )
assert pred.getPatternStr() == 'text/*'
assert pred( 'foo', 'text/plain', 'asdfljksadf' )
assert pred( 'foo', 'text/html', 'asdfljksadf' )
assert not pred( 'foo', 'image/png', 'asdfljksadf' )
- def test_interface(self):
+
+class NameRegexPredicateTests( TestCase ):
+
+ def _makeOne(self, *args, **kw):
+ from Products.CMFCore.ContentTypeRegistry import NameRegexPredicate
+
+ return NameRegexPredicate(*args, **kw)
+
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.ContentTypeRegistry import NameRegexPredicate
from Products.CMFCore.interfaces.ContentTypeRegistry \
import ContentTypeRegistryPredicate \
as IContentTypeRegistryPredicate
- verifyClass(IContentTypeRegistryPredicate, MimeTypeRegexPredicate)
+ verifyClass(IContentTypeRegistryPredicate, NameRegexPredicate)
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.ContentTypeRegistry import NameRegexPredicate
+ from Products.CMFCore.interfaces import IContentTypeRegistryPredicate
-class NameRegexPredicateTests( TestCase ):
+ verifyClass(IContentTypeRegistryPredicate, NameRegexPredicate)
def test_empty( self ):
- pred = NameRegexPredicate( 'empty' )
+ pred = self._makeOne('empty')
assert pred.getPatternStr() == 'None'
assert not pred( 'foo', 'text/plain', 'asdfljksadf' )
def test_simple( self ):
- pred = NameRegexPredicate( 'onlyfoo' )
+ pred = self._makeOne('onlyfoo')
pred.edit( 'foo' )
assert pred.getPatternStr() == 'foo'
assert pred( 'foo', 'text/plain', 'asdfljksadf' )
@@ -135,25 +227,42 @@
assert not pred( 'bar', 'text/plain', 'asdfljksadf' )
def test_pattern( self ):
- pred = NameRegexPredicate( 'allfwords' )
+ pred = self._makeOne('allfwords')
pred.edit( 'f.*' )
assert pred.getPatternStr() == 'f.*'
assert pred( 'foo', 'text/plain', 'asdfljksadf' )
assert pred( 'fargo', 'text/plain', 'asdfljksadf' )
assert not pred( 'bar', 'text/plain', 'asdfljksadf' )
- def test_interface(self):
- from Products.CMFCore.interfaces.ContentTypeRegistry \
- import ContentTypeRegistryPredicate \
- as IContentTypeRegistryPredicate
- verifyClass(IContentTypeRegistryPredicate, NameRegexPredicate)
+class ContentTypeRegistryTests( TestCase ):
+ def _makeOne(self, *args, **kw):
+ from Products.CMFCore.ContentTypeRegistry import ContentTypeRegistry
-class ContentTypeRegistryTests( TestCase ):
+ return ContentTypeRegistry(*args, **kw)
def setUp( self ):
- self.reg = ContentTypeRegistry()
+ self.reg = self._makeOne()
+
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.ContentTypeRegistry import ContentTypeRegistry
+ from Products.CMFCore.interfaces.ContentTypeRegistry \
+ import ContentTypeRegistry as IContentTypeRegistry
+
+ verifyClass(IContentTypeRegistry, ContentTypeRegistry)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.ContentTypeRegistry import ContentTypeRegistry
+ from Products.CMFCore.interfaces import IContentTypeRegistry
+
+ verifyClass(IContentTypeRegistry, ContentTypeRegistry)
def test_empty( self ):
reg=self.reg
@@ -186,12 +295,6 @@
assert not reg.findTypeName( 'bar', 'text/plain', 'asdfljksadf' )
assert reg.findTypeName( 'foo', '', '' ) == 'Foo'
assert reg.findTypeName( 'foo', None, None ) == 'Foo'
-
- def test_interface(self):
- from Products.CMFCore.interfaces.ContentTypeRegistry \
- import ContentTypeRegistry as IContentTypeRegistry
-
- verifyClass(IContentTypeRegistry, ContentTypeRegistry)
def test_suite():
=== Products/CMFCore/tests/test_DiscussionTool.py 1.6 => 1.7 ===
--- Products/CMFCore/tests/test_DiscussionTool.py:1.6 Mon Jul 26 06:13:14 2004
+++ Products/CMFCore/tests/test_DiscussionTool.py Mon Jun 13 13:32:04 2005
@@ -1,32 +1,73 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" Unit tests for DiscussionTool module.
+
+$Id$
+"""
+
from unittest import TestCase, TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
-from Interface.Verify import verifyClass
-
-from Products.CMFCore.DiscussionTool import DiscussionTool
-from Products.CMFCore.DiscussionTool import OldDiscussable
class DiscussionToolTests(TestCase):
- def test_interface(self):
- from Products.CMFCore.interfaces.portal_discussion \
- import oldstyle_portal_discussion as IOldstyleDiscussionTool
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.DiscussionTool import DiscussionTool
from Products.CMFCore.interfaces.portal_actions \
import ActionProvider as IActionProvider
+ from Products.CMFCore.interfaces.portal_discussion \
+ import oldstyle_portal_discussion as IOldstyleDiscussionTool
+ verifyClass(IActionProvider, DiscussionTool)
verifyClass(IOldstyleDiscussionTool, DiscussionTool)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.DiscussionTool import DiscussionTool
+ from Products.CMFCore.interfaces import IActionProvider
+ from Products.CMFCore.interfaces import IOldstyleDiscussionTool
+
verifyClass(IActionProvider, DiscussionTool)
+ verifyClass(IOldstyleDiscussionTool, DiscussionTool)
class OldDiscussableTests(TestCase):
- def test_interface(self):
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.DiscussionTool import OldDiscussable
from Products.CMFCore.interfaces.Discussions \
import OldDiscussable as IOldDiscussable
verifyClass(IOldDiscussable, OldDiscussable)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.DiscussionTool import OldDiscussable
+ from Products.CMFCore.interfaces import IOldstyleDiscussable
+
+ verifyClass(IOldstyleDiscussable, OldDiscussable)
def test_suite():
=== Products/CMFCore/tests/test_DynamicType.py 1.6 => 1.7 ===
--- Products/CMFCore/tests/test_DynamicType.py:1.6 Mon Apr 26 08:14:17 2004
+++ Products/CMFCore/tests/test_DynamicType.py Mon Jun 13 13:32:04 2005
@@ -1,8 +1,24 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" Unit tests for DynamicType module.
+
+$Id$
+"""
+
from unittest import TestCase, TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
-from Interface.Verify import verifyClass
from Acquisition import Implicit
from ZPublisher.BaseRequest import BaseRequest
@@ -34,6 +50,23 @@
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 \
+ import DynamicType as IDynamicType
+
+ verifyClass(IDynamicType, DynamicType)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.interfaces import IDynamicType
+
+ verifyClass(IDynamicType, DynamicType)
+
def test___before_publishing_traverse__(self):
dummy_view = self.site._setObject( 'dummy_view', DummyObject() )
response = HTTPResponse()
@@ -50,12 +83,6 @@
self.assertEqual( r.response.base, '/foo/',
'CMF Collector issue #192 (wrong base): %s'
% (r.response.base or 'empty',) )
-
- def test_interface(self):
- from Products.CMFCore.interfaces.Dynamic \
- import DynamicType as IDynamicType
-
- verifyClass(IDynamicType, DynamicType)
class DynamicTypeSecurityTests(SecurityRequestTest):
=== Products/CMFCore/tests/test_MemberDataTool.py 1.6 => 1.7 ===
--- Products/CMFCore/tests/test_MemberDataTool.py:1.6 Fri Apr 15 13:29:19 2005
+++ Products/CMFCore/tests/test_MemberDataTool.py Mon Jun 13 13:32:04 2005
@@ -1,12 +1,26 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" Unit tests for MemberDataTool module.
+
+$Id$
+"""
+
from unittest import TestCase, TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
-from Interface.Verify import verifyClass
-import Acquisition
-from Products.CMFCore.MemberDataTool import MemberDataTool
-from Products.CMFCore.MemberDataTool import MemberData
+import Acquisition
class DummyUserFolder(Acquisition.Implicit):
@@ -50,28 +64,67 @@
class MemberDataToolTests(TestCase):
+ def _makeOne(self, *args, **kw):
+ from Products.CMFCore.MemberDataTool import MemberDataTool
+
+ return MemberDataTool(*args, **kw)
+
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.interfaces.portal_actions \
+ import ActionProvider as IActionProvider
+ from Products.CMFCore.interfaces.portal_memberdata \
+ import portal_memberdata as IMemberDataTool
+ from Products.CMFCore.MemberDataTool import MemberDataTool
+
+ verifyClass(IActionProvider, MemberDataTool)
+ verifyClass(IMemberDataTool, MemberDataTool)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.interfaces import IActionProvider
+ from Products.CMFCore.interfaces import IMemberDataTool
+ from Products.CMFCore.MemberDataTool import MemberDataTool
+
+ verifyClass(IActionProvider, MemberDataTool)
+ verifyClass(IMemberDataTool, MemberDataTool)
+
def test_deleteMemberData(self):
- tool = MemberDataTool()
+ tool = self._makeOne()
tool.registerMemberData('Dummy', 'user_foo')
self.failUnless( tool._members.has_key('user_foo') )
self.failUnless( tool.deleteMemberData('user_foo') )
self.failIf( tool._members.has_key('user_foo') )
self.failIf( tool.deleteMemberData('user_foo') )
- def test_interface(self):
- from Products.CMFCore.interfaces.portal_memberdata \
- import portal_memberdata as IMemberDataTool
- from Products.CMFCore.interfaces.portal_actions \
- import ActionProvider as IActionProvider
-
- verifyClass(IMemberDataTool, MemberDataTool)
- verifyClass(IActionProvider, MemberDataTool)
class MemberDataTests(TestCase):
- def test_interface(self):
+ def _makeOne(self, *args, **kw):
+ from Products.CMFCore.MemberDataTool import MemberData
+
+ return MemberData(*args, **kw)
+
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
from Products.CMFCore.interfaces.portal_memberdata \
import MemberData as IMemberData
+ from Products.CMFCore.MemberDataTool import MemberData
+
+ verifyClass(IMemberData, MemberData)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.interfaces import IMemberData
+ from Products.CMFCore.MemberDataTool import MemberData
verifyClass(IMemberData, MemberData)
@@ -81,7 +134,7 @@
user = DummyUser('bob', 'pw', ['Role'], ['domain'])
aclu._addUser(user)
user = user.__of__(aclu)
- member = MemberData(None, 'bob').__of__(mdtool).__of__(user)
+ member = self._makeOne(None, 'bob').__of__(mdtool).__of__(user)
member.setSecurityProfile(password='newpw')
self.assertEqual(user.__, 'newpw')
self.assertEqual(list(user.roles), ['Role'])
@@ -94,6 +147,7 @@
self.assertEqual(user.__, 'newpw')
self.assertEqual(list(user.roles), ['NewRole'])
self.assertEqual(list(user.domains), ['newdomain'])
+
def test_suite():
return TestSuite((
=== Products/CMFCore/tests/test_MembershipTool.py 1.10 => 1.11 ===
--- Products/CMFCore/tests/test_MembershipTool.py:1.10 Mon Apr 26 08:14:17 2004
+++ Products/CMFCore/tests/test_MembershipTool.py Mon Jun 13 13:32:04 2005
@@ -1,13 +1,28 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" Unit tests for MembershipTool module.
+
+$Id$
+"""
+
from unittest import TestCase, TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
-from Interface.Verify import verifyClass
from AccessControl.SecurityManagement import newSecurityManager
from Products.CMFCore.MemberDataTool import MemberDataTool
-from Products.CMFCore.MembershipTool import MembershipTool
from Products.CMFCore.PortalFolder import PortalFolder
from Products.CMFCore.tests.base.dummy import DummySite
from Products.CMFCore.tests.base.dummy import DummyTool
@@ -17,22 +32,42 @@
class MembershipToolTests(TestCase):
- def test_interface(self):
- from Products.CMFCore.interfaces.portal_membership \
- import portal_membership as IMembershipTool
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
from Products.CMFCore.interfaces.portal_actions \
import ActionProvider as IActionProvider
+ from Products.CMFCore.interfaces.portal_membership \
+ import portal_membership as IMembershipTool
+ from Products.CMFCore.MembershipTool import MembershipTool
+ verifyClass(IActionProvider, MembershipTool)
verifyClass(IMembershipTool, MembershipTool)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.interfaces import IActionProvider
+ from Products.CMFCore.interfaces import IMembershipTool
+ from Products.CMFCore.MembershipTool import MembershipTool
+
verifyClass(IActionProvider, MembershipTool)
+ verifyClass(IMembershipTool, MembershipTool)
class MembershipToolSecurityTests(SecurityTest):
+ def _makeOne(self, *args, **kw):
+ from Products.CMFCore.MembershipTool import MembershipTool
+
+ return MembershipTool(*args, **kw)
+
def setUp(self):
SecurityTest.setUp(self)
self.site = DummySite('site').__of__(self.root)
- self.site._setObject( 'portal_membership', MembershipTool() )
+ self.site._setObject( 'portal_membership', self._makeOne() )
def test_getCandidateLocalRoles(self):
mtool = self.site.portal_membership
=== Products/CMFCore/tests/test_PortalContent.py 1.9 => 1.10 ===
--- Products/CMFCore/tests/test_PortalContent.py:1.9 Tue Apr 5 05:26:54 2005
+++ Products/CMFCore/tests/test_PortalContent.py Mon Jun 13 13:32:04 2005
@@ -23,7 +23,6 @@
# BBB: for Zope 2.7
import Zope as Zope2
Zope2.startup()
-from Interface.Verify import verifyClass
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager
@@ -35,21 +34,36 @@
# BBB: for Zope 2.7
from Products.CMFCore.utils import transaction
-from Products.CMFCore.PortalContent import PortalContent
from Products.CMFCore.tests.base.testcase import RequestTest
from Products.CMFDefault.Portal import PortalGenerator
class PortalContentTests(TestCase):
- def test_interface(self):
- from Products.CMFCore.interfaces.Dynamic \
- import DynamicType as IDynamicType
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
from Products.CMFCore.interfaces.Contentish \
import Contentish as IContentish
+ from Products.CMFCore.interfaces.Dynamic \
+ import DynamicType as IDynamicType
+ from Products.CMFCore.PortalContent import PortalContent
+ verifyClass(IContentish, PortalContent)
verifyClass(IDynamicType, PortalContent)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.interfaces import IContentish
+ from Products.CMFCore.interfaces import IDynamicType
+ from Products.CMFCore.PortalContent import PortalContent
+
verifyClass(IContentish, PortalContent)
+ verifyClass(IDynamicType, PortalContent)
+
class TestContentCopyPaste(RequestTest):
@@ -85,14 +99,13 @@
self.site.portal_membership.createMemberArea('member')
member_area = self.site.Members.member
-
- # Switch to the manager user context and plant a content item into
+ # Switch to the manager user context and plant a content item into
# the member user's member area
newSecurityManager(None, manager1)
member_area.invokeFactory('File', id='test_file')
self.site.portal_workflow.doActionFor(member_area.test_file, 'publish')
- # Switch to "member" context now and try to copy and paste the
+ # Switch to "member" context now and try to copy and paste the
# content item created by "manager1"
newSecurityManager(None, member)
cb = member_area.manage_copyObjects(['test_file'])
=== Products/CMFCore/tests/test_PortalFolder.py 1.41 => 1.42 ===
--- Products/CMFCore/tests/test_PortalFolder.py:1.41 Tue Apr 5 05:26:54 2005
+++ Products/CMFCore/tests/test_PortalFolder.py Mon Jun 13 13:32:04 2005
@@ -23,7 +23,6 @@
# BBB: for Zope 2.7
import Zope as Zope2
Zope2.startup()
-from Interface.Verify import verifyClass
import cStringIO
@@ -131,6 +130,34 @@
return self.site._setObject( id, PortalFolder(id, *args, **kw) )
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from OFS.IOrderSupport import IOrderedContainer
+ from webdav.WriteLockInterface import WriteLockInterface
+ from Products.CMFCore.interfaces.Dynamic \
+ import DynamicType as IDynamicType
+ from Products.CMFCore.interfaces.Folderish \
+ import Folderish as IFolderish
+ from Products.CMFCore.PortalFolder import PortalFolder
+
+ verifyClass(IDynamicType, PortalFolder)
+ verifyClass(IFolderish, PortalFolder)
+ verifyClass(IOrderedContainer, PortalFolder)
+ verifyClass(WriteLockInterface, PortalFolder)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.interfaces import IDynamicType
+ from Products.CMFCore.interfaces import IFolderish
+ from Products.CMFCore.PortalFolder import PortalFolder
+
+ verifyClass(IDynamicType, PortalFolder)
+ verifyClass(IFolderish, PortalFolder)
+
def test_contents_methods(self):
ttool = self.site._setObject( 'portal_types', TypesTool() )
f = self._makeOne('foo')
@@ -373,20 +400,6 @@
test._setObject('foo', DummyContent('foo'))
self.failIf(test.checkIdAvailable('foo'))
- def test_interface(self):
- from Products.CMFCore.interfaces.Folderish \
- import Folderish as IFolderish
- from Products.CMFCore.interfaces.Dynamic \
- import DynamicType as IDynamicType
- from OFS.IOrderSupport import IOrderedContainer
- from webdav.WriteLockInterface import WriteLockInterface
- from Products.CMFCore.PortalFolder import PortalFolder
-
- verifyClass(IFolderish, PortalFolder)
- verifyClass(IDynamicType, PortalFolder)
- verifyClass(IOrderedContainer, PortalFolder)
- verifyClass(WriteLockInterface, PortalFolder)
-
class PortalFolderMoveTests(SecurityTest):
@@ -1093,7 +1106,7 @@
)
def test_paste_with_restricted_item_content_type_not_allowed(self):
-
+
# Test from CMF Collector #216 (Plone #2186), for the case
# in which the item being pasted does not allow adding such
# objects to containers which do not explicitly grant access.
@@ -1138,7 +1151,7 @@
)
def test_paste_with_restricted_item_content_type_allowed(self):
-
+
# Test from CMF Collector #216 (Plone #2186), for the case
# in which the item being pasted *does8 allow adding such
# objects to containers which *do* explicitly grant access.
@@ -1182,12 +1195,12 @@
self.failUnless( 'folder2' in folder1.objectIds() )
def test_paste_with_restricted_container_content_type(self):
-
+
# Test from CMF Collector #216 (Plone #2186), for the case
# in which the container does not allow adding items of the
# type being pasted.
from Products.CMFCore.PortalFolder import PortalFolder
-
+
RESTRICTED_TYPE = 'Restricted Container'
UNRESTRICTED_TYPE = 'Unrestricted Item'
=== Products/CMFCore/tests/test_RegistrationTool.py 1.5 => 1.6 ===
--- Products/CMFCore/tests/test_RegistrationTool.py:1.5 Wed Sep 29 13:13:21 2004
+++ Products/CMFCore/tests/test_RegistrationTool.py Mon Jun 13 13:32:04 2005
@@ -1,8 +1,24 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" Unit tests for RegistrationTool module.
+
+$Id$
+"""
+
from unittest import TestCase, TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
-from Interface.Verify import verifyClass
class RegistrationToolTests(TestCase):
@@ -12,19 +28,33 @@
return RegistrationTool()
- def test_generatePassword(self):
- rtool = self._makeOne()
- self.failUnless( len( rtool.generatePassword() ) >= 5 )
-
- def test_interface(self):
- from Products.CMFCore.interfaces.portal_registration \
- import portal_registration as IRegistrationTool
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
from Products.CMFCore.interfaces.portal_actions \
import ActionProvider as IActionProvider
+ from Products.CMFCore.interfaces.portal_registration \
+ import portal_registration as IRegistrationTool
from Products.CMFCore.RegistrationTool import RegistrationTool
+ verifyClass(IActionProvider, RegistrationTool)
verifyClass(IRegistrationTool, RegistrationTool)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.interfaces import IActionProvider
+ from Products.CMFCore.interfaces import IRegistrationTool
+ from Products.CMFCore.RegistrationTool import RegistrationTool
+
verifyClass(IActionProvider, RegistrationTool)
+ verifyClass(IRegistrationTool, RegistrationTool)
+
+ def test_generatePassword(self):
+ rtool = self._makeOne()
+ self.failUnless( len( rtool.generatePassword() ) >= 5 )
def test_suite():
=== Products/CMFCore/tests/test_SkinsTool.py 1.6 => 1.7 ===
--- Products/CMFCore/tests/test_SkinsTool.py:1.6 Wed Apr 6 09:41:00 2005
+++ Products/CMFCore/tests/test_SkinsTool.py Mon Jun 13 13:32:04 2005
@@ -1,42 +1,90 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" Unit tests for SkinsTool module.
+
+$Id$
+"""
+
from unittest import TestCase, TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
-from Interface.Verify import verifyClass
-
-from Products.CMFCore.SkinsContainer import SkinsContainer
-from Products.CMFCore.SkinsTool import SkinsTool
class SkinsContainerTests(TestCase):
- def test_interface(self):
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
from Products.CMFCore.interfaces.portal_skins \
import SkinsContainer as ISkinsContainer
+ from Products.CMFCore.SkinsContainer import SkinsContainer
+
+ verifyClass(ISkinsContainer, SkinsContainer)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.interfaces import ISkinsContainer
+ from Products.CMFCore.SkinsContainer import SkinsContainer
verifyClass(ISkinsContainer, SkinsContainer)
class SkinsToolTests(TestCase):
- def test_interface(self):
+ def _makeOne(self, *args, **kw):
+ from Products.CMFCore.SkinsTool import SkinsTool
+
+ return SkinsTool(*args, **kw)
+
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.interfaces.portal_actions \
+ import ActionProvider as IActionProvider
from Products.CMFCore.interfaces.portal_skins \
import portal_skins as ISkinsTool
from Products.CMFCore.interfaces.portal_skins \
import SkinsContainer as ISkinsContainer
- from Products.CMFCore.interfaces.portal_actions \
- import ActionProvider as IActionProvider
+ from Products.CMFCore.SkinsTool import SkinsTool
- verifyClass(ISkinsTool, SkinsTool)
+ verifyClass(IActionProvider, SkinsTool)
verifyClass(ISkinsContainer, SkinsTool)
+ verifyClass(ISkinsTool, SkinsTool)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.interfaces import IActionProvider
+ from Products.CMFCore.interfaces import ISkinsContainer
+ from Products.CMFCore.interfaces import ISkinsTool
+ from Products.CMFCore.SkinsTool import SkinsTool
+
verifyClass(IActionProvider, SkinsTool)
+ verifyClass(ISkinsContainer, SkinsTool)
+ verifyClass(ISkinsTool, SkinsTool)
def test_add_invalid_path(self):
- tool = SkinsTool()
+ tool = self._makeOne()
# We start out with no wkin selections
self.assertEquals(len(tool.getSkinSelections()), 0)
-
+
# Add a skin selection with an invalid path element
paths = 'foo, bar, .svn'
tool.addSkinSelection('fooskin', paths)
@@ -44,7 +92,7 @@
# Make sure the skin selection exists
paths = tool.getSkinPath('fooskin')
self.failIf(paths is None)
-
+
# Test for the contents
self.failIf(paths.find('foo') == -1)
self.failIf(paths.find('bar') == -1)
=== Products/CMFCore/tests/test_TypesTool.py 1.37 => 1.38 ===
--- Products/CMFCore/tests/test_TypesTool.py:1.37 Fri Mar 25 07:54:51 2005
+++ Products/CMFCore/tests/test_TypesTool.py Mon Jun 13 13:32:04 2005
@@ -1,8 +1,24 @@
+##############################################################################
+#
+# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" Unit tests for TypesTool module.
+
+$Id$
+"""
+
from unittest import TestCase, TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
-from Interface.Verify import verifyClass
from AccessControl import Unauthorized
from AccessControl.SecurityManagement import newSecurityManager
@@ -33,22 +49,50 @@
from Products.CMFCore.tests.base.tidata import FTIDATA_CMF15
from Products.CMFCore.tests.base.tidata import FTIDATA_DUMMY
from Products.CMFCore.tests.base.tidata import STI_SCRIPT
-from Products.CMFCore.TypesTool import FactoryTypeInformation as FTI
-from Products.CMFCore.TypesTool import ScriptableTypeInformation as STI
-from Products.CMFCore.TypesTool import TypesTool
class TypesToolTests(SecurityTest):
+ def _makeOne(self):
+ from Products.CMFCore.TypesTool import TypesTool
+
+ return TypesTool()
+
def setUp( self ):
+ from Products.CMFCore.TypesTool import FactoryTypeInformation as FTI
+
SecurityTest.setUp(self)
self.site = DummySite('site').__of__(self.root)
self.acl_users = self.site._setObject( 'acl_users', DummyUserFolder() )
- self.ttool = self.site._setObject( 'portal_types', TypesTool() )
+ self.ttool = self.site._setObject( 'portal_types', self._makeOne() )
fti = FTIDATA_DUMMY[0].copy()
self.ttool._setObject( 'Dummy Content', FTI(**fti) )
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.interfaces.portal_actions \
+ import ActionProvider as IActionProvider
+ from Products.CMFCore.interfaces.portal_types \
+ import portal_types as ITypesTool
+ from Products.CMFCore.TypesTool import TypesTool
+
+ verifyClass(IActionProvider, TypesTool)
+ verifyClass(ITypesTool, TypesTool)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.interfaces import IActionProvider
+ from Products.CMFCore.interfaces import ITypesTool
+ from Products.CMFCore.TypesTool import TypesTool
+
+ verifyClass(IActionProvider, TypesTool)
+ verifyClass(ITypesTool, TypesTool)
+
def test_allMetaTypes(self):
"""
Test that everything returned by allMetaTypes can be
@@ -70,6 +114,9 @@
self.failUnless(meta_types.has_key('Factory-based Type Information'))
def test_constructContent(self):
+ from Products.CMFCore.TypesTool \
+ import ScriptableTypeInformation as STI
+
site = self.site
acl_users = self.acl_users
ttool = self.ttool
@@ -100,7 +147,7 @@
#http://www.zope.org/Collectors/CMF/49
#If you have two FTIs on the file system, both with the same meta_type
- #but with different id values, the way listDefaultTypeInformation
+ #but with different id values, the way listDefaultTypeInformation
#listed them in the dropdown list made it impossible to distinguish
#the two because the identifier string only contained the CMF package
#name and the meta_type
@@ -143,17 +190,12 @@
self.failUnless('NewType2' in self.ttool.objectIds())
-def test_interface(self):
- from Products.CMFCore.interfaces.portal_types \
- import portal_types as ITypesTool
- from Products.CMFCore.interfaces.portal_actions \
- import ActionProvider as IActionProvider
-
- verifyClass(ITypesTool, TypesTool)
- verifyClass(IActionProvider, TypesTool)
+class TypeInfoTests(TestCase):
+ def _makeTypesTool(self):
+ from Products.CMFCore.TypesTool import TypesTool
-class TypeInfoTests(TestCase):
+ return TypesTool()
def test_construction( self ):
ti = self._makeInstance( 'Foo'
@@ -180,7 +222,7 @@
return tool[id]
def test_allowType( self ):
- self.tool = TypesTool()
+ self.tool = self._makeTypesTool()
ti = self._makeAndSetInstance( 'Foo' )
self.failIf( ti.allowType( 'Foo' ) )
self.failIf( ti.allowType( 'Bar' ) )
@@ -192,7 +234,7 @@
self.failUnless( ti.allowType( 'Foo3' ) )
def test_GlobalHide( self ):
- self.tool = TypesTool()
+ self.tool = self._makeTypesTool()
tnf = self._makeAndSetInstance( 'Folder', filter_content_types=0)
taf = self._makeAndSetInstance( 'Allowing Folder'
, allowed_content_types=( 'Hidden'
@@ -402,7 +444,28 @@
class FTIDataTests( TypeInfoTests ):
def _makeInstance(self, id, **kw):
- return FTI(id, **kw)
+ from Products.CMFCore.TypesTool import FactoryTypeInformation
+
+ return FactoryTypeInformation(id, **kw)
+
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.interfaces.portal_types \
+ import ContentTypeInformation as ITypeInformation
+ from Products.CMFCore.TypesTool import FactoryTypeInformation
+
+ verifyClass(ITypeInformation, FactoryTypeInformation)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.interfaces import ITypeInformation
+ from Products.CMFCore.TypesTool import FactoryTypeInformation
+
+ verifyClass(ITypeInformation, FactoryTypeInformation)
def test_properties( self ):
ti = self._makeInstance( 'Foo' )
@@ -416,17 +479,32 @@
self.assertEqual( ti.product, 'FooProduct' )
self.assertEqual( ti.factory, 'addFoo' )
- def test_interface(self):
+
+class STIDataTests( TypeInfoTests ):
+
+ def _makeInstance(self, id, **kw):
+ from Products.CMFCore.TypesTool import ScriptableTypeInformation
+
+ return ScriptableTypeInformation(id, **kw)
+
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
from Products.CMFCore.interfaces.portal_types \
import ContentTypeInformation as ITypeInformation
+ from Products.CMFCore.TypesTool import ScriptableTypeInformation
- verifyClass(ITypeInformation, FTI)
-
+ verifyClass(ITypeInformation, ScriptableTypeInformation)
-class STIDataTests( TypeInfoTests ):
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.interfaces import ITypeInformation
+ from Products.CMFCore.TypesTool import ScriptableTypeInformation
- def _makeInstance(self, id, **kw):
- return STI(id, **kw)
+ verifyClass(ITypeInformation, ScriptableTypeInformation)
def test_properties( self ):
ti = self._makeInstance( 'Foo' )
@@ -440,12 +518,6 @@
self.assertEqual( ti.permission, 'Add Foos' )
self.assertEqual( ti.constructor_path, 'foo_add' )
- def test_interface(self):
- from Products.CMFCore.interfaces.portal_types \
- import ContentTypeInformation as ITypeInformation
-
- verifyClass(ITypeInformation, STI)
-
class FTIConstructionTests(TestCase):
@@ -453,7 +525,9 @@
noSecurityManager()
def _makeInstance(self, id, **kw):
- return FTI(id, **kw)
+ from Products.CMFCore.TypesTool import FactoryTypeInformation
+
+ return FactoryTypeInformation(id, **kw)
def _makeFolder( self, fake_product=0 ):
return DummyFolder( fake_product )
@@ -491,12 +565,14 @@
self.failIf( ti.isConstructionAllowed( folder ) )
+
class FTIConstructionTests_w_Roles(TestCase):
def tearDown( self ):
noSecurityManager()
def _makeStuff( self, prefix='' ):
+ from Products.CMFCore.TypesTool import FactoryTypeInformation as FTI
ti = FTI( 'Foo'
, product='FooProduct'
=== Products/CMFCore/tests/test_URLTool.py 1.7 => 1.8 ===
--- Products/CMFCore/tests/test_URLTool.py:1.7 Mon Apr 26 08:14:17 2004
+++ Products/CMFCore/tests/test_URLTool.py Mon Jun 13 13:32:04 2005
@@ -1,13 +1,28 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" Unit tests for URLTool module.
+
+$Id$
+"""
+
from unittest import TestCase, TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
-from Interface.Verify import verifyClass
from Products.CMFCore.tests.base.dummy import DummyContent
from Products.CMFCore.tests.base.dummy import DummyFolder
from Products.CMFCore.tests.base.dummy import DummySite
-from Products.CMFCore.URLTool import URLTool
class URLToolTests(TestCase):
@@ -16,9 +31,35 @@
self.site = DummySite(id='foo')
def _makeOne(self, *args, **kw):
+ from Products.CMFCore.URLTool import URLTool
+
url_tool = URLTool(*args, **kw)
return url_tool.__of__( self.site )
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.interfaces.portal_actions \
+ import ActionProvider as IActionProvider
+ from Products.CMFCore.interfaces.portal_url \
+ import portal_url as IURLTool
+ from Products.CMFCore.URLTool import URLTool
+
+ verifyClass(IActionProvider, URLTool)
+ verifyClass(IURLTool, URLTool)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.interfaces import IActionProvider
+ from Products.CMFCore.interfaces import IURLTool
+ from Products.CMFCore.URLTool import URLTool
+
+ verifyClass(IActionProvider, URLTool)
+ verifyClass(IURLTool, URLTool)
+
def test_portal_methods(self):
url_tool = self._makeOne()
self.assertEqual( url_tool()
@@ -39,15 +80,6 @@
, 'buz/qux.html' )
self.assertEqual( url_tool.getRelativeUrl(obj)
, 'buz/qux.html' )
-
- def test_interface(self):
- from Products.CMFCore.interfaces.portal_url \
- import portal_url as IURLTool
- from Products.CMFCore.interfaces.portal_actions \
- import ActionProvider as IActionProvider
-
- verifyClass(IURLTool, URLTool)
- verifyClass(IActionProvider, URLTool)
def test_suite():
=== Products/CMFCore/tests/test_UndoTool.py 1.4 => 1.5 ===
--- Products/CMFCore/tests/test_UndoTool.py:1.4 Mon Apr 26 08:14:17 2004
+++ Products/CMFCore/tests/test_UndoTool.py Mon Jun 13 13:32:04 2005
@@ -1,22 +1,51 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" Unit tests for UndoTool module.
+
+$Id$
+"""
+
from unittest import TestCase, TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
-from Interface.Verify import verifyClass
-
-from Products.CMFCore.UndoTool import UndoTool
class UndoToolTests(TestCase):
- def test_interface(self):
- from Products.CMFCore.interfaces.portal_undo \
- import portal_undo as IUndoTool
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
from Products.CMFCore.interfaces.portal_actions \
import ActionProvider as IActionProvider
+ from Products.CMFCore.interfaces.portal_undo \
+ import portal_undo as IUndoTool
+ from Products.CMFCore.UndoTool import UndoTool
+ verifyClass(IActionProvider, UndoTool)
verifyClass(IUndoTool, UndoTool)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.interfaces import IActionProvider
+ from Products.CMFCore.interfaces import IUndoTool
+ from Products.CMFCore.UndoTool import UndoTool
+
verifyClass(IActionProvider, UndoTool)
+ verifyClass(IUndoTool, UndoTool)
def test_suite():
=== Products/CMFCore/tests/test_WorkflowTool.py 1.11 => 1.12 ===
--- Products/CMFCore/tests/test_WorkflowTool.py:1.11 Tue Nov 16 14:11:44 2004
+++ Products/CMFCore/tests/test_WorkflowTool.py Mon Jun 13 13:32:04 2005
@@ -1,13 +1,27 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" Unit tests for WorkflowTool module.
+
+$Id$
+"""
+
from unittest import TestCase, TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
-from Interface.Verify import verifyClass
from OFS.SimpleItem import SimpleItem
-from Products.CMFCore.WorkflowTool import WorkflowTool
-
class Dummy( SimpleItem ):
@@ -128,6 +142,8 @@
_removeWorkflowFactory( DummyWorkflow )
def _makeOne( self, workflow_ids=() ):
+ from Products.CMFCore.WorkflowTool import WorkflowTool
+
tool = WorkflowTool()
for workflow_id in workflow_ids:
@@ -153,6 +169,30 @@
tool.setChainForPortalTypes( ( 'Dummy Content', ), ( 'a', 'b' ) )
return tool
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.interfaces.portal_actions \
+ import ActionProvider as IActionProvider
+ from Products.CMFCore.interfaces.portal_workflow \
+ import portal_workflow as IWorkflowTool
+ from Products.CMFCore.WorkflowTool import WorkflowTool
+
+ verifyClass(IActionProvider, WorkflowTool)
+ verifyClass(IWorkflowTool, WorkflowTool)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.interfaces import IActionProvider
+ from Products.CMFCore.interfaces import IWorkflowTool
+ from Products.CMFCore.WorkflowTool import WorkflowTool
+
+ verifyClass(IActionProvider, WorkflowTool)
+ verifyClass(IWorkflowTool, WorkflowTool)
+
def test_empty( self ):
from Products.CMFCore.WorkflowTool import WorkflowException
@@ -329,15 +369,6 @@
and then check to see that the workflows each got called;
check the resulting count, as well.
"""
-
- def test_interface(self):
- from Products.CMFCore.interfaces.portal_workflow \
- import portal_workflow as IWorkflowTool
- from Products.CMFCore.interfaces.portal_actions \
- import ActionProvider as IActionProvider
-
- verifyClass(IWorkflowTool, WorkflowTool)
- verifyClass(IActionProvider, WorkflowTool)
def test_suite():
More information about the CMF-checkins
mailing list