[Zope3-checkins] CVS: Zope3/src/zope/publisher/tests - test_http.py:1.9

Viktorija Zaksiene ryzaja@codeworks.lt
Fri, 11 Apr 2003 06:01:24 -0400


Update of /cvs-repository/Zope3/src/zope/publisher/tests
In directory cvs.zope.org:/tmp/cvs-serv1840/tests

Modified Files:
	test_http.py 
Log Message:
Added test for interface implementation.
Fixed broken getHeader() implementation.


=== Zope3/src/zope/publisher/tests/test_http.py 1.8 => 1.9 ===
--- Zope3/src/zope/publisher/tests/test_http.py:1.8	Tue Mar 25 10:13:57 2003
+++ Zope3/src/zope/publisher/tests/test_http.py	Fri Apr 11 06:01:23 2003
@@ -18,7 +18,7 @@
 
 from zope.publisher.publish import publish
 from zope.publisher.base import DefaultPublication
-from zope.publisher.interfaces.http import IHTTPPresentation
+from zope.publisher.interfaces.http import IHTTPPresentation, IHTTPRequest
 
 from zope.i18n.interfaces import ILocale
 
@@ -154,6 +154,20 @@
         self.assertEquals(req.cookies[u'this'], u'Should be accepted')
         self.assertEquals(req[u'this'], u'Should be accepted')
 
+    def testHeaders(self):
+        headers = {
+            'TEST_HEADER': 'test',
+            'Another-Test': 'another',
+        }
+        req = self._createRequest(extra_env=headers)
+        self.assertEquals(req.headers[u'TEST_HEADER'], u'test')
+        self.assertEquals(req.headers[u'TEST-HEADER'], u'test')
+        self.assertEquals(req.headers[u'test_header'], u'test')
+        self.assertEquals(req.getHeader('TEST_HEADER', literal=True), u'test')
+        self.assertEquals(req.getHeader('TEST-HEADER', literal=True), None)
+        self.assertEquals(req.getHeader('test_header', literal=True), None)
+        self.assertEquals(req.getHeader('Another-Test', literal=True), 'another')
+
     def testBasicAuth(self):
         from zope.publisher.interfaces.http import IHTTPCredentials
         import base64
@@ -184,6 +198,8 @@
         r = self._createRequest(extra_env={'REQUEST_METHOD':'eggs'})
         self.assertEqual(r.method, 'EGGS')
 
+    def testInterface(self):
+        verifyObject(IHTTPRequest, self._createRequest())
 
 def test_suite():
     loader = unittest.TestLoader()