class documentation

A class that can act as a client for testing purposes. It allows the user to compose GET and POST requests, and obtain the response that the server gave to those requests. The server Response objects are annotated with the details of the contexts and templates that were rendered during the process of serving the request. Client objects are stateful - they will retain cookie (and thus session) details for the lifetime of the Client instance. This is not intended as a replacement for Twill/Selenium or the like - it is here to allow testing against the contexts and templates produced by a view, rather than the HTML rendered to the end-user.

Method __init__ Undocumented
Method delete Send a DELETE request to the server.
Method get Request a response from the server using GET.
Method head Request a response from the server using HEAD.
Method options Request a response from the server using OPTIONS.
Method patch Send a resource to the server using PATCH.
Method post Request a response from the server using POST.
Method put Send a resource to the server using PUT.
Method request Make a generic request. Compose the environment dictionary and pass to the handler, return the result of the handler. Assume defaults for the query environment, which can be overridden using the arguments to the request.
Method trace Send a TRACE request to the server.
Instance Variable exc_info Undocumented
Instance Variable extra Undocumented
Instance Variable handler Undocumented
Instance Variable raise_request_exception Undocumented
Method _handle_redirects Follow any redirects by requesting responses from the server using GET.

Inherited from ClientMixin:

Method check_exception Look for a signaled exception, clear the current context exception data, re-raise the signaled exception, and clear the signaled exception from the local cache.
Method force_login Undocumented
Method login Set the Factory to appear as if it has successfully logged into a site.
Method logout Log out the user by removing the cookies and session object.
Method store_exc_info Store exceptions when they are generated by a view.
Instance Variable cookies Undocumented
Property session Return the current session variables.
Method _login Undocumented
Method _parse_json Undocumented

Inherited from RequestFactory (via ClientMixin):

Method generic Construct an arbitrary HTTP request.
Instance Variable defaults Undocumented
Instance Variable errors Undocumented
Instance Variable json_encoder Undocumented
Method _base_environ The base environment for a request.
Method _encode_data Undocumented
Method _encode_json Return encoded JSON if data is a dict, list, or tuple and content_type is application/json.
Method _get_path Undocumented
def __init__(self, enforce_csrf_checks=False, raise_request_exception=True, **defaults): (source)
def delete(self, path, data='', content_type='application/octet-stream', follow=False, secure=False, **extra): (source)

Send a DELETE request to the server.

def get(self, path, data=None, follow=False, secure=False, **extra): (source)

Request a response from the server using GET.

def head(self, path, data=None, follow=False, secure=False, **extra): (source)

Request a response from the server using HEAD.

def options(self, path, data='', content_type='application/octet-stream', follow=False, secure=False, **extra): (source)

Request a response from the server using OPTIONS.

def patch(self, path, data='', content_type='application/octet-stream', follow=False, secure=False, **extra): (source)

Send a resource to the server using PATCH.

def post(self, path, data=None, content_type=MULTIPART_CONTENT, follow=False, secure=False, **extra): (source)

Request a response from the server using POST.

def put(self, path, data='', content_type='application/octet-stream', follow=False, secure=False, **extra): (source)

Send a resource to the server using PUT.

def request(self, **request): (source)

Make a generic request. Compose the environment dictionary and pass to the handler, return the result of the handler. Assume defaults for the query environment, which can be overridden using the arguments to the request.

def trace(self, path, data='', follow=False, secure=False, **extra): (source)

Send a TRACE request to the server.

Undocumented

Undocumented

raise_request_exception = (source)

Undocumented

def _handle_redirects(self, response, data='', content_type='', **extra): (source)

Follow any redirects by requesting responses from the server using GET.