class RequestFactory:
Known subclasses: django.test.client.AsyncRequestFactory
, django.test.client.Client
Class that lets you create mock Request objects for use in testing.
Usage:
rf = RequestFactory() get_request = rf.get('/hello/') post_request = rf.post('/submit/', {'foo': 'bar'})
Once you have a request object you can pass it to any view function, just as if that view had been hooked up using a URLconf.
Method | __init__ |
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 |
Method | delete |
Construct a DELETE request. |
Method | generic |
Construct an arbitrary HTTP request. |
Method | get |
Construct a GET request. |
Method | head |
Construct a HEAD request. |
Method | options |
Construct an OPTIONS request. |
Method | patch |
Construct a PATCH request. |
Method | post |
Construct a POST request. |
Method | put |
Construct a PUT request. |
Method | request |
Construct a generic request object. |
Method | trace |
Construct a TRACE request. |
Instance Variable | cookies |
Undocumented |
Instance Variable | defaults |
Undocumented |
Instance Variable | errors |
Undocumented |
Instance Variable | json_encoder |
Undocumented |
django.test.client.Client
django.test.client.AsyncRequestFactory
django.test.client.Client
django.test.client.Client
django.test.client.Client
django.test.client.Client
django.test.client.Client
django.test.client.AsyncRequestFactory
, django.test.client.Client
django.test.client.Client