Ejemplo n.º 1
0
 def test_request_without_cookie_response_with_cookie_handling_with_object(self):
     self.app.add_route_rule(r'^/$',CookieAddWebHandlerObject)
     result = route_message(self.app, Request.parse_msg(FIXTURES.HTTP_REQUEST_ROOT))
     response = http_response(result['body'], result['status_code'], result['status_msg'], result['headers'])
     self.assertEqual(FIXTURES.HTTP_RESPONSE_OBJECT_ROOT_WITH_COOKIE, response)
Ejemplo n.º 2
0
 def test_handler_prepare_hook(self):
     # create a handler that sets the expected body in the prepare hook
     handler = PrepareHookWebHandlerObject(self.app, Request.parse_msg(FIXTURES.HTTP_REQUEST_ROOT))
     result = handler()
     response = http_response(result['body'], result['status_code'], result['status_msg'], result['headers'])
     self.assertEqual(response, FIXTURES.HTTP_RESPONSE_OBJECT_ROOT)
Ejemplo n.º 3
0
 def test_web_request_handling_with_method(self):
     self.setup_route_with_method()
     response = route_message(self.app, Request.parse_msg(FIXTURES.HTTP_REQUEST_ROOT))
     self.assertEqual(FIXTURES.HTTP_RESPONSE_METHOD_ROOT, response)
Ejemplo n.º 4
0
 def test_json_request_handling_with_object(self):
     self.app.add_route_rule(r'^/$',SimpleJSONHandlerObject)
     result = route_message(self.app, Request.parse_msg(FIXTURES.HTTP_REQUEST_ROOT))
     response = http_response(result['body'], result['status_code'], result['status_msg'], result['headers'])
     self.assertEqual(FIXTURES.HTTP_RESPONSE_JSON_OBJECT_ROOT, response)
Ejemplo n.º 5
0
 def test_web_request_handling_with_object(self):
     self.setup_route_with_object()
     result = route_message(self.app, Request.parse_msg(FIXTURES.HTTP_REQUEST_ROOT))
     response = http_response(result['body'], result['status_code'], result['status_msg'], result['headers'])
     self.assertEqual(FIXTURES.HTTP_RESPONSE_OBJECT_ROOT, response)
Ejemplo n.º 6
0
 def test_handler_prepare_hook(self):
     # create a handler that sets the expected body in the prepare hook
     handler = PrepareHookWebHandlerObject(self.app, Request.parse_msg(FIXTURES.HTTP_REQUEST_ROOT))
     self.assertEqual(handler(), FIXTURES.HTTP_RESPONSE_OBJECT_ROOT)
Ejemplo n.º 7
0
 def test_handler_initialize_hook(self):
     ## create a handler that sets the expected body(and headers) in the initialize hook
     handler = InitializeHookWebHandlerObject(self.app, Request.parse_msg(FIXTURES.HTTP_REQUEST_ROOT))
     self.assertEqual(handler(), FIXTURES.HTTP_RESPONSE_OBJECT_ROOT)
Ejemplo n.º 8
0
 def test_request_without_cookie_response_with_cookie_handling_with_object(self):
     self.app.add_route_rule(r'^/$',CookieAddWebHandlerObject)
     response = route_message(self.app, Request.parse_msg(FIXTURES.HTTP_REQUEST_ROOT))
     self.assertEqual(FIXTURES.HTTP_RESPONSE_OBJECT_ROOT_WITH_COOKIE, response)
Ejemplo n.º 9
0
 def test_json_request_handling_with_object(self):
     self.app.add_route_rule(r'^/$',SimpleJSONHandlerObject)
     response = route_message(self.app, Request.parse_msg(FIXTURES.HTTP_REQUEST_ROOT))
     self.assertEqual(FIXTURES.HTTP_RESPONSE_JSON_OBJECT_ROOT, response)