[Checkins] SVN: CMF/branches/2.0/CMFCore/tests/test_DynamicType.py forward port some streamlining of the test implementation from

Philipp von Weitershausen philikon at philikon.de
Sat Dec 9 10:07:10 EST 2006


Log message for revision 71510:
  forward port some streamlining of the test implementation from
  CMF 1.6 branch (r71508).
  

Changed:
  U   CMF/branches/2.0/CMFCore/tests/test_DynamicType.py

-=-
Modified: CMF/branches/2.0/CMFCore/tests/test_DynamicType.py
===================================================================
--- CMF/branches/2.0/CMFCore/tests/test_DynamicType.py	2006-12-09 15:05:30 UTC (rev 71509)
+++ CMF/branches/2.0/CMFCore/tests/test_DynamicType.py	2006-12-09 15:07:09 UTC (rev 71510)
@@ -20,8 +20,10 @@
 import Zope2
 Zope2.startup()
 
+from StringIO import StringIO
+
 from Acquisition import Implicit
-from ZPublisher.BaseRequest import BaseRequest
+from ZPublisher.HTTPRequest import HTTPRequest
 from ZPublisher.HTTPResponse import HTTPResponse
 
 from Products.CMFCore.DynamicType import DynamicType
@@ -46,7 +48,7 @@
 from zope.app.traversing.interfaces import ITraverser, ITraversable
 
 def defineDefaultViewName(name, for_=None):
-    zope.component.provideAdapter(name, (for_, BaseRequest),
+    zope.component.provideAdapter(name, (for_, IBrowserRequest),
                                   IDefaultViewName, '')
 
 
@@ -93,10 +95,13 @@
         environment = { 'URL': '',
                         'PARENTS': [self.site],
                         'REQUEST_METHOD': 'GET',
+                        'SERVER_PORT': '80',
+                        'REQUEST_METHOD': 'GET',
                         'steps': [],
-                        '_hacked_path': 0,
-                        'response': response }
-        r = BaseRequest(environment)
+                        'SERVER_NAME': 'localhost',
+                        '_hacked_path': 0 }
+        r = HTTPRequest(StringIO(), environment, response)
+        r.other.update(environment)
 
         r.traverse('foo')
         self.assertEqual( r.URL, '/foo/dummy_view' )
@@ -109,10 +114,13 @@
         environment = { 'URL': '',
                         'PARENTS': [self.site],
                         'REQUEST_METHOD': 'GET',
+                        'SERVER_PORT': '80',
+                        'REQUEST_METHOD': 'GET',
                         'steps': [],
-                        '_hacked_path': 0,
-                        'response': response }
-        r = BaseRequest(environment)
+                        'SERVER_NAME': 'localhost',
+                        '_hacked_path': 0 }
+        r = HTTPRequest(StringIO(), environment, response)
+        r.other.update(environment)
 
         # we define a Zope3-style default view name, but no
         # corresponding view, no change in behaviour expected
@@ -126,20 +134,18 @@
         environment = { 'URL': '',
                         'PARENTS': [self.site],
                         'REQUEST_METHOD': 'GET',
+                        'SERVER_PORT': '80',
+                        'REQUEST_METHOD': 'GET',
                         'steps': [],
-                        '_hacked_path': 0,
-                        'response': response }
-        r = BaseRequest(environment)
+                        'SERVER_NAME': 'localhost',
+                        '_hacked_path': 0 }
+        r = HTTPRequest(StringIO(), environment, response)
+        r.other.update(environment)
 
         # we define a Zope3-style default view name for which a view
-        # actually exists (double registration needed because we test
-        # with BaseRequest, but Five checks for IBrowserRequest as
-        # well)
+        # actually exists
         defineDefaultViewName('index.html', DummyContent)
         zope.component.provideAdapter(
-            DummyView, (DummyContent, BaseRequest), IBrowserView,
-            'index.html')
-        zope.component.provideAdapter(
             DummyView, (DummyContent, IBrowserRequest), IBrowserView,
             'index.html')
 



More information about the Checkins mailing list