コード例 #1
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)
コード例 #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))
     self.assertEqual(handler(), FIXTURES.HTTP_RESPONSE_OBJECT_ROOT)
コード例 #3
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)
コード例 #4
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)
コード例 #5
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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #10
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)