Esempio n. 1
0
 def test_200(self):
     """A regular HttpResponse is passed through as normal"""
     def f():
         return HttpResponse('Hello')
     response = empty_response_on_404(f)()
     self.assertEqual(response.status_code, 200)
     self.assertEqual(response.content, 'Hello')
Esempio n. 2
0
 def test__404(self):
     """An empty HttpResponse is returned when Http404 is raised"""
     def f():
         raise Http404
     response = empty_response_on_404(f)()
     self.assertEqual(response.status_code, 404)
     self.assertEqual(response.content, '')