module documentation

Undocumented

Class ​Redirect​Cycle​Error The test client has been asked to follow a redirect loop.
Constant BOUNDARY Undocumented
Constant CONTENT​_TYPE​_RE Undocumented
Constant JSON​_CONTENT​_TYPE​_RE Undocumented
Constant MULTIPART​_CONTENT Undocumented
Class ​Async​Client An async version of Client that creates ASGIRequests and calls through an async request path.
Class ​Async​Client​Handler An async version of ClientHandler.
Class ​Async​Request​Factory Class that lets you create mock ASGI-like Request objects for use in testing. Usage:
Class ​Client A class that can act as a client for testing purposes.
Class ​Client​Handler An HTTP Handler that can be used for testing purposes. Use the WSGI interface to compose requests, but return the raw HttpResponse object with the originating WSGIRequest attached to its wsgi_request attribute.
Class ​Client​Mixin Mixin with common methods between Client and AsyncClient.
Class ​Fake​Payload No summary
Class ​Request​Factory Class that lets you create mock Request objects for use in testing.
Function closing​_iterator​_wrapper Undocumented
Function conditional​_content​_removal Simulate the behavior of most web servers by removing the content of responses for HEAD requests, 1xx, 204, and 304 responses. Ensure compliance with RFC 7230, section 3.3.3.
Function encode​_file Undocumented
Function encode​_multipart Encode multipart POST data from a dictionary of form values.
Function store​_rendered​_templates Store templates and contexts that are rendered.
BOUNDARY: str =

Undocumented

Value
'BoUnDaRyStRiNg'
CONTENT_TYPE_RE =

Undocumented

Value
_lazy_re_compile('.*; charset=([\\w\\d-]+);?')
JSON_CONTENT_TYPE_RE =

Undocumented

Value
_lazy_re_compile('^application\\/(.+\\+)?json')
MULTIPART_CONTENT =

Undocumented

Value
'multipart/form-data; boundary=%s'%BOUNDARY
def closing_iterator_wrapper(iterable, close):

Undocumented

def conditional_content_removal(request, response):
Simulate the behavior of most web servers by removing the content of responses for HEAD requests, 1xx, 204, and 304 responses. Ensure compliance with RFC 7230, section 3.3.3.
def encode_file(boundary, key, file):

Undocumented

def encode_multipart(boundary, data):

Encode multipart POST data from a dictionary of form values.

The key will be used as the form data name; the value will be transmitted as content. If the value is a file, the contents of the file will be sent as an application/octet-stream; otherwise, str(value) will be sent.

def store_rendered_templates(store, signal, sender, template, context, **kwargs):

Store templates and contexts that are rendered.

The context is copied so that it is an accurate representation at the time of rendering.