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)
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)
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)
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)
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)
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)
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)
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)
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)