[CMF-checkins] SVN: CMF/branches/1.6/CMF - made sure tests don't break if five:traversable is set for PortalContent

Yvo Schubbe y.2005- at wcm-solutions.de
Thu Dec 1 11:56:14 EST 2005


Log message for revision 40450:
  - made sure tests don't break if five:traversable is set for PortalContent

Changed:
  U   CMF/branches/1.6/CMFCore/tests/base/testcase.py
  U   CMF/branches/1.6/CMFCore/tests/test_ActionInformation.py
  U   CMF/branches/1.6/CMFCore/tests/test_CachingPolicyManager.py
  U   CMF/branches/1.6/CMFCore/tests/test_TypesTool.py
  U   CMF/branches/1.6/CMFDefault/tests/test_DiscussionReply.py
  U   CMF/branches/1.6/CMFDefault/tests/test_Document.py

-=-
Modified: CMF/branches/1.6/CMFCore/tests/base/testcase.py
===================================================================
--- CMF/branches/1.6/CMFCore/tests/base/testcase.py	2005-12-01 15:52:26 UTC (rev 40449)
+++ CMF/branches/1.6/CMFCore/tests/base/testcase.py	2005-12-01 16:56:13 UTC (rev 40450)
@@ -1,9 +1,5 @@
 from unittest import TestCase
-try:
-    import Zope2
-except ImportError:
-    # BBB: for Zope 2.7
-    import Zope as Zope2
+import Zope2
 Zope2.startup()
 
 import sys
@@ -19,11 +15,7 @@
 from AccessControl.SecurityManager import setSecurityPolicy
 from Testing.makerequest import makerequest
 import zLOG
-try:
-    import transaction
-except ImportError:
-    # BBB: for Zope 2.7
-    from Products.CMFCore.utils import transaction
+import transaction
 
 from dummy import DummyFolder
 from security import AnonymousUser
@@ -38,6 +30,28 @@
     from zope.app.tests.placelesssetup import setUp as placelessSetUp
     from zope.app.tests.placelesssetup import tearDown as placelessTearDown
 
+_TRAVERSE_ZCML = """
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:five="http://namespaces.zope.org/five"
+    >
+
+  <adapter
+      for="*"
+      factory=".traversable.FiveTraversable"
+      provides="zope.app.traversing.interfaces.ITraversable"
+      />
+
+  <adapter
+      for="*"
+      factory="zope.app.traversing.adapters.Traverser"
+      provides="zope.app.traversing.interfaces.ITraverser"
+      />
+
+</configure>
+"""
+
+
 class LogInterceptor:
 
     _old_log_write = None

