Public Member Functions | |
def | fetch |
def | get_app |
def | get_http_client |
def | get_http_port |
def | get_http_server |
def | get_httpserver_options |
def | get_protocol |
def | get_url |
def | setUp |
def | tearDown |
Public Attributes | |
http_client | |
http_server | |
Private Attributes | |
__port | |
_app |
A test case that starts up an HTTP server. Subclasses must override `get_app()`, which returns the `tornado.web.Application` (or other `.HTTPServer` callback) to be tested. Tests will typically use the provided ``self.http_client`` to fetch URLs from this server. Example:: class MyHTTPTest(AsyncHTTPTestCase): def get_app(self): return Application([('/', MyHandler)...]) def test_homepage(self): # The following two lines are equivalent to # response = self.fetch('/') # but are shown in full here to demonstrate explicit use # of self.stop and self.wait. self.http_client.fetch(self.get_url('/'), self.stop) response = self.wait() # test contents of response
Definition at line 318 of file testing.py.
def tornado.testing.AsyncHTTPTestCase.fetch | ( | self, | |
path, | |||
kwargs | |||
) |
Convenience method to synchronously fetch a url. The given path will be appended to the local server's host and port. Any additional kwargs will be passed directly to `.AsyncHTTPClient.fetch` (and so could be used to pass ``method="POST"``, ``body="..."``, etc).
Definition at line 364 of file testing.py.
def tornado.testing.AsyncHTTPTestCase.get_app | ( | self | ) |
Should be overridden by subclasses to return a `tornado.web.Application` or other `.HTTPServer` callback.
Reimplemented in tornado.test.httpserver_test.LegacyInterfaceTest, tornado.test.gen_test.GenWebTest, tornado.test.httpserver_test.BodyLimitsTest, tornado.test.httpserver_test.IdleTimeoutTest, tornado.test.httpserver_test.MaxHeaderSizeTest, tornado.test.httpserver_test.StreamingChunkSizeTest, tornado.test.httpserver_test.KeepAliveTest, tornado.test.simple_httpclient_test.MaxHeaderSizeTest, tornado.test.simple_httpclient_test.ResolveTimeoutTestCase, tornado.test.simple_httpclient_test.HostnameMappingTestCase, tornado.test.httpserver_test.SSLXHeaderTest, tornado.test.simple_httpclient_test.HTTP204NoContentTestCase, tornado.test.simple_httpclient_test.HTTP100ContinueTestCase, tornado.test.httpserver_test.HTTPServerRawTest, tornado.test.httpserver_test.HTTPServerTest, tornado.test.auth_test.AuthTest, tornado.test.httpserver_test.HTTPConnectionTest, tornado.test.httpclient_test.HTTPClientCommonTestCase, tornado.test.curl_httpclient_test.CurlHTTPClientTestCase, tornado.test.websocket_test.WebSocketTest, tornado.test.wsgi_test.WSGIConnectionTest, tornado.test.httpserver_test.HandlerBaseTestCase, tornado.test.web_test.WebTestCase, tornado.test.stack_context_test.HTTPStackContextTest, tornado.test.wsgi_test.WSGIApplicationTest, and tornado.test.wsgi_test.WSGIContainerTest.
Definition at line 358 of file testing.py.
Reimplemented in tornado.test.web_test.RaiseWithReasonTest, tornado.test.web_test.StatusReasonTest, tornado.test.httpserver_test.BodyLimitsTest, tornado.test.httpserver_test.StreamingChunkSizeTest, tornado.test.simple_httpclient_test.MaxHeaderSizeTest, tornado.testing.AsyncHTTPSTestCase, tornado.test.simple_httpclient_test.SimpleHTTPClientCommonTestCase, and tornado.test.curl_httpclient_test.CurlHTTPClientCommonTestCase.
Definition at line 351 of file testing.py.
def tornado.testing.AsyncHTTPTestCase.get_http_port | ( | self | ) |
Returns the port used by the server. A new port is chosen for each test.
Definition at line 381 of file testing.py.
Definition at line 354 of file testing.py.
May be overridden by subclasses to return additional keyword arguments for the server.
Reimplemented in tornado.test.web_test.StreamingRequestFlowControlTest, tornado.test.httpserver_test.BodyLimitsTest, tornado.test.httpserver_test.IdleTimeoutTest, tornado.test.httpserver_test.MaxHeaderSizeTest, tornado.test.httpserver_test.StreamingChunkSizeTest, tornado.test.httpserver_test.GzipTest, tornado.test.httpserver_test.ManualProtocolTest, tornado.test.httpserver_test.SSLXHeaderTest, tornado.test.httpserver_test.XHeaderTest, and tornado.testing.AsyncHTTPSTestCase.
Definition at line 375 of file testing.py.
def tornado.testing.AsyncHTTPTestCase.get_protocol | ( | self | ) |
Reimplemented in tornado.testing.AsyncHTTPSTestCase.
Definition at line 388 of file testing.py.
def tornado.testing.AsyncHTTPTestCase.get_url | ( | self, | |
path | |||
) |
Returns an absolute url for the given path on the test server.
Definition at line 391 of file testing.py.
def tornado.testing.AsyncHTTPTestCase.setUp | ( | self | ) |
Reimplemented from tornado.testing.AsyncTestCase.
Reimplemented in tornado.test.web_test.XSRFTest, tornado.test.httpserver_test.IdleTimeoutTest, tornado.test.httpserver_test.KeepAliveTest, tornado.test.simple_httpclient_test.ResolveTimeoutTestCase, tornado.test.simple_httpclient_test.HostnameMappingTestCase, tornado.test.simple_httpclient_test.SimpleHTTPClientTestCase, tornado.test.httpserver_test.HTTPServerRawTest, and tornado.test.curl_httpclient_test.CurlHTTPClientTestCase.
Definition at line 341 of file testing.py.
def tornado.testing.AsyncHTTPTestCase.tearDown | ( | self | ) |
Reimplemented from tornado.testing.AsyncTestCase.
Reimplemented in tornado.test.web_test.GetCurrentUserTest, tornado.test.web_test.UIMethodUIModuleTest, tornado.test.httpserver_test.IdleTimeoutTest, tornado.test.httpserver_test.KeepAliveTest, tornado.test.web_test.WSGISafeWebTest, and tornado.test.httpserver_test.HTTPServerRawTest.
Definition at line 396 of file testing.py.
Definition at line 341 of file testing.py.
tornado::testing.AsyncHTTPTestCase::_app [private] |
Definition at line 341 of file testing.py.
Reimplemented in tornado.test.simple_httpclient_test.ResolveTimeoutTestCase, tornado.test.simple_httpclient_test.HostnameMappingTestCase, tornado.test.simple_httpclient_test.SimpleHTTPClientTestCase, and tornado.test.curl_httpclient_test.CurlHTTPClientTestCase.
Definition at line 341 of file testing.py.
Definition at line 341 of file testing.py.