Esempio n. 1
0
 def test_should_get_an_exception_and_format_it(self):
     request = RequestHandler()
     request.connect(EXAMPLE_APP + "page-that-doesnt-exists")
     try:
         request.ensure_success_response()
     except HttpResponseError as e:
         exception = e.msg
     self.assertEqual("404 - Not Found", exception)
Esempio n. 2
0
 def test_should_get_an_exception_and_format_it(self):
     request = RequestHandler()
     request.connect(EXAMPLE_APP + "page-that-doesnt-exists")
     try:
         request.ensure_success_response()
     except HttpResponseError as e:
         exception = e.msg
     self.assertEqual("404 - Not Found", exception)
Esempio n. 3
0
 def test_should_get_an_exception_and_format_it_using_the_exception_attrs(self):
     request = RequestHandler()
     request.connect(EXAMPLE_APP + "page-that-doesnt-exists")
     try:
         request.ensure_success_response()
     except HttpResponseError as e:
         exception = "I failed with code %d and reason %s" % (e.status_code, e.reason)
     assert_equals(exception, "I failed with code 404 and reason Not Found")
Esempio n. 4
0
 def test_should_get_an_absent_url_and_raise_an_exception(self):
     with self.assertRaises(HttpResponseError):
         request = RequestHandler()
         request.connect(EXAMPLE_APP + "page-that-doesnt-exists")
         request.ensure_success_response()
Esempio n. 5
0
 def test_should_get_an_absent_url_and_raise_an_exception(self):
     with self.assertRaises(HttpResponseError):
         request = RequestHandler()
         request.connect(EXAMPLE_APP + "page-that-doesnt-exists")
         request.ensure_success_response()