module documentation

Undocumented

Class AsyncClient An async version of Client that creates ASGIRequests and calls through an async request path.
Class AsyncClientHandler An async version of ClientHandler.
Class AsyncRequestFactory 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 ClientHandler 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 ClientMixin Mixin with common methods between Client and AsyncClient.
Class FakePayload A wrapper around BytesIO that restricts what can be read since data from the network can't be sought and cannot be read outside of its content length. This makes sure that views can't do anything under the test client that wouldn't work in real life.
Class RequestFactory Class that lets you create mock Request objects for use in testing.
Exception RedirectCycleError The test client has been asked to follow a redirect loop.
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.
Constant BOUNDARY Undocumented
Constant CONTENT_TYPE_RE Undocumented
Constant JSON_CONTENT_TYPE_RE Undocumented
Constant MULTIPART_CONTENT Undocumented
def closing_iterator_wrapper(iterable, close): (source)

Undocumented

def conditional_content_removal(request, response): (source)

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): (source)

Undocumented

def encode_multipart(boundary, data): (source)

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): (source)

Store templates and contexts that are rendered. The context is copied so that it is an accurate representation at the time of rendering.

BOUNDARY: str = (source)

Undocumented

Value
'BoUnDaRyStRiNg'
CONTENT_TYPE_RE = (source)

Undocumented

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

Undocumented

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

Undocumented

Value
'multipart/form-data; boundary=%s'%BOUNDARY