[CMF-checkins] SVN: CMF/trunk/CMFC - removed redundant makerequest (ZopeTestCase.app() already has a request)

Yvo Schubbe y.2006_ at wcm-solutions.de
Tue Nov 7 04:33:04 EST 2006


Log message for revision 71091:
  - removed redundant makerequest (ZopeTestCase.app() already has a request)
  
  RequestTest and SecurityRequestTest are now simple aliases for TransactionalTest and SecurityTest

Changed:
  U   CMF/trunk/CMFCalendar/tests/test_Calendar.py
  U   CMF/trunk/CMFCore/tests/base/testcase.py

-=-
Modified: CMF/trunk/CMFCalendar/tests/test_Calendar.py
===================================================================
--- CMF/trunk/CMFCalendar/tests/test_Calendar.py	2006-11-06 15:49:14 UTC (rev 71090)
+++ CMF/trunk/CMFCalendar/tests/test_Calendar.py	2006-11-07 09:33:02 UTC (rev 71091)
@@ -116,8 +116,7 @@
     def setUp(self):
         self._oldSkindata = Skinnable.SKINDATA.copy()
         transaction.begin()
-
-        app = self.app = ZopeTestCase.utils.makerequest(ZopeTestCase.app())
+        app = self.app = ZopeTestCase.app()
         # Log in as a god :-)
         newSecurityManager( None, UnrestrictedUser('god', 'god', ['Manager'], '') )
 

Modified: CMF/trunk/CMFCore/tests/base/testcase.py
===================================================================
--- CMF/trunk/CMFCore/tests/base/testcase.py	2006-11-06 15:49:14 UTC (rev 71090)
+++ CMF/trunk/CMFCore/tests/base/testcase.py	2006-11-07 09:33:02 UTC (rev 71091)
@@ -81,53 +81,35 @@
 
 class TransactionalTest(unittest.TestCase):
 
-    def setUp( self ):
+    def setUp(self):
         transaction.begin()
         self.app = self.root = ZopeTestCase.app()
-
-    def tearDown( self ):
-        transaction.abort()
-        ZopeTestCase.close(self.app)
-
-
-class RequestTest(TransactionalTest):
-
-    def setUp(self):
-        TransactionalTest.setUp(self)
-        self.app = self.root = ZopeTestCase.utils.makerequest(self.app)
         self.REQUEST  = self.app.REQUEST
         self.RESPONSE = self.app.REQUEST.RESPONSE
 
     def tearDown(self):
-        self.REQUEST.close()
-        TransactionalTest.tearDown(self)
+        transaction.abort()
+        ZopeTestCase.close(self.app)
 
+RequestTest = TransactionalTest
 
-class SecurityTest(unittest.TestCase):
 
+class SecurityTest(TransactionalTest):
+
     def setUp(self):
-        transaction.begin()
+        TransactionalTest.setUp(self)
         self._policy = PermissiveSecurityPolicy()
         self._oldPolicy = setSecurityPolicy(self._policy)
-        self.app = self.root = ZopeTestCase.app()
         newSecurityManager(None, AnonymousUser().__of__(self.app.acl_users))
 
-    def tearDown( self ):
-        transaction.abort()
-        ZopeTestCase.close(self.app)
+    def tearDown(self):
         noSecurityManager()
         setSecurityPolicy(self._oldPolicy)
+        TransactionalTest.tearDown(self)
 
+SecurityRequestTest = SecurityTest
 
-class SecurityRequestTest(SecurityTest):
 
-    def setUp(self):
-        SecurityTest.setUp(self)
-        self.app = self.root = ZopeTestCase.utils.makerequest(self.app)
-
-    def tearDown(self):
-        SecurityTest.tearDown(self)
-
 try:
     __file__
 except NameError:



More information about the CMF-checkins mailing list