The TestApp class is accessible via the paste.fixture module.
Wraps a WSGI application in a more convenient interface for testing.
app may be an application, or a Paste Deploy app URI, like 'config:filename.ini#test'.
namespace is a dictionary that will be written to (if provided). This can be used with doctest or some other system, and the variable res will be assigned everytime you make a request (instead of returning the request).
relative_to is a directory, and filenames used for file uploads are calculated relative to this. Also config: URIs that aren't absolute.
extra_environ is a dictionary of values that should go into the environment for each request. These can provide a communication channel with the application.
pre_request_hook is a function to be called prior to making requests (such as post or get). This function must take one argument (the instance of the TestApp).
post_request_hook is a function, similar to pre_request_hook, to be called after requests are made.
Do a DELETE request. Very like the .get() method. params are put in the body of the request.
Returns a response object
Executes the given request (req), with the expected status. Generally .get() and .post() are used instead.
Encodes a set of parameters (typically a name/value list) and a set of files (a list of (name, filename, file_body)) into a typical POST body, returning the (content_type, body).
Get the given url (well, actually a path like '/page.html').
Returns a response object
Do a POST request. Very like the .get() method. params are put in the body of the request.
upload_files is for file uploads. It should be a list of [(fieldname, filename, file_content)]. You can also use just [(fieldname, filename)] and the file content will be read from disk.
Returns a response object
Do a PUT request. Very like the .get() method. params are put in the body of the request.
upload_files is for file uploads. It should be a list of [(fieldname, filename, file_content)]. You can also use just [(fieldname, filename)] and the file content will be read from disk.
Returns a response object
See the source for more information.