Class AsyncRequestFactory

Class that lets you create mock ASGI-like Request objects for use in testing. Usage:

Declaration

class AsyncRequestFactory(RequestFactory)
source link

Documentation

rf = AsyncRequestFactory()
get_request = await rf.get('/hello/')
post_request = await rf.post('/submit/', {'foo': 'bar'})

Once you have a request object you can pass it to any view function,
including synchronous ones. The reason we have a separate class here is:
a) this makes ASGIRequest subclasses, and
b) AsyncTestClient can subclass it.

Methods

Inherited methods

Subclasses

Reexports