[CMF-checkins] SVN: CMF/trunk/CMFDefault/tests/test_ hardened tests that depend on a correct adapter setup

Yvo Schubbe y.2005- at wcm-solutions.de
Wed Oct 12 04:34:59 EDT 2005


Log message for revision 39089:
  hardened tests that depend on a correct adapter setup

Changed:
  U   CMF/trunk/CMFDefault/tests/test_DiscussionReply.py
  U   CMF/trunk/CMFDefault/tests/test_Image.py
  U   CMF/trunk/CMFDefault/tests/test_Portal.py

-=-
Modified: CMF/trunk/CMFDefault/tests/test_DiscussionReply.py
===================================================================
--- CMF/trunk/CMFDefault/tests/test_DiscussionReply.py	2005-10-12 08:31:29 UTC (rev 39088)
+++ CMF/trunk/CMFDefault/tests/test_DiscussionReply.py	2005-10-12 08:34:59 UTC (rev 39089)
@@ -14,22 +14,29 @@
 
 $Id$
 """
+
 from unittest import TestSuite, makeSuite, main
-
 import Testing
 import Zope2
 Zope2.startup()
 
+import Products
 from AccessControl.SecurityManagement import newSecurityManager
 from AccessControl.SecurityManagement import noSecurityManager
+from Products.Five import zcml
+from zope.app.tests.placelesssetup import PlacelessSetup
 
 from Products.CMFCore.tests.base.testcase import RequestTest
 
 
-class DiscussionReplyTest(RequestTest):
+class DiscussionReplyTest(PlacelessSetup, RequestTest):
 
     def setUp(self):
+        PlacelessSetup.setUp(self)
         RequestTest.setUp(self)
+        zcml.load_config('meta.zcml', Products.Five)
+        zcml.load_config('configure.zcml', Products.GenericSetup)
+        zcml.load_config('configure.zcml', Products.CMFCore)
         try:
             factory = self.root.manage_addProduct['CMFDefault'].addConfiguredSite
             factory('cmf', 'CMFDefault:default', snapshot=False)
@@ -52,6 +59,7 @@
     def tearDown(self):
         noSecurityManager()
         RequestTest.tearDown(self)
+        PlacelessSetup.tearDown(self)
 
     def login(self, name):
         user = self.uf.getUserById(name)

Modified: CMF/trunk/CMFDefault/tests/test_Image.py
===================================================================
--- CMF/trunk/CMFDefault/tests/test_Image.py	2005-10-12 08:31:29 UTC (rev 39088)
+++ CMF/trunk/CMFDefault/tests/test_Image.py	2005-10-12 08:34:59 UTC (rev 39089)
@@ -23,10 +23,13 @@
 from os.path import join as path_join
 from cStringIO import StringIO
 
+import Products
+import transaction
 from AccessControl.SecurityManagement import newSecurityManager
 from AccessControl.SecurityManagement import noSecurityManager
 from AccessControl.User import UnrestrictedUser
-import transaction
+from Products.Five import zcml
+from zope.app.tests.placelesssetup import PlacelessSetup
 
 from Products.CMFCore.tests.base.dummy import DummySite
 from Products.CMFCore.tests.base.dummy import DummyTool
@@ -103,13 +106,17 @@
         self.assertEqual(file.content_type, 'image/jpeg')
 
 
-class TestImageCopyPaste(RequestTest):
+class TestImageCopyPaste(PlacelessSetup, RequestTest):
 
     # Tests related to http://www.zope.org/Collectors/CMF/176
     # Copy/pasting an image (or file) should reset the object's workflow state.
 
     def setUp(self):
+        PlacelessSetup.setUp(self)
         RequestTest.setUp(self)
+        zcml.load_config('meta.zcml', Products.Five)
+        zcml.load_config('configure.zcml', Products.GenericSetup)
+        zcml.load_config('configure.zcml', Products.CMFCore)
         try:
             newSecurityManager(None, UnrestrictedUser('manager', '', ['Manager'], []))
             factory = self.root.manage_addProduct['CMFDefault'].addConfiguredSite
@@ -130,6 +137,7 @@
     def tearDown(self):
         noSecurityManager()
         RequestTest.tearDown(self)
+        PlacelessSetup.tearDown(self)
 
     def test_File_CopyPasteResetsWorkflowState(self):
         # Copy/pasting a File should reset wf state to private

Modified: CMF/trunk/CMFDefault/tests/test_Portal.py
===================================================================
--- CMF/trunk/CMFDefault/tests/test_Portal.py	2005-10-12 08:31:29 UTC (rev 39088)
+++ CMF/trunk/CMFDefault/tests/test_Portal.py	2005-10-12 08:34:59 UTC (rev 39089)
@@ -20,12 +20,15 @@
 import Zope2
 Zope2.startup()
 
+import Products
 from Acquisition import aq_base
+from Products.Five import zcml
+from zope.app.tests.placelesssetup import PlacelessSetup
 
 from Products.CMFCore.tests.base.testcase import SecurityRequestTest
 
 
-class CMFSiteTests( SecurityRequestTest ):
+class CMFSiteTests(PlacelessSetup, SecurityRequestTest):
 
     def _makeSite( self, id='testsite' ):
 
@@ -44,6 +47,17 @@
 
         return content
 
+    def setUp(self):
+        PlacelessSetup.setUp(self)
+        SecurityRequestTest.setUp(self)
+        zcml.load_config('meta.zcml', Products.Five)
+        zcml.load_config('configure.zcml', Products.GenericSetup)
+        zcml.load_config('configure.zcml', Products.CMFCore)
+
+    def tearDown(self):
+        SecurityRequestTest.tearDown(self)
+        PlacelessSetup.tearDown(self)
+
     def test_new( self ):
 
         site = self._makeSite()



More information about the CMF-checkins mailing list