[Zope3-checkins] CVS: Zope3/src/zope/app/startup/tests - test_registerrequestfactory.py:1.3

Jim Fulton jim@zope.com
Fri, 7 Feb 2003 11:00:17 -0500


Update of /cvs-repository/Zope3/src/zope/app/startup/tests
In directory cvs.zope.org:/tmp/cvs-serv24670/src/zope/app/startup/tests

Modified Files:
	test_registerrequestfactory.py 
Log Message:
Implemented HTTP PUT. Do do this, I had to:

- Implement working HTTP publication, request, response

- Change the server setup so that rather than having a Browser
  server and an XML-RPC server, there is an HTTP server that 
  uses:

  o Browser request, response, and publication for browser (GET, POST, 
    and HEAD) requests,

  o XMLRPC request, response, and publication for xml-rpc (POST 
    w content-type=='text/xml') requests,

  o HTTP request, response, and publication for all other HTTP requests.

  XML-RPC now runs on the same port, 8080, as browser requests.

- Implemented HEAD.

- Implemented some simple PUT views that use the
  file-system-reprentation adapter framework. (This is the replacement
  for VFS that is also used by FTP and may be used as part of
  file-system synchronization.) 
  



=== Zope3/src/zope/app/startup/tests/test_registerrequestfactory.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/startup/tests/test_registerrequestfactory.py:1.2	Wed Dec 25 09:13:25 2002
+++ Zope3/src/zope/app/startup/tests/test_registerrequestfactory.py	Fri Feb  7 10:59:46 2003
@@ -21,9 +21,16 @@
 from zope.configuration.xmlconfig import xmlconfig
 from zope.configuration.tests.basetestdirectivesxml import makeconfig
 from zope.app.startup.requestfactoryregistry import getRequestFactory
+from zope.testing.cleanup import CleanUp
+from zope.app.interfaces.startup import IPublicationRequestFactoryFactory
 
+class TF:
+    "test request factory"
+    __implements__ = IPublicationRequestFactoryFactory
 
-class Test( unittest.TestCase ):
+tf = TF()
+
+class Test(CleanUp, unittest.TestCase):
 
     def testRegisterRequestFactory(self):
 
@@ -52,6 +59,32 @@
         self.assertEqual(
             getRequestFactory('BrowserRequestFactory')._request,
             BrowserRequest)
+
+
+    def testRegisterRequestFactory_w_factory(self):
+
+        xmlconfig(makeconfig(
+            '''<directive
+                   name="registerRequestFactory"
+                   attributes="name publication request"
+                   handler=
+                   "zope.app.startup.metaconfigure.registerRequestFactory"
+                   />''',
+            '''<test:registerRequestFactory
+                   name="BrowserRequestFactory"
+                   factory="
+                   zope.app.startup.tests.test_registerrequestfactory.tf"
+                   />
+            '''
+            ))
+
+        import zope.app.startup.tests.test_registerrequestfactory
+
+        self.assertEqual(
+            getRequestFactory('BrowserRequestFactory'),
+            zope.app.startup.tests.test_registerrequestfactory.tf
+            )
+