[CMF-checkins] CVS: CMF/CMFDefault/tests -
test_DiscussionTool.py:1.3 test_MetadataTool.py:1.7
test_Portal.py:1.4 test_PropertiesTool.py:1.3
test_RegistrationTool.py:1.3 test_join.py:1.10
Yvo Schubbe
schubbe at web.de
Fri Jan 2 07:56:01 EST 2004
Update of /cvs-repository/CMF/CMFDefault/tests
In directory cvs.zope.org:/tmp/cvs-serv25181/CMFDefault/tests
Modified Files:
test_DiscussionTool.py test_MetadataTool.py test_Portal.py
test_PropertiesTool.py test_RegistrationTool.py test_join.py
Log Message:
- all CMFCore and CMFDefault tests can now be run by themselves (part of Collector #131)
=== CMF/CMFDefault/tests/test_DiscussionTool.py 1.2 => 1.3 ===
--- CMF/CMFDefault/tests/test_DiscussionTool.py:1.2 Mon Jan 6 16:06:35 2003
+++ CMF/CMFDefault/tests/test_DiscussionTool.py Fri Jan 2 07:55:59 2004
@@ -1,6 +1,12 @@
from unittest import TestCase, TestSuite, makeSuite, main
+import Testing
import Zope
+try:
+ Zope.startup()
+except AttributeError:
+ # for Zope versions before 2.6.1
+ pass
try:
from Interface.Verify import verifyClass
except ImportError:
=== CMF/CMFDefault/tests/test_MetadataTool.py 1.6 => 1.7 ===
--- CMF/CMFDefault/tests/test_MetadataTool.py:1.6 Mon Jan 6 15:43:20 2003
+++ CMF/CMFDefault/tests/test_MetadataTool.py Fri Jan 2 07:55:59 2004
@@ -1,18 +1,27 @@
from unittest import TestCase, TestSuite, makeSuite, main
+import Testing
import Zope
-from Acquisition import aq_base
+try:
+ Zope.startup()
+except AttributeError:
+ # for Zope versions before 2.6.1
+ pass
try:
from Interface.Verify import verifyClass
except ImportError:
# for Zope versions before 2.6.0
from Interface import verify_class_implementation as verifyClass
-from Products.CMFDefault.MetadataTool import \
- MetadataElementPolicy, MetadataTool, ElementSpec, \
- DEFAULT_ELEMENT_SPECS, MetadataError
+from Acquisition import aq_base
from Products.CMFDefault.DublinCore import DefaultDublinCoreImpl
+from Products.CMFDefault.MetadataTool import DEFAULT_ELEMENT_SPECS
+from Products.CMFDefault.MetadataTool import ElementSpec
+from Products.CMFDefault.MetadataTool import MetadataElementPolicy
+from Products.CMFDefault.MetadataTool import MetadataError
+from Products.CMFDefault.MetadataTool import MetadataTool
+
class TestMetadataElementPolicy( TestCase ):
@@ -83,6 +92,7 @@
assert len( policies ) == 1
assert policies[0][0] is None
+
class Foo( DefaultDublinCoreImpl ):
description = title = language = format = rights = ''
@@ -94,11 +104,13 @@
def getPortalTypeName( self ):
return 'Foo'
+
class Bar( Foo ):
def getPortalTypeName( self ):
return 'Bar'
+
class TestMetadataTool( TestCase ):
def setUp( self ):
@@ -137,7 +149,7 @@
pass
else:
assert 0, "Expected KeyError"
-
+
assert not self.tool.listAllowedSubjects()
assert not self.tool.listAllowedFormats()
assert not self.tool.listAllowedLanguages()
@@ -270,7 +282,7 @@
formats = ( 'text/plain', 'text/html' )
fDef.edit( 0, 0, '', 0, ( 'text/plain', 'text/html' ) )
assert self.tool.listAllowedFormats() == formats
-
+
foo = Foo()
assert self.tool.listAllowedFormats( foo ) == formats
fSpec.addPolicy( 'Foo' )
=== CMF/CMFDefault/tests/test_Portal.py 1.3 => 1.4 ===
--- CMF/CMFDefault/tests/test_Portal.py:1.3 Tue Jul 23 14:38:36 2002
+++ CMF/CMFDefault/tests/test_Portal.py Fri Jan 2 07:55:59 2004
@@ -1,28 +1,34 @@
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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 / functional tests for a CMFSite.
$Id$
"""
-import unittest
+from unittest import TestSuite, makeSuite, main
+
+import Testing
+import Zope
+try:
+ Zope.startup()
+except AttributeError:
+ # for Zope versions before 2.6.1
+ pass
-import Zope # product initialization
+from Acquisition import aq_base
from Products.CMFCore.tests.base.testcase import SecurityRequestTest
-from Acquisition import aq_base
class CMFSiteTests( SecurityRequestTest ):
@@ -170,15 +176,11 @@
md = catalog.getMetadataForRID( rid )
return md[ field ]
-def test_suite():
-
- suite = unittest.TestSuite()
-
- suite.addTest( unittest.makeSuite( CMFSiteTests ) )
-
- return suite
+def test_suite():
+ return TestSuite((
+ makeSuite(CMFSiteTests),
+ ))
if __name__ == '__main__':
-
- unittest.main( defaultTest = 'test_suite' )
+ main(defaultTest='test_suite')
=== CMF/CMFDefault/tests/test_PropertiesTool.py 1.2 => 1.3 ===
--- CMF/CMFDefault/tests/test_PropertiesTool.py:1.2 Mon Jan 6 16:07:16 2003
+++ CMF/CMFDefault/tests/test_PropertiesTool.py Fri Jan 2 07:55:59 2004
@@ -1,6 +1,12 @@
from unittest import TestCase, TestSuite, makeSuite, main
+import Testing
import Zope
+try:
+ Zope.startup()
+except AttributeError:
+ # for Zope versions before 2.6.1
+ pass
try:
from Interface.Verify import verifyClass
except ImportError:
=== CMF/CMFDefault/tests/test_RegistrationTool.py 1.2 => 1.3 ===
--- CMF/CMFDefault/tests/test_RegistrationTool.py:1.2 Mon Jan 6 16:07:26 2003
+++ CMF/CMFDefault/tests/test_RegistrationTool.py Fri Jan 2 07:55:59 2004
@@ -1,6 +1,12 @@
from unittest import TestCase, TestSuite, makeSuite, main
+import Testing
import Zope
+try:
+ Zope.startup()
+except AttributeError:
+ # for Zope versions before 2.6.1
+ pass
try:
from Interface.Verify import verifyClass
except ImportError:
=== CMF/CMFDefault/tests/test_join.py 1.9 => 1.10 ===
--- CMF/CMFDefault/tests/test_join.py:1.9 Mon Jun 2 12:18:50 2003
+++ CMF/CMFDefault/tests/test_join.py Fri Jan 2 07:55:59 2004
@@ -1,5 +1,6 @@
from unittest import TestSuite, makeSuite, main
+import Testing
import Zope
try:
Zope.startup()
@@ -9,6 +10,7 @@
from Products.CMFCore.tests.base.testcase import TransactionalTest
+
class MembershipTests( TransactionalTest ):
def test_join( self ):
@@ -33,6 +35,7 @@
'zzyyzz',
properties={'username':'test_user', 'email': ''}
)
+
def test_suite():
return TestSuite((
More information about the CMF-checkins
mailing list