[Zope-Checkins] CVS: Zope/lib/python/ZServer/tests - test_responses.py:1.1.2.1.4.2

Tres Seaver tseaver at zope.com
Mon Mar 22 10:24:46 EST 2004


Update of /cvs-repository/Zope/lib/python/ZServer/tests
In directory cvs.zope.org:/tmp/cvs-serv5539/lib/python/ZServer/tests

Modified Files:
      Tag: chrism-publishfile-branch
	test_responses.py 
Log Message:


  - Remove over-long line defining extraneous expected values (we only really
    care about the payload, not the headers, and the order of the headers
    should *not* be part of the test!)


=== Zope/lib/python/ZServer/tests/test_responses.py 1.1.2.1.4.1 => 1.1.2.1.4.2 ===
--- Zope/lib/python/ZServer/tests/test_responses.py:1.1.2.1.4.1	Sun Mar 21 14:38:52 2004
+++ Zope/lib/python/ZServer/tests/test_responses.py	Mon Mar 22 10:24:44 2004
@@ -41,15 +41,16 @@
         self.assertRaises(TypeError, response.write, u'bad')
 
     def test_setBodyProducer(self):
+        _BODY = 'hello'
         channel = DummyChannel()
         one = ZServerHTTPResponse(stdout=channel)
         one.setHeader('content-length', 5)
-        one.setBodyProducer(dummy_producer("hello"))
-        expected = 'HTTP/1.0 200 OK\r\nServer: Zope/2.0 ZServer/2.0\r\nDate: Sun, 21 Mar 2004 19:28:47 GMT\r\nContent-Length: 5\r\nEtag: \r\nConnection: close\r\n\r\nhello'
+        one.setBodyProducer(dummy_producer(_BODY))
         one.outputBody()
         all = channel.all()
         lines = all.split('\r\n')
-        self.assertEqual(lines[7], 'hello')
+        self.assertEqual(lines[-2], '')    # end of headers
+        self.assertEqual(lines[-1], _BODY) # payload
 
     def test_setBodyProducerFailsWithoutContentLength(self):
         one = ZServerHTTPResponse(stdout=DummyChannel())




More information about the Zope-Checkins mailing list