示例#1
0
 def test_error_handlers_404(self):
     self.assertTrue(handler404.endswith('.page_not_found'))
     c = Client()
     request = c.get("/abc")
     response = page_not_found(request)
     self.assertEqual(request.status_code, response.status_code)
     self.assertIn('404', unicode(response))
示例#2
0
 def test_error_handlers(self):
     self.assertTrue(handler404.endswith(".page_not_found"))
     self.assertTrue(handler500.endswith(".internal_server_error"))
     c = Client()
     request = c.get("/abc")
     response = page_not_found(request)
     self.assertEqual(response.status_code, 404)
     response = internal_server_error(request)
     self.assertEqual(response.status_code, 500)
示例#3
0
 def test_error_handlers(self):
     self.assertTrue(handler404.endswith('.page_not_found'))
     self.assertTrue(handler500.endswith('.internal_server_error'))
     c = Client()
     request = c.get("/abc")
     response = page_not_found(request)
     self.assertEqual(response.status_code, 404)
     self.assertIn('Error 404', unicode(response))
     response = internal_server_error(request)
     self.assertEqual(response.status_code, 500)
     self.assertIn('Error 500', unicode(response))