[CMF-checkins] CVS: Products/CMFDefault/tests -
test_DefaultWorkflow.py:1.4.8.1
test_DiscussionTool.py:1.5.4.1 test_Discussions.py:1.19.6.3
test_Document.py:1.37.2.5 test_DublinCore.py:1.6.2.4
test_MembershipTool.py:1.12.8.1 test_MetadataTool.py:1.11.2.1
test_NewsItem.py:1.12.2.1 test_PropertiesTool.py:1.4.8.1
test_RegistrationTool.py:1.5.6.3
Yvo Schubbe
y.2005- at wcm-solutions.de
Wed Jun 15 06:15:02 EDT 2005
Update of /cvs-repository/Products/CMFDefault/tests
In directory cvs.zope.org:/tmp/cvs-serv23808/CMFDefault/tests
Modified Files:
Tag: CMF-1_5-branch
test_DefaultWorkflow.py test_DiscussionTool.py
test_Discussions.py test_Document.py test_DublinCore.py
test_MembershipTool.py test_MetadataTool.py test_NewsItem.py
test_PropertiesTool.py test_RegistrationTool.py
Log Message:
backported newstyle (Zope 3) interfaces from HEAD:
- 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/CMFDefault/tests/test_DefaultWorkflow.py 1.4 => 1.4.8.1 ===
--- Products/CMFDefault/tests/test_DefaultWorkflow.py:1.4 Mon Apr 26 08:14:18 2004
+++ Products/CMFDefault/tests/test_DefaultWorkflow.py Wed Jun 15 06:14:30 2005
@@ -1,17 +1,46 @@
+##############################################################################
+#
+# 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 DefaultWorkflow module.
+
+$Id$
+"""
+
from unittest import TestCase, TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
-from Interface.Verify import verifyClass
-
-from Products.CMFDefault.DefaultWorkflow import DefaultWorkflowDefinition
class DefaultWorkflowDefinitionTests(TestCase):
- def test_interface(self):
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
from Products.CMFCore.interfaces.portal_workflow \
import WorkflowDefinition as IWorkflowDefinition
+ from Products.CMFDefault.DefaultWorkflow \
+ import DefaultWorkflowDefinition
+
+ verifyClass(IWorkflowDefinition, DefaultWorkflowDefinition)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.interfaces import IWorkflowDefinition
+ from Products.CMFDefault.DefaultWorkflow \
+ import DefaultWorkflowDefinition
verifyClass(IWorkflowDefinition, DefaultWorkflowDefinition)
=== Products/CMFDefault/tests/test_DiscussionTool.py 1.5 => 1.5.4.1 ===
--- Products/CMFDefault/tests/test_DiscussionTool.py:1.5 Tue Jul 13 14:21:24 2004
+++ Products/CMFDefault/tests/test_DiscussionTool.py Wed Jun 15 06:14:30 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 DiscussionTool module.
+
+$Id$
+"""
+
from unittest import TestCase, TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
-from Interface.Verify import verifyClass
-from Products.CMFDefault.DiscussionTool import DiscussionTool
from Products.CMFCore.tests.base.dummy import DummyFolder
from Products.CMFCore.tests.base.dummy import DummySite
from Products.CMFCore.tests.base.dummy import DummyTool
@@ -12,11 +27,40 @@
class DiscussionToolTests(TestCase):
+ def _makeOne(self, *args, **kw):
+ from Products.CMFDefault.DiscussionTool import DiscussionTool
+
+ return DiscussionTool(*args, **kw)
+
def setUp(self):
self.site = DummySite('site')
- self.site._setObject( 'portal_discussion', DiscussionTool() )
+ self.site._setObject( 'portal_discussion', self._makeOne() )
self.site._setObject( 'portal_membership', DummyTool() )
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.interfaces.portal_actions \
+ import ActionProvider as IActionProvider
+ from Products.CMFCore.interfaces.portal_discussion \
+ import portal_discussion as IDiscussionTool
+ from Products.CMFDefault.DiscussionTool import DiscussionTool
+
+ verifyClass(IActionProvider, DiscussionTool)
+ verifyClass(IDiscussionTool, DiscussionTool)
+
+ 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 IDiscussionTool
+ from Products.CMFDefault.DiscussionTool import DiscussionTool
+
+ verifyClass(IActionProvider, DiscussionTool)
+ verifyClass(IDiscussionTool, DiscussionTool)
+
def test_overrideDiscussionFor(self):
dtool = self.site.portal_discussion
foo = self.site._setObject( 'foo', DummyFolder() )
@@ -47,15 +91,6 @@
self.failUnless( hasattr(baz.aq_base, 'talkback'),
'CMF Collector issue #119 (acquisition bug): '
'talkback not created' )
-
- def test_interface(self):
- from Products.CMFCore.interfaces.portal_discussion \
- import portal_discussion as IDiscussionTool
- from Products.CMFCore.interfaces.portal_actions \
- import ActionProvider as IActionProvider
-
- verifyClass(IDiscussionTool, DiscussionTool)
- verifyClass(IActionProvider, DiscussionTool)
def test_suite():
=== Products/CMFDefault/tests/test_Discussions.py 1.19.6.2 => 1.19.6.3 ===
--- Products/CMFDefault/tests/test_Discussions.py:1.19.6.2 Mon Jan 17 19:45:27 2005
+++ Products/CMFDefault/tests/test_Discussions.py Wed Jun 15 06:14:30 2005
@@ -1,10 +1,25 @@
+##############################################################################
+#
+# 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 Discussions.
+
+$Id$
+"""
+
from unittest import TestCase, TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
-from Interface.Verify import verifyClass
-from Products.CMFCore.utils import getToolByName
from Products.CMFCore.CatalogTool import CatalogTool
from Products.CMFCore.tests.base.dummy import DummyContent
from Products.CMFCore.tests.base.dummy import DummySite
@@ -14,41 +29,76 @@
from Products.CMFCore.tests.base.utils import has_path
from Products.CMFCore.TypesTool import FactoryTypeInformation as FTI
from Products.CMFCore.TypesTool import TypesTool
-from Products.CMFDefault.DiscussionItem import DiscussionItem
-from Products.CMFDefault.DiscussionItem import DiscussionItemContainer
+from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.DiscussionTool import DiscussionTool
from Products.CMFDefault.exceptions import DiscussionNotAllowed
class DiscussionItemTests(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.Discussions \
import DiscussionResponse as IDiscussionResponse
from Products.CMFCore.interfaces.DublinCore \
- import DublinCore as IDublinCore
- from Products.CMFCore.interfaces.DublinCore \
import CatalogableDublinCore as ICatalogableDublinCore
from Products.CMFCore.interfaces.DublinCore \
+ import DublinCore as IDublinCore
+ from Products.CMFCore.interfaces.DublinCore \
import MutableDublinCore as IMutableDublinCore
+ from Products.CMFCore.interfaces.Dynamic \
+ import DynamicType as IDynamicType
+ from Products.CMFDefault.DiscussionItem import DiscussionItem
- verifyClass(IDynamicType, DiscussionItem)
+ verifyClass(ICatalogableDublinCore, DiscussionItem)
verifyClass(IContentish, DiscussionItem)
+ verifyClass(IDiscussionResponse, DiscussionItem)
verifyClass(IDublinCore, DiscussionItem)
- verifyClass(ICatalogableDublinCore, DiscussionItem)
+ verifyClass(IDynamicType, DiscussionItem)
verifyClass(IMutableDublinCore, DiscussionItem)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.interfaces import ICatalogableDublinCore
+ from Products.CMFCore.interfaces import IContentish
+ from Products.CMFCore.interfaces import IDiscussionResponse
+ from Products.CMFCore.interfaces import IDublinCore
+ from Products.CMFCore.interfaces import IDynamicType
+ from Products.CMFCore.interfaces import IMutableDublinCore
+ from Products.CMFDefault.DiscussionItem import DiscussionItem
+
+ verifyClass(ICatalogableDublinCore, DiscussionItem)
+ verifyClass(IContentish, DiscussionItem)
verifyClass(IDiscussionResponse, DiscussionItem)
+ verifyClass(IDublinCore, DiscussionItem)
+ verifyClass(IDynamicType, DiscussionItem)
+ verifyClass(IMutableDublinCore, DiscussionItem)
class DiscussionItemContainerTests(TestCase):
- def test_interface(self):
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
from Products.CMFCore.interfaces.Discussions \
import Discussable as IDiscussable
+ from Products.CMFDefault.DiscussionItem import DiscussionItemContainer
+
+ verifyClass(IDiscussable, DiscussionItemContainer)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.interfaces import IDiscussable
+ from Products.CMFDefault.DiscussionItem import DiscussionItemContainer
verifyClass(IDiscussable, DiscussionItemContainer)
@@ -183,6 +233,8 @@
'/bar/site/test/talkback/%s' % reply.getId() ) )
def test_itemWorkflowNotification(self):
+ from Products.CMFDefault.DiscussionItem import DiscussionItem
+
dtool = self.site.portal_discussion
test = self._makeDummyContent('test')
test.allow_discussion = 1
=== Products/CMFDefault/tests/test_Document.py 1.37.2.4 => 1.37.2.5 ===
--- Products/CMFDefault/tests/test_Document.py:1.37.2.4 Thu May 26 11:27:36 2005
+++ Products/CMFDefault/tests/test_Document.py Wed Jun 15 06:14:30 2005
@@ -65,6 +65,53 @@
class DocumentTests(RequestTestBase):
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.interfaces.Contentish \
+ import Contentish as IContentish
+ from Products.CMFCore.interfaces.DublinCore \
+ import CatalogableDublinCore as ICatalogableDublinCore
+ from Products.CMFCore.interfaces.DublinCore \
+ import DublinCore as IDublinCore
+ from Products.CMFCore.interfaces.DublinCore \
+ import MutableDublinCore as IMutableDublinCore
+ from Products.CMFCore.interfaces.Dynamic \
+ import DynamicType as IDynamicType
+ from Products.CMFDefault.Document import Document
+ from Products.CMFDefault.interfaces.Document import IDocument
+ from Products.CMFDefault.interfaces.Document import IMutableDocument
+
+ verifyClass(ICatalogableDublinCore, Document)
+ verifyClass(IContentish, Document)
+ verifyClass(IDocument, Document)
+ verifyClass(IDublinCore, Document)
+ verifyClass(IDynamicType, Document)
+ verifyClass(IMutableDocument, Document)
+ verifyClass(IMutableDublinCore, Document)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.interfaces import ICatalogableDublinCore
+ from Products.CMFCore.interfaces import IContentish
+ from Products.CMFCore.interfaces import IDublinCore
+ from Products.CMFCore.interfaces import IDynamicType
+ from Products.CMFCore.interfaces import IMutableDublinCore
+ from Products.CMFDefault.Document import Document
+ from Products.CMFDefault.interfaces import IDocument
+ from Products.CMFDefault.interfaces import IMutableDocument
+
+ verifyClass(ICatalogableDublinCore, Document)
+ verifyClass(IContentish, Document)
+ verifyClass(IDocument, Document)
+ verifyClass(IDublinCore, Document)
+ verifyClass(IDynamicType, Document)
+ verifyClass(IMutableDocument, Document)
+ verifyClass(IMutableDublinCore, Document)
+
def test_Empty(self):
d = self._makeOne('foo', text_format='structured-text')
@@ -358,30 +405,6 @@
self.assertEqual( d.Format(), 'text/plain' )
self.assertEqual( d.text_format, 'structured-text' )
-
- def test_z2interfaces(self):
- from Interface.Verify import verifyClass
- from Products.CMFCore.interfaces.Dynamic \
- import DynamicType as IDynamicType
- from Products.CMFCore.interfaces.Contentish \
- import Contentish as IContentish
- from Products.CMFCore.interfaces.DublinCore \
- import DublinCore as IDublinCore
- from Products.CMFCore.interfaces.DublinCore \
- import CatalogableDublinCore as ICatalogableDublinCore
- from Products.CMFCore.interfaces.DublinCore \
- import MutableDublinCore as IMutableDublinCore
- from Products.CMFDefault.Document import Document
- from Products.CMFDefault.interfaces.Document import IDocument
- from Products.CMFDefault.interfaces.Document import IMutableDocument
-
- verifyClass(IDynamicType, Document)
- verifyClass(IContentish, Document)
- verifyClass(IDublinCore, Document)
- verifyClass(ICatalogableDublinCore, Document)
- verifyClass(IMutableDublinCore, Document)
- verifyClass(IDocument, Document)
- verifyClass(IMutableDocument, Document)
class DocumentFTPGetTests(RequestTestBase):
=== Products/CMFDefault/tests/test_DublinCore.py 1.6.2.3 => 1.6.2.4 ===
--- Products/CMFDefault/tests/test_DublinCore.py:1.6.2.3 Sat Apr 9 19:00:10 2005
+++ Products/CMFDefault/tests/test_DublinCore.py Wed Jun 15 06:14:30 2005
@@ -1,12 +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 DublinCore module.
+
+$Id$
+"""
+
from unittest import TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
-from Acquisition import Implicit
-from Interface.Verify import verifyClass
-
from AccessControl.SecurityManagement import newSecurityManager
+from Acquisition import Implicit
from DateTime.DateTime import DateTime
from Products.CMFCore.tests.base.dummy import DummySite
@@ -32,6 +47,7 @@
return t_val
+
class DummyMetadataTool(Implicit):
def __init__(self, publisher):
@@ -40,33 +56,46 @@
def getPublisher(self):
return self._publisher
+
class DublinCoreTests(SecurityTest):
- def xxx_setUp(self):
- SecurityTest.setUp(self)
+ def _makeDummyContent(self, id, *args, **kw):
+ from Products.CMFCore.PortalContent import PortalContent
+ from Products.CMFDefault.DublinCore import DefaultDublinCoreImpl
- def test_interface(self):
- from Products.CMFCore.interfaces.DublinCore \
- import DublinCore as IDublinCore
+ class DummyContent(PortalContent, DefaultDublinCoreImpl):
+ pass
+
+ return DummyContent(id, *args, **kw)
+
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
from Products.CMFCore.interfaces.DublinCore \
import CatalogableDublinCore as ICatalogableDublinCore
from Products.CMFCore.interfaces.DublinCore \
+ import DublinCore as IDublinCore
+ from Products.CMFCore.interfaces.DublinCore \
import MutableDublinCore as IMutableDublinCore
from Products.CMFDefault.DublinCore import DefaultDublinCoreImpl
- verifyClass(IDublinCore, DefaultDublinCoreImpl)
verifyClass(ICatalogableDublinCore, DefaultDublinCoreImpl)
+ verifyClass(IDublinCore, DefaultDublinCoreImpl)
verifyClass(IMutableDublinCore, DefaultDublinCoreImpl)
- def _makeDummyContent(self, id, *args, **kw):
-
- from Products.CMFCore.PortalContent import 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 ICatalogableDublinCore
+ from Products.CMFCore.interfaces import IDublinCore
+ from Products.CMFCore.interfaces import IMutableDublinCore
from Products.CMFDefault.DublinCore import DefaultDublinCoreImpl
- class DummyContent(PortalContent, DefaultDublinCoreImpl):
- pass
-
- return DummyContent(id, *args, **kw)
+ verifyClass(ICatalogableDublinCore, DefaultDublinCoreImpl)
+ verifyClass(IDublinCore, DefaultDublinCoreImpl)
+ verifyClass(IMutableDublinCore, DefaultDublinCoreImpl)
def test_notifyModified(self):
site = DummySite('site').__of__(self.root)
@@ -174,8 +203,8 @@
# Finally, verify that display has not changed.
new_DC = getattr(item, dc_methodname)()
self.assertEqual(orig_DC, new_DC)
-
-
+
+
def test_suite():
return TestSuite((
makeSuite( DublinCoreTests ),
=== Products/CMFDefault/tests/test_MembershipTool.py 1.12 => 1.12.8.1 ===
--- Products/CMFDefault/tests/test_MembershipTool.py:1.12 Mon Apr 26 08:14:18 2004
+++ Products/CMFDefault/tests/test_MembershipTool.py Wed Jun 15 06:14:30 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 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
@@ -12,14 +28,42 @@
from Products.CMFCore.tests.base.dummy import DummyTool
from Products.CMFCore.tests.base.dummy import DummyUserFolder
from Products.CMFCore.tests.base.testcase import SecurityTest
-from Products.CMFDefault.MembershipTool import MembershipTool
class MembershipToolTests(TestCase):
+ def _makeOne(self, *args, **kw):
+ from Products.CMFDefault.MembershipTool import MembershipTool
+
+ return MembershipTool(*args, **kw)
+
def setUp(self):
self.site = DummySite('site')
- self.site._setObject( 'portal_membership', MembershipTool() )
+ self.site._setObject( 'portal_membership', self._makeOne() )
+
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.interfaces.portal_actions \
+ import ActionProvider as IActionProvider
+ from Products.CMFDefault.interfaces.portal_membership \
+ import portal_membership as IMembershipTool
+ from Products.CMFDefault.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.CMFDefault.interfaces import IMembershipTool
+ from Products.CMFDefault.MembershipTool import MembershipTool
+
+ verifyClass(IActionProvider, MembershipTool)
+ verifyClass(IMembershipTool, MembershipTool)
def test_MembersFolder_methods(self):
mtool = self.site.portal_membership
@@ -33,22 +77,18 @@
mtool.setMembersFolderById()
self.assertEqual( mtool.getMembersFolder(), None )
- def test_interface(self):
- from Products.CMFDefault.interfaces.portal_membership \
- import portal_membership as IMembershipTool
- from Products.CMFCore.interfaces.portal_actions \
- import ActionProvider as IActionProvider
- verifyClass(IMembershipTool, MembershipTool)
- verifyClass(IActionProvider, MembershipTool)
+class MembershipToolSecurityTests(SecurityTest):
+ def _makeOne(self, *args, **kw):
+ from Products.CMFDefault.MembershipTool import MembershipTool
-class MembershipToolSecurityTests(SecurityTest):
+ 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_createMemberArea(self):
mtool = self.site.portal_membership
=== Products/CMFDefault/tests/test_MetadataTool.py 1.11 => 1.11.2.1 ===
--- Products/CMFDefault/tests/test_MetadataTool.py:1.11 Tue Jul 20 02:11:38 2004
+++ Products/CMFDefault/tests/test_MetadataTool.py Wed Jun 15 06:14:30 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 MetadataTool module.
+
+$Id$
+"""
+
from unittest import TestCase, TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
-from Interface.Verify import verifyClass
from Acquisition import aq_base
@@ -110,6 +126,28 @@
def tearDown( self ):
del self.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_metadata \
+ import portal_metadata as IMetadataTool
+
+ verifyClass(IActionProvider, MetadataTool)
+ verifyClass(IMetadataTool, MetadataTool)
+
+ 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 IMetadataTool
+
+ verifyClass(IActionProvider, MetadataTool)
+ verifyClass(IMetadataTool, MetadataTool)
+
def test_empty( self ):
assert not self.tool.getPublisher()
@@ -366,15 +404,6 @@
foo.setTitle( 'Foo title' )
self.tool.validateMetadata( foo )
-
- def test_interface(self):
- from Products.CMFCore.interfaces.portal_metadata \
- import portal_metadata as IMetadataTool
- from Products.CMFCore.interfaces.portal_actions \
- import ActionProvider as IActionProvider
-
- verifyClass(IMetadataTool, MetadataTool)
- verifyClass(IActionProvider, MetadataTool)
def test_suite():
=== Products/CMFDefault/tests/test_NewsItem.py 1.12 => 1.12.2.1 ===
--- Products/CMFDefault/tests/test_NewsItem.py:1.12 Thu Aug 12 11:07:41 2004
+++ Products/CMFDefault/tests/test_NewsItem.py Wed Jun 15 06:14:30 2005
@@ -19,13 +19,11 @@
import Testing
import Zope
Zope.startup()
-from Interface.Verify import verifyClass
from Products.CMFCore.tests.base.content import BASIC_HTML
from Products.CMFCore.tests.base.content import BASIC_STRUCTUREDTEXT
from Products.CMFCore.tests.base.content import DOCTYPE
from Products.CMFCore.tests.base.content import ENTITY_IN_TITLE
-from Products.CMFCore.tests.base.dummy import DummySite
from Products.CMFCore.tests.base.dummy import DummyTool
from Products.CMFCore.tests.base.testcase import RequestTest
@@ -37,6 +35,45 @@
return NewsItem(id, *args, **kw)
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.interfaces.Contentish \
+ import Contentish as IContentish
+ from Products.CMFCore.interfaces.DublinCore \
+ import CatalogableDublinCore as ICatalogableDublinCore
+ from Products.CMFCore.interfaces.DublinCore \
+ import DublinCore as IDublinCore
+ from Products.CMFCore.interfaces.DublinCore \
+ import MutableDublinCore as IMutableDublinCore
+ from Products.CMFCore.interfaces.Dynamic \
+ import DynamicType as IDynamicType
+ from Products.CMFDefault.NewsItem import NewsItem
+
+ verifyClass(ICatalogableDublinCore, NewsItem)
+ verifyClass(IContentish, NewsItem)
+ verifyClass(IDublinCore, NewsItem)
+ verifyClass(IDynamicType, NewsItem)
+ verifyClass(IMutableDublinCore, NewsItem)
+
+ def test_z3interfaces(self):
+ try:
+ from zope.interface.verify import verifyClass
+ except ImportError:
+ # BBB: for Zope 2.7
+ return
+ from Products.CMFCore.interfaces import ICatalogableDublinCore
+ from Products.CMFCore.interfaces import IContentish
+ from Products.CMFCore.interfaces import IDublinCore
+ from Products.CMFCore.interfaces import IDynamicType
+ from Products.CMFCore.interfaces import IMutableDublinCore
+ from Products.CMFDefault.NewsItem import NewsItem
+
+ verifyClass(ICatalogableDublinCore, NewsItem)
+ verifyClass(IContentish, NewsItem)
+ verifyClass(IDublinCore, NewsItem)
+ verifyClass(IDynamicType, NewsItem)
+ verifyClass(IMutableDublinCore, NewsItem)
+
def test_Empty_html(self):
d = self._makeOne('empty', text_format='html')
@@ -70,25 +107,6 @@
self.assertEqual( d.Format(), 'text/plain' )
self.assertEqual( d.text_format, 'structured-text' )
-
- def test_interface(self):
- from Products.CMFCore.interfaces.Dynamic \
- import DynamicType as IDynamicType
- from Products.CMFCore.interfaces.Contentish \
- import Contentish as IContentish
- from Products.CMFCore.interfaces.DublinCore \
- import DublinCore as IDublinCore
- from Products.CMFCore.interfaces.DublinCore \
- import CatalogableDublinCore as ICatalogableDublinCore
- from Products.CMFCore.interfaces.DublinCore \
- import MutableDublinCore as IMutableDublinCore
- from Products.CMFDefault.NewsItem import NewsItem
-
- verifyClass(IDynamicType, NewsItem)
- verifyClass(IContentish, NewsItem)
- verifyClass(IDublinCore, NewsItem)
- verifyClass(ICatalogableDublinCore, NewsItem)
- verifyClass(IMutableDublinCore, NewsItem)
class NewsItemPUTTests(RequestTest):
=== Products/CMFDefault/tests/test_PropertiesTool.py 1.4 => 1.4.8.1 ===
--- Products/CMFDefault/tests/test_PropertiesTool.py:1.4 Mon Apr 26 08:14:18 2004
+++ Products/CMFDefault/tests/test_PropertiesTool.py Wed Jun 15 06:14:30 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 PropertiesTool module.
+
+$Id$
+"""
+
from unittest import TestCase, TestSuite, makeSuite, main
import Testing
import Zope
Zope.startup()
-from Interface.Verify import verifyClass
-
-from Products.CMFDefault.PropertiesTool import PropertiesTool
class PropertiesToolTests(TestCase):
- def test_interface(self):
- from Products.CMFCore.interfaces.portal_properties \
- import portal_properties as IPropertiesTool
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
from Products.CMFCore.interfaces.portal_actions \
import ActionProvider as IActionProvider
+ from Products.CMFCore.interfaces.portal_properties \
+ import portal_properties as IPropertiesTool
+ from Products.CMFDefault.PropertiesTool import PropertiesTool
+ verifyClass(IActionProvider, PropertiesTool)
verifyClass(IPropertiesTool, PropertiesTool)
+
+ 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 IPropertiesTool
+ from Products.CMFDefault.PropertiesTool import PropertiesTool
+
verifyClass(IActionProvider, PropertiesTool)
+ verifyClass(IPropertiesTool, PropertiesTool)
def test_suite():
=== Products/CMFDefault/tests/test_RegistrationTool.py 1.5.6.2 => 1.5.6.3 ===
--- Products/CMFDefault/tests/test_RegistrationTool.py:1.5.6.2 Mon Mar 7 16:50:28 2005
+++ Products/CMFDefault/tests/test_RegistrationTool.py Wed Jun 15 06:14:30 2005
@@ -1,35 +1,65 @@
-import unittest
-from Products.CMFCore.tests.base.testcase import RequestTest
+##############################################################################
+#
+# 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$
+"""
+import unittest
import Testing
import Zope
Zope.startup()
+from Products.CMFCore.tests.base.testcase import RequestTest
+
+
class FauxMembershipTool:
def getMemberById( self, username ):
return None
+
class RegistrationToolTests(RequestTest):
def _getTargetClass(self):
-
from Products.CMFDefault.RegistrationTool import RegistrationTool
+
return RegistrationTool
def _makeOne(self, *args, **kw):
-
return self._getTargetClass()(*args, **kw)
- 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 Interface.Verify import verifyClass
+ from Products.CMFCore.interfaces.portal_registration \
+ import portal_registration as IRegistrationTool
+ verifyClass(IActionProvider, self._getTargetClass())
verifyClass(IRegistrationTool, self._getTargetClass())
+
+ 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
+
verifyClass(IActionProvider, self._getTargetClass())
+ verifyClass(IRegistrationTool, self._getTargetClass())
def test_testPropertiesValidity_email_with_plus( self ):
More information about the CMF-checkins
mailing list