Modified: CMF/branches/1.6/CMFCore/tests/test_ActionInformation.py
===================================================================
--- CMF/branches/1.6/CMFCore/tests/test_ActionInformation.py	2005-12-01 15:52:26 UTC (rev 40449)
+++ CMF/branches/1.6/CMFCore/tests/test_ActionInformation.py	2005-12-01 16:56:13 UTC (rev 40450)
@@ -15,15 +15,12 @@
 $Id$
 """
 
-from unittest import TestCase, TestSuite, makeSuite, main
+import unittest
 import Testing
-try:
-    import Zope2
-except ImportError: # BBB: for Zope 2.7
-    import Zope as Zope2
-Zope2.startup()
 
+import Products.Five
 from OFS.Folder import manage_addFolder
+from Products.Five import zcml
 from Products.PythonScripts.PythonScript import manage_addPythonScript
 
 from Products.CMFCore.Expression import createExprContext
@@ -31,11 +28,13 @@
 from Products.CMFCore.tests.base.dummy import DummyContent
 from Products.CMFCore.tests.base.dummy import DummySite
 from Products.CMFCore.tests.base.dummy import DummyTool as DummyMembershipTool
+from Products.CMFCore.tests.base.testcase import _TRAVERSE_ZCML
+from Products.CMFCore.tests.base.testcase import PlacelessSetup
 from Products.CMFCore.tests.base.testcase import SecurityTest
 from Products.CMFCore.tests.base.testcase import TransactionalTest
 
 
-class ActionInfoTests(TestCase):
+class ActionInfoTests(unittest.TestCase):
 
     def _makeOne(self, *args, **kw):
         from Products.CMFCore.ActionInformation import ActionInfo
@@ -51,13 +50,9 @@
         verifyClass(IActionInfo, ActionInfo)
 
     def test_z3interfaces(self):
-        try:
-            from zope.interface.verify import verifyClass
-            from Products.CMFCore.interfaces import IActionInfo
-        except ImportError:
-            # BBB: for Zope 2.7
-            return
+        from zope.interface.verify import verifyClass
         from Products.CMFCore.ActionInformation import ActionInfo
+        from Products.CMFCore.interfaces import IActionInfo
 
         verifyClass(IActionInfo, ActionInfo)
 
@@ -200,7 +195,6 @@
         self.assertEqual( ai['allowed'], WANTED['allowed'] )
 
     def test_copy(self):
-
         action = {'name': 'foo', 'url': '', 'permissions': ('View',)}
         ec = createExprContext(self.site, self.site, None)
         ai = self._makeOne(action, ec)
@@ -213,12 +207,17 @@
         self.assertEqual( ai2['allowed'], True )
 
 
-class ActionInformationTests(TransactionalTest):
+class ActionInformationTests(PlacelessSetup, TransactionalTest):
 
-    def setUp( self ):
+    def setUp(self):
+        import Products.CMFCore
+        PlacelessSetup.setUp(self)
+        TransactionalTest.setUp(self)
+        zcml.load_config('meta.zcml', Products.Five)
+        zcml.load_config('permissions.zcml', Products.Five)
+        zcml.load_config('configure.zcml', Products.CMFCore)
+        zcml.load_string(_TRAVERSE_ZCML)
 
-        TransactionalTest.setUp( self )
-
         root = self.root
         root._setObject('portal', DummyContent('portal', 'url_portal'))
         portal = self.portal = root.portal
@@ -226,6 +225,10 @@
         self.folder = DummyContent('foo', 'url_foo')
         self.object = DummyContent('bar', 'url_bar')
 
+    def tearDown(self):
+        TransactionalTest.tearDown(self)
+        PlacelessSetup.tearDown(self)
+
     def _makeOne(self, *args, **kw):
         from Products.CMFCore.ActionInformation import ActionInformation
 
@@ -314,11 +317,11 @@
 
 
 def test_suite():
-    return TestSuite((
-        makeSuite(ActionInfoTests),
-        makeSuite(ActionInfoSecurityTests),
-        makeSuite(ActionInformationTests),
+    return unittest.TestSuite((
+        unittest.makeSuite(ActionInfoTests),
+        unittest.makeSuite(ActionInfoSecurityTests),
+        unittest.makeSuite(ActionInformationTests),
         ))
 
 if __name__ == '__main__':
-    main(defaultTest='test_suite')
+    unittest.main(defaultTest='test_suite')

Modified: CMF/branches/1.6/CMFCore/tests/test_CachingPolicyManager.py
===================================================================
--- CMF/branches/1.6/CMFCore/tests/test_CachingPolicyManager.py	2005-12-01 15:52:26 UTC (rev 40449)
+++ CMF/branches/1.6/CMFCore/tests/test_CachingPolicyManager.py	2005-12-01 16:56:13 UTC (rev 40450)
@@ -14,32 +14,29 @@
 
 $Id$
 """
+
+import unittest
+import Testing
+
 import base64
 import os
 
-from unittest import TestCase, TestSuite, makeSuite, main
-import Testing
-try:
-    import Zope2
-except ImportError: # BBB: for Zope 2.7
-    import Zope as Zope2
-Zope2.startup()
-
+import Products.Five
+from AccessControl.SecurityManagement import newSecurityManager
 from App.Common import rfc1123_date
 from DateTime.DateTime import DateTime
-from AccessControl.SecurityManagement import newSecurityManager
+from Products.Five import zcml
 
-from Products.CMFCore.tests.base.testcase import RequestTest
-from Products.CMFCore.tests.base.testcase import FSDVTest
-from Products.CMFCore.tests.test_FSPageTemplate import FSPTMaker
+from Products.CMFCore.FSPageTemplate import FSPageTemplate
+from Products.CMFCore.tests.base.dummy import DummyContent
 from Products.CMFCore.tests.base.dummy import DummySite
+from Products.CMFCore.tests.base.dummy import DummyTool
 from Products.CMFCore.tests.base.dummy import DummyUserFolder
