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

Tres Seaver cvs-admin at zope.org
Mon Nov 17 17:34:52 EST 2003


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

Modified Files:
      Tag: Zope-2_7-branch
	testBaseRequest.py 
Added Files:
      Tag: Zope-2_7-branch
	testHTTPResponse.py 
Log Message:
 - Merge tseaver-strexp_delenda-branch to the 2.7 branch.


=== Added File Zope/lib/python/ZPublisher/tests/testHTTPResponse.py ===
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.1.6.1 => 1.1.6.2 ===
--- Zope/lib/python/ZPublisher/tests/testBaseRequest.py:1.1.6.1	Tue Oct 14 05:07:05 2003
+++ Zope/lib/python/ZPublisher/tests/testBaseRequest.py	Mon Nov 17 17:34:20 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