Beispiel #1
0
 def testDoubleRouteException(self):
     self.createAnonRoute('/')
     try:
         stderr_helper.redirect_stderr()
         self.createAnonRoute('/')
         self.assertTrue(len(pyroutes.__routes__) == 1)
         self.assertTrue('Redefining' in stderr_helper.get_stderr_data())
     finally:
         stderr_helper.revert_stderr()
Beispiel #2
0
 def test_should_return_500_and_print_to_stderr_if_exception(self):
     def errorous(req):
         raise ValueError("foobar")
     try:
         stderr_helper.redirect_stderr()
         ehm = ErrorHandlerMiddleware(errorous, route)
         self.assertEquals(ehm(self.request).status_code, '500 Internal Server Error')
         self.assertTrue('ValueError' in stderr_helper.get_stderr_data())
     finally:
         stderr_helper.revert_stderr()