[Zope-Checkins] CVS: Zope/lib/python/ZPublisher/tests - testHTTPResponse.py:1.2 testBaseRequest.py:1.3

Tres Seaver cvs-admin at zope.org
Tue Nov 18 08:17:49 EST 2003


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

Modified Files:
	testBaseRequest.py 
Added Files:
	testHTTPResponse.py 
Log Message:
 - Merge tseaver-strexp_delenda-branch to the head.


=== Zope/lib/python/ZPublisher/tests/testHTTPResponse.py 1.1 => 1.2 ===
--- /dev/null	Tue Nov 18 08:17:48 2003
+++ Zope/lib/python/ZPublisher/tests/testHTTPResponse.py	Tue Nov 18 08:17:18 2003
@@ -0,0 +1,37 @@
+import unittest
+
+class HTTPResponseTests(unittest.TestCase):
+
+    def _getTargetClass(self):
+
+        from ZPublisher.HTTPResponse import HTTPResponse
+        return HTTPResponse
+
+    def _makeOne(self, *args, **kw):
+
+        return self._getTargetClass()(*args, **kw)
+
+    def test_setStatus_with_exceptions(self):
+
+        from zExceptions import Unauthorized
+        from zExceptions import Forbidden
+        from zExceptions import NotFound
+        from zExceptions import BadRequest
+        from zExceptions import InternalError
+
+        for exc_type, code in ((Unauthorized, 401),
+                               (Forbidden, 403),
+                               (NotFound, 404),
+                               (BadRequest, 400),
+                               (InternalError, 500)):
+            response = self._makeOne()
+            response.setStatus(exc_type)
+            self.assertEqual(response.status, code)
+
+def test_suite():
+    suite = unittest.TestSuite()
+    suite.addTest(unittest.makeSuite(HTTPResponseTests, 'test'))
+    return suite
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')


=== Zope/lib/python/ZPublisher/tests/testBaseRequest.py 1.2 => 1.3 ===
--- Zope/lib/python/ZPublisher/tests/testBaseRequest.py:1.2	Tue Oct 14 05:08:44 2003
+++ Zope/lib/python/ZPublisher/tests/testBaseRequest.py	Tue Nov 18 08:17:18 2003
@@ -136,9 +136,10 @@
 
     def test_traverse_withBDEmpty(self):
         # Collector 1079 (infinite loop 2)
+        from ZPublisher import NotFound
         r = self.makeBaseRequest()
         self.f1.objWithBD._default_path = ['']
-        self.failUnlessRaises('NotFound', r.traverse, 'folder/objWithBD')
+        self.failUnlessRaises(NotFound, r.traverse, 'folder/objWithBD')
 
     def test_traverse_slash(self):
         r = self.makeBaseRequest()




More information about the Zope-Checkins mailing list