Public Member Functions | Public Attributes | Private Attributes
tornado.testing.AsyncHTTPTestCase Class Reference
Inheritance diagram for tornado.testing.AsyncHTTPTestCase:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def fetch
def get_app
def get_http_port
def get_httpserver_options
def get_url
def setUp
def tearDown

Public Attributes

 http_client
 http_server

Private Attributes

 __port
 _app

Detailed Description

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 208 of file testing.py.


Member Function Documentation

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

Reimplemented in tornado.test.httpserver_test.BaseSSLTest.

Definition at line 247 of file testing.py.

Returns the port used by the HTTPServer.

A new port is chosen for each test.

Definition at line 264 of file testing.py.

May be overridden by subclasses to return additional
keyword arguments for HTTPServer.

Reimplemented in tornado.test.httpserver_test.XHeaderTest, and tornado.test.httpserver_test.BaseSSLTest.

Definition at line 258 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 273 of file testing.py.

Reimplemented from tornado.testing.AsyncTestCase.

Definition at line 277 of file testing.py.


Member Data Documentation

Definition at line 231 of file testing.py.

Definition at line 231 of file testing.py.

Definition at line 231 of file testing.py.


The documentation for this class was generated from the following file:


rosbridge_server
Author(s): Jonathan Mace
autogenerated on Mon Oct 6 2014 06:58:15