[Checkins] SVN: zope.app.http/trunk/ update the tests to work with zope.app.wsgi 3.9.0.

Martijn Faassen faassen at startifact.com
Mon Apr 19 13:50:19 EDT 2010


Log message for revision 111128:
  update the tests to work with zope.app.wsgi 3.9.0.
  

Changed:
  U   zope.app.http/trunk/CHANGES.txt
  U   zope.app.http/trunk/setup.py
  U   zope.app.http/trunk/src/zope/app/http/tests/test_functional_put.py

-=-
Modified: zope.app.http/trunk/CHANGES.txt
===================================================================
--- zope.app.http/trunk/CHANGES.txt	2010-04-19 17:42:23 UTC (rev 111127)
+++ zope.app.http/trunk/CHANGES.txt	2010-04-19 17:50:18 UTC (rev 111128)
@@ -5,11 +5,13 @@
 3.8 (unreleased)
 ----------------
 
-- Remove dependency on zope.app.testing. At the time of this writing the
-  test dependency on zope.app.zcmlfiles cannot be removed however, because
-  there is a dependency on zope.app.file for testing, which pulls in
-  the world.
+- Remove dependency on zope.app.testing by using the
+  zope.app.wsgi.testlayer support instead. 
 
+  At the time of this writing the test dependency on
+  zope.app.zcmlfiles cannot be removed however, because there is a
+  dependency on zope.app.file for testing, which pulls in the world.
+
 3.7 (2010-04-13)
 ----------------
 

Modified: zope.app.http/trunk/setup.py
===================================================================
--- zope.app.http/trunk/setup.py	2010-04-19 17:42:23 UTC (rev 111127)
+++ zope.app.http/trunk/setup.py	2010-04-19 17:50:18 UTC (rev 111128)
@@ -57,7 +57,7 @@
                 'zope.app.securitypolicy',
                 'zope.app.file',
                 'zope.app.zcmlfiles',
-                'zope.app.wsgi',
+                'zope.app.wsgi >= 3.9.0',
                 'zope.site',
                 'zope.login',]),
       install_requires=['setuptools',

Modified: zope.app.http/trunk/src/zope/app/http/tests/test_functional_put.py
===================================================================
--- zope.app.http/trunk/src/zope/app/http/tests/test_functional_put.py	2010-04-19 17:42:23 UTC (rev 111127)
+++ zope.app.http/trunk/src/zope/app/http/tests/test_functional_put.py	2010-04-19 17:50:18 UTC (rev 111128)
@@ -21,48 +21,43 @@
 from zope.app.wsgi.testlayer import http, BrowserLayer
 import zope.app.http
 
-layer = BrowserLayer(zope.app.http)
-
-class TestPUT(TestCase):    
+class TestPUT(TestCase):
+    
+    layer = BrowserLayer(zope.app.http)
+    
     def test_put(self):
         # PUT something for the first time
-        out = http(r"""PUT /testfile.txt HTTP/1.1
+        response = http(r"""PUT /testfile.txt HTTP/1.1
 Authorization: Basic globalmgr:globalmgrpw
-X-Zope-Handle-Errors: False
 Content-Length: 20
 Content-Type: text/plain
 
 This is just a test.""")
-        self.assertEquals(
-            out,
-            ('HTTP/1.0 201 Created\n'
-             'X-Powered-By: Zope (www.zope.org), Python (www.python.org)\n'
-             'Content-Length: 0\n'
-             'Location: http://localhost/testfile.txt\n\n'))
-            
-        out = http(r"""GET /testfile.txt HTTP/1.1
+ 
+        self.assertEquals(response.getStatus(), 201)
+        self.assertEquals(response.getHeader("Location"),
+                          "http://localhost/testfile.txt")
+
+        response = http(r"""GET /testfile.txt HTTP/1.1
 Authorization: Basic globalmgr:globalmgrpw""")
-        self.assertEquals(out.split('\n\n')[1],
-                          'This is just a test.')
-    
+        self.assertEquals(response.getBody(), "This is just a test.")
+
         # now modify it
-        out = http(r"""PUT /testfile.txt HTTP/1.1
+        response = http(r"""PUT /testfile.txt HTTP/1.1
 Authorization: Basic globalmgr:globalmgrpw
 Content-Length: 23
 Content-Type: text/plain
 
 And now it is modified.""")
+        self.assertEquals(response.getStatus(), 200)
+        self.assertEquals(response.getBody(), "")
 
-        self.assert_('200' in out)
-        self.assertEquals(out.split('\n\n')[1], "")
-    
-        out = http(r"""GET /testfile.txt HTTP/1.1
+        response = http(r"""GET /testfile.txt HTTP/1.1
 Authorization: Basic globalmgr:globalmgrpw""")
-
-        self.assertEquals(out.split('\n\n')[1], "And now it is modified.")
+        self.assertEquals(response.getBody(), "And now it is modified.")
         
+        
 def test_suite():
-    TestPUT.layer = layer
     return TestSuite((
         makeSuite(TestPUT),
         ))



More information about the checkins mailing list