-from Products.CMFCore.tests.base.dummy import DummyContent
-from Products.CMFCore.tests.base.dummy import DummyTool
-from Products.CMFCore.FSPageTemplate import FSPageTemplate
-from Products.CMFCore import CachingPolicyManager
+from Products.CMFCore.tests.base.testcase import _TRAVERSE_ZCML
+from Products.CMFCore.tests.base.testcase import FSDVTest
+from Products.CMFCore.tests.base.testcase import PlacelessSetup
+from Products.CMFCore.tests.base.testcase import RequestTest
 
-
 ACCLARK = DateTime( '2001/01/01' )
 portal_owner = 'portal_owner'
 
@@ -58,7 +55,7 @@
         return self.modified
 
 
-class CachingPolicyTests(TestCase):
+class CachingPolicyTests(unittest.TestCase):
 
     def setUp(self):
         self._epoch = DateTime(0)
@@ -73,6 +70,13 @@
         return createCPContext( DummyContent2(self._epoch)
                               , 'foo_view', kw, self._epoch )
 
+    def test_z3interfaces(self):
+        from zope.interface.verify import verifyClass
+        from Products.CMFCore.CachingPolicyManager import CachingPolicy
+        from Products.CMFCore.interfaces import ICachingPolicy
+
+        verifyClass(ICachingPolicy, CachingPolicy)
+
     def test_empty( self ):
         policy = self._makePolicy( 'empty' )
         context = self._makeContext()
@@ -384,7 +388,7 @@
         self.assertEqual( headers[2][1] , 'no-cache, no-store' )
 
 
-class CachingPolicyManagerTests(TestCase):
+class CachingPolicyManagerTests(unittest.TestCase):
 
     def _makeOne(self, *args, **kw):
         from Products.CMFCore.CachingPolicyManager import CachingPolicyManager
@@ -407,13 +411,9 @@
         verifyClass(ICachingPolicyManager, CachingPolicyManager)
 
     def test_z3interfaces(self):
-        try:
-            from zope.interface.verify import verifyClass
-            from Products.CMFCore.interfaces import ICachingPolicyManager
-        except ImportError:
-            # BBB: for Zope 2.7
-            return
+        from zope.interface.verify import verifyClass
         from Products.CMFCore.CachingPolicyManager import CachingPolicyManager
+        from Products.CMFCore.interfaces import ICachingPolicyManager
 
         verifyClass(ICachingPolicyManager, CachingPolicyManager)
 
@@ -429,15 +429,17 @@
                                            )
         self.assertEqual( len( headers ), 0 )
 
-        self.assertRaises( KeyError, mgr._updatePolicy
-                         , 'xyzzy', None, None, None, None, None, None, '', '', None, None, None, None, None )
+        self.assertRaises( KeyError, mgr._updatePolicy,
+                           'xyzzy', None, None, None, None, None, None, '',
+                           '', None, None, None, None, None )
         self.assertRaises( KeyError, mgr._removePolicy, 'xyzzy' )
         self.assertRaises( KeyError, mgr._reorderPolicy, 'xyzzy', -1 )
 
     def test_addAndUpdatePolicy( self ):
 
         mgr = self._makeOne()
-        mgr.addPolicy( 'first', 'python:1', 'mtime', 1, 0, 1, 0, 'vary', 'etag', None, 2, 1, 0, 1, 0, 1, 0, 2, 3 )
+        mgr.addPolicy('first', 'python:1', 'mtime', 1, 0, 1, 0, 'vary',
+                      'etag', None, 2, 1, 0, 1, 0, 1, 0, 2, 3)
         p = mgr._policies['first']
         self.assertEqual(p.getPolicyId(), 'first')
         self.assertEqual(p.getPredicate(), 'python:1')
@@ -458,7 +460,8 @@
         self.assertEqual(p.getPreCheck(), 2)
         self.assertEqual(p.getPostCheck(), 3)
         
-        mgr.updatePolicy( 'first', 'python:0', 'mtime2', 2, 1, 0, 1, 'vary2', 'etag2', None, 1, 0, 1, 0, 1, 0, 1, 3, 2 )
+        mgr.updatePolicy('first', 'python:0', 'mtime2', 2, 1, 0, 1, 'vary2',
+                         'etag2', None, 1, 0, 1, 0, 1, 0, 1, 3, 2)
         p = mgr._policies['first']
         self.assertEqual(p.getPolicyId(), 'first')
         self.assertEqual(p.getPredicate(), 'python:0')
