Base class for tests involving requests to a WSGI application.
def google.appengine.tools.devappserver2.wsgi_test_utils.WSGITestCase.assertHeadersEqual |
( |
|
self, |
|
|
|
expected, |
|
|
|
actual, |
|
|
|
msg = None |
|
) |
| |
Tests whether two sets of HTTP headers are equivalent.
The header sets expected and actual are equal if they both have exactly the
same set of header name/value pairs. Header names are considered
case-insensitive, but header values are case sensitive. The order does not
matter, but duplicate headers (headers of the same name) must be the same in
both.
Note: This should be used instead of assertEqual, assertItemsEqual or
assertDictEqual. Using standard asserts for lists and dicts will be case
sensitive. Using assert for wsgiref.headers.Headers does reference equality.
Args:
expected: A sequence of pairs, a dict or a wsgiref.headers.Headers object.
actual: A sequence of pairs, a dict or a wsgiref.headers.Headers object.
msg: A custom error message to display, if the test fails.
Raises:
AssertionError if expected and actual are not equal.
def google.appengine.tools.devappserver2.wsgi_test_utils.WSGITestCase.assertResponse |
( |
|
self, |
|
|
|
expected_status, |
|
|
|
expected_headers, |
|
|
|
expected_content, |
|
|
|
fn, |
|
|
|
args, |
|
|
|
kwargs |
|
) |
| |
Calls fn(*args, <start_response>, **kwargs) and checks the result.
Args:
expected_status: The expected HTTP status returned e.g. '200 OK'.
expected_headers: A dict, list or wsgiref.headers.Headers representing the
expected generated HTTP headers e.g. {'Content-type': 'text/plain'}.
expected_content: The expected content generated e.g. 'Hello World'.
fn: The function to test. This function will be called with
fn(*args, start_response=<func>, **kwargs) where the start_response
function verifies that it is called with the correct status and
headers.
*args: The positional arguments passed to fn.
**kwargs: The keyword arguments passed to fn.
The documentation for this class was generated from the following file:
- code/googleappengine-read-only/python/google/appengine/tools/devappserver2/wsgi_test_utils.py