[Zope3-checkins] SVN: Zope3/branches/Zope-3.1/src/zope/app/testing/ apply 37963 to the 3.1 branch

Benji York benji at zope.com
Tue Aug 16 11:41:52 EDT 2005


Log message for revision 37964:
  apply 37963 to the 3.1 branch
  

Changed:
  U   Zope3/branches/Zope-3.1/src/zope/app/testing/functional.py
  U   Zope3/branches/Zope-3.1/src/zope/app/testing/tests.py

-=-
Modified: Zope3/branches/Zope-3.1/src/zope/app/testing/functional.py
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/testing/functional.py	2005-08-16 15:22:41 UTC (rev 37963)
+++ Zope3/branches/Zope-3.1/src/zope/app/testing/functional.py	2005-08-16 15:41:52 UTC (rev 37964)
@@ -577,8 +577,8 @@
         old_site = getSite()
         setSite(None)
 
-        request_cls, publication_cls = chooseClasses(method, environment)
-
+        request_cls, publication_cls = self.chooseRequestClass(method, path,
+                                                               environment)
         app = FunctionalTestSetup().getApplication()
 
         request = app._request(
@@ -609,6 +609,11 @@
 
         return response
 
+    def chooseRequestClass(self, method, path, environment):
+        """Choose and return a request class and a publication class"""
+        # note that `path` is unused by the default implementation (BBB)
+        return chooseClasses(method, environment)
+ 
 
 def FunctionalDocFileSuite(*paths, **kw):
     globs = kw.setdefault('globs', {})

Modified: Zope3/branches/Zope-3.1/src/zope/app/testing/tests.py
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/testing/tests.py	2005-08-16 15:22:41 UTC (rev 37963)
+++ Zope3/branches/Zope-3.1/src/zope/app/testing/tests.py	2005-08-16 15:41:52 UTC (rev 37964)
@@ -193,11 +193,25 @@
         self.assertEquals(auth_header(header), expected)
 
 
+class HTTPCallerTestCase(unittest.TestCase):
+
+    def test_chooseRequestClass(self):
+        from zope.publisher.interfaces import IRequest, IPublication
+
+        caller = functional.HTTPCaller()
+        request_class, publication_class = caller.chooseRequestClass(
+            method='GET', path='/', environment={})
+
+        self.assert_(IRequest.implementedBy(request_class))
+        self.assert_(IPublication.implementedBy(publication_class))
+
+
 def test_suite():
     return unittest.TestSuite((
         unittest.makeSuite(FunctionalHTTPDocTest),
         unittest.makeSuite(DocResponseWrapperTestCase),
-        unittest.makeSuite(AuthHeaderTestCase)
+        unittest.makeSuite(AuthHeaderTestCase),
+        unittest.makeSuite(HTTPCallerTestCase),
         ))
 
 if __name__ == '__main__':



More information about the Zope3-Checkins mailing list