@@ -599,11 +602,18 @@
         self.assertEqual( headers[2][1] , 'max-age=86400' )
 
 
-class CachingPolicyManager304Tests(RequestTest, FSDVTest):
+class CachingPolicyManager304Tests(PlacelessSetup, RequestTest, FSDVTest):
 
     def setUp(self):
+        from Products.CMFCore import CachingPolicyManager
+
+        PlacelessSetup.setUp(self)
         RequestTest.setUp(self)
         FSDVTest.setUp(self)
+        zcml.load_config('meta.zcml', Products.Five)
+        zcml.load_config('permissions.zcml', Products.Five)
+        zcml.load_config('configure.zcml', Products.CMFCore)
+        zcml.load_string(_TRAVERSE_ZCML)
 
         now = DateTime()
 
@@ -675,12 +685,11 @@
                       etag_func = 'string:abc',
                       enable_304s = 0)
 
-
     def tearDown(self):
         RequestTest.tearDown(self)
         FSDVTest.tearDown(self)
+        PlacelessSetup.tearDown(self)
 
-
     def _cleanup(self):
         # Clean up request and response
         req = self.portal.REQUEST
@@ -694,7 +703,6 @@
 
         req.RESPONSE.setStatus(200)
 
-
     def testUnconditionalGET(self):
         # In this case the Request does not specify any if-modified-since
         # value to take into account, thereby completely circumventing any
@@ -704,7 +712,6 @@
         response = self.portal.REQUEST.RESPONSE
         self.assertEqual(response.getStatus(), 200)
 
-
     def testConditionalGETNoETag(self):
         yesterday = DateTime() - 1
         doc1 = self.portal.doc1
@@ -744,7 +751,6 @@
         self.assertEqual(response.getStatus(), 200)
         self._cleanup()
 
-
     def testConditionalGETETag(self):
         yesterday = DateTime() - 1
         doc2 = self.portal.doc2
@@ -814,7 +820,6 @@
         doc2()
         self.assertEqual(response.getStatus(), 304)
         self._cleanup()
-
         
     def testConditionalGETDisabled(self):
         yesterday = DateTime() - 1
@@ -842,12 +847,11 @@
 
         
 def test_suite():
