aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide/testing.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/api-guide/testing.md')
-rw-r--r--docs/api-guide/testing.md6
1 files changed, 4 insertions, 2 deletions
diff --git a/docs/api-guide/testing.md b/docs/api-guide/testing.md
index cd8c7820..9dc3f2bf 100644
--- a/docs/api-guide/testing.md
+++ b/docs/api-guide/testing.md
@@ -65,6 +65,8 @@ When testing views directly using a request factory, it's often convenient to be
To forcibly authenticate a request, use the `force_authenticate()` method.
+ from rest_framework.tests import force_authenticate
+
factory = APIRequestFactory()
user = User.objects.get(username='olivia')
view = AccountDetail.as_view()
@@ -113,7 +115,7 @@ Extends [Django's existing `Client` class][client].
## Making requests
-The `APIClient` class supports the same request interface as `APIRequestFactory`. This means the that standard `.get()`, `.post()`, `.put()`, `.patch()`, `.delete()`, `.head()` and `.options()` methods are all available. For example:
+The `APIClient` class supports the same request interface as Django's standard `Client` class. This means the that standard `.get()`, `.post()`, `.put()`, `.patch()`, `.delete()`, `.head()` and `.options()` methods are all available. For example:
from rest_framework.test import APIClient
@@ -267,6 +269,6 @@ For example, to add support for using `format='html'` in test requests, you migh
}
[cite]: http://jacobian.org/writing/django-apps-with-buildout/#s-create-a-test-wrapper
-[client]: https://docs.djangoproject.com/en/dev/topics/testing/overview/#module-django.test.client
+[client]: https://docs.djangoproject.com/en/dev/topics/testing/tools/#the-test-client
[requestfactory]: https://docs.djangoproject.com/en/dev/topics/testing/advanced/#django.test.client.RequestFactory
[configuration]: #configuration