aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Padilla2015-02-18 12:20:09 -0400
committerJosé Padilla2015-02-18 12:20:09 -0400
commit4f1506c77e172bd5d03e88db898d6cc55cf5796d (patch)
tree50f18d70431652dcbddb26a81715572873ea4499
parent3a71b6c9f5d3e6d67bf1dae36b06ce6fe37807d9 (diff)
parentd9c652813d3ab0ddebbb5503ce8ed57c49e1d0d2 (diff)
downloaddjango-rest-framework-4f1506c77e172bd5d03e88db898d6cc55cf5796d.tar.bz2
Merge pull request #2562 from phalt/force-auth-docs
Add import example for force_authenticate in testing
-rw-r--r--docs/api-guide/testing.md2
1 files changed, 2 insertions, 0 deletions
diff --git a/docs/api-guide/testing.md b/docs/api-guide/testing.md
index cd8c7820..d9a1696d 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()