-    return TestSuite((
-        makeSuite(CachingPolicyTests),
-        makeSuite(CachingPolicyManagerTests),
-        makeSuite(CachingPolicyManager304Tests),
+    return unittest.TestSuite((
+        unittest.makeSuite(CachingPolicyTests),
+        unittest.makeSuite(CachingPolicyManagerTests),
+        unittest.makeSuite(CachingPolicyManager304Tests),
         ))
 
 if __name__ == '__main__':
-    main(defaultTest='test_suite')
-
+    unittest.main(defaultTest='test_suite')

Modified: CMF/branches/1.6/CMFCore/tests/test_TypesTool.py
===================================================================
--- CMF/branches/1.6/CMFCore/tests/test_TypesTool.py	2005-12-01 15:52:26 UTC (rev 40449)
+++ CMF/branches/1.6/CMFCore/tests/test_TypesTool.py	2005-12-01 16:56:13 UTC (rev 40450)
@@ -15,7 +15,7 @@
 $Id$
 """
 
-from unittest import TestCase, TestSuite, makeSuite, main
+import unittest
 import Testing
 
 import Products
@@ -38,6 +38,7 @@
 from Products.CMFCore.tests.base.dummy import DummyUserFolder
 from Products.CMFCore.tests.base.security import OmnipotentUser
 from Products.CMFCore.tests.base.security import UserWithRoles
+from Products.CMFCore.tests.base.testcase import _TRAVERSE_ZCML
 from Products.CMFCore.tests.base.testcase import PlacelessSetup
 from Products.CMFCore.tests.base.testcase import SecurityTest
 from Products.CMFCore.tests.base.testcase import WarningInterceptor
@@ -54,28 +55,6 @@
 from Products.CMFCore.utils import _getViewFor
 
 
-_TRAVERSE_ZCML = """
-<configure
-    xmlns="http://namespaces.zope.org/zope"
-    xmlns:five="http://namespaces.zope.org/five"
-    >
-
-  <adapter
-      for="*"
-      factory=".traversable.FiveTraversable"
-      provides="zope.app.traversing.interfaces.ITraversable"
-      />
-
-  <adapter
-      for="*"
-      factory="zope.app.traversing.adapters.Traverser"
-      provides="zope.app.traversing.interfaces.ITraverser"
-      />
-
-</configure>
-"""
-
-
 class TypesToolTests(PlacelessSetup, SecurityTest, WarningInterceptor):
 
     def _makeOne(self):
@@ -250,7 +229,7 @@
                             self._our_stderr_stream.getvalue())
 
 
-class TypeInfoTests(TestCase, WarningInterceptor):
+class TypeInfoTests(unittest.TestCase, WarningInterceptor):
 
     def _makeTypesTool(self):
         from Products.CMFCore.TypesTool import TypesTool
@@ -599,7 +578,7 @@
         self.assertEqual( ti.constructor_path, 'foo_add' )
 
 
-class FTIConstructionTests(TestCase):
+class FTIConstructionTests(unittest.TestCase):
 
     def setUp( self ):
         noSecurityManager()
@@ -646,7 +625,7 @@
         self.failIf( ti.isConstructionAllowed( folder ) )
 
 
-class FTIConstructionTests_w_Roles(TestCase):
+class FTIConstructionTests_w_Roles(unittest.TestCase):
 
     def tearDown( self ):
         noSecurityManager()
@@ -749,13 +728,13 @@
 
 
 def test_suite():
-    return TestSuite((
-        makeSuite(TypesToolTests),
-        makeSuite(FTIDataTests),
-        makeSuite(STIDataTests),
-        makeSuite(FTIConstructionTests),
-        makeSuite(FTIConstructionTests_w_Roles),
+    return unittest.TestSuite((
+        unittest.makeSuite(TypesToolTests),
+        unittest.makeSuite(FTIDataTests),
+        unittest.makeSuite(STIDataTests),
+        unittest.makeSuite(FTIConstructionTests),
+        unittest.makeSuite(FTIConstructionTests_w_Roles),
         ))
 
 if __name__ == '__main__':
-    main(defaultTest='test_suite')
+    unittest.main(defaultTest='test_suite')

Modified: CMF/branches/1.6/CMFDefault/tests/test_DiscussionReply.py
===================================================================
--- CMF/branches/1.6/CMFDefault/tests/test_DiscussionReply.py	2005-12-01 15:52:26 UTC (rev 40449)
+++ CMF/branches/1.6/CMFDefault/tests/test_DiscussionReply.py	2005-12-01 16:56:13 UTC (rev 40450)
@@ -1,21 +1,29 @@
+##############################################################################
 #
-# Tests for http://zope.org/Collectors/CMF/318
+# 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 http://zope.org/Collectors/CMF/318
 
-from unittest import TestSuite, makeSuite, main
+$Id$
+"""
 
+import unittest
 import Testing
-try:
-    import Zope2
-except ImportError: # BBB: for Zope 2.7
-    import Zope as Zope2
-Zope2.startup()
 
 import Products
 from AccessControl.SecurityManagement import newSecurityManager
 from AccessControl.SecurityManagement import noSecurityManager
 from Products.Five import zcml
 
+from Products.CMFCore.tests.base.testcase import _TRAVERSE_ZCML
 from Products.CMFCore.tests.base.testcase import PlacelessSetup
 from Products.CMFCore.tests.base.testcase import RequestTest
 
@@ -30,6 +38,7 @@
         zcml.load_config('configure.zcml', Products.GenericSetup)
         zcml.load_config('configure.zcml', Products.CMFCore)
         zcml.load_config('configure.zcml', Products.DCWorkflow)
+        zcml.load_string(_TRAVERSE_ZCML)
         try:
             factory = self.root.manage_addProduct['CMFDefault'].addConfiguredSite
             factory('cmf', 'CMFDefault:default', snapshot=False)
@@ -53,7 +62,7 @@
         noSecurityManager()
         RequestTest.tearDown(self)
         PlacelessSetup.tearDown(self)
-        
+
     def login(self, name):
         user = self.uf.getUserById(name)
         user = user.__of__(self.uf)
@@ -83,10 +92,10 @@
 
 
 def test_suite():
-    suite = TestSuite()
-    suite.addTest(makeSuite(DiscussionReplyTest))
-    suite.addTest(makeSuite(DiscussionReplyTestMember))
+    suite = unittest.TestSuite()
+    suite.addTest(unittest.makeSuite(DiscussionReplyTest))
+    suite.addTest(unittest.makeSuite(DiscussionReplyTestMember))
     return suite
 
 if __name__ == '__main__':
-    main(defaultTest='test_suite')
+    unittest.main(defaultTest='test_suite')

Modified: CMF/branches/1.6/CMFDefault/tests/test_Document.py
===================================================================
--- CMF/branches/1.6/CMFDefault/tests/test_Document.py	2005-12-01 15:52:26 UTC (rev 40449)
+++ CMF/branches/1.6/CMFDefault/tests/test_Document.py	2005-12-01 16:56:13 UTC (rev 40450)
@@ -15,13 +15,8 @@
 $Id$
 """
 
-from unittest import TestSuite, makeSuite, main
+import unittest
 import Testing
-try:
-    import Zope2
-except ImportError: # BBB: for Zope 2.7
-    import Zope as Zope2
-Zope2.startup()
 
 from os.path import abspath
 from os.path import dirname
@@ -45,7 +40,6 @@
 from Products.CMFCore.tests.base.content import STX_NO_HEADERS_BUT_COLON
 from Products.CMFCore.tests.base.content import STX_WITH_HTML
 from Products.CMFCore.tests.base.dummy import DummySite
-from Products.CMFCore.tests.base.dummy import DummyTool
 from Products.CMFCore.tests.base.testcase import RequestTest
 from Products.CMFCore.tests.base.tidata import FTIDATA_CMF15
 from Products.CMFCore.TypesTool import FactoryTypeInformation as FTI
@@ -55,17 +49,15 @@
 
 class RequestTestBase(RequestTest):
 
-    def setUp(self):
-        RequestTest.setUp(self)
-        self.site = DummySite('site').__of__(self.root)
-        self.site._setObject( 'portal_membership', DummyTool() )
-
-    def _makeOne(self, id, *args, **kw):
+    def _getTargetClass(self):
         from Products.CMFDefault.Document import Document
 
-        return self.site._setObject( id, Document(id, *args, **kw) )
+        return Document
 
+    def _makeOne(self, *args, **kw):
+        return self._getTargetClass()(*args, **kw)
 
+
 class DocumentTests(RequestTestBase):
 
     def test_z2interfaces(self):
@@ -93,18 +85,14 @@
         verifyClass(IMutableDublinCore, Document)
 
     def test_z3interfaces(self):
-        try:
-            from zope.interface.verify import verifyClass
-            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.interfaces import IDocument
-            from Products.CMFDefault.interfaces import IMutableDocument
-        except ImportError:
-            # BBB: for Zope 2.7
-            return
+        from zope.interface.verify import verifyClass
+        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.interfaces import IDocument
+        from Products.CMFDefault.interfaces import IMutableDocument
         from Products.CMFDefault.Document import Document
 
         verifyClass(ICatalogableDublinCore, Document)
@@ -412,6 +400,10 @@
 
 class DocumentFTPGetTests(RequestTestBase):
 
+    def setUp(self):
+        RequestTest.setUp(self)
+        self.site = DummySite('site').__of__(self.root)
+
     def testHTML( self ):
         self.REQUEST['BODY']=BASIC_HTML
 
@@ -506,14 +498,8 @@
             self.failUnless( header in get_headers )
 
 
-class DocumentPUTTests(RequestTest):
+class DocumentPUTTests(RequestTestBase):
 
-    def _makeOne(self, id, *args, **kw):
-        from Products.CMFDefault.Document import Document
-
-        # NullResource.PUT calls the PUT method on the bare object!
-        return Document(id, *args, **kw)
-
     def test_PUTBasicHTML(self):
         self.REQUEST['BODY'] = BASIC_HTML
         d = self._makeOne('foo')
@@ -595,11 +581,11 @@
 
 
 def test_suite():
-    return TestSuite((
-        makeSuite(DocumentTests),
-        makeSuite(DocumentFTPGetTests),
-        makeSuite(DocumentPUTTests),
+    return unittest.TestSuite((
+        unittest.makeSuite(DocumentTests),
+        unittest.makeSuite(DocumentFTPGetTests),
+        unittest.makeSuite(DocumentPUTTests),
         ))
 
 if __name__ == '__main__':
-    main(defaultTest='test_suite')
+    unittest.main(defaultTest='test_suite')



More information about the CMF-checkins mailing list