Commit 4f1506c7 by José Padilla

Merge pull request #2562 from phalt/force-auth-docs

Add import example for force_authenticate in testing
parents 3a71b6c9 d9c65281
...@@ -65,6 +65,8 @@ When testing views directly using a request factory, it's often convenient to be ...@@ -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. To forcibly authenticate a request, use the `force_authenticate()` method.
from rest_framework.tests import force_authenticate
factory = APIRequestFactory() factory = APIRequestFactory()
user = User.objects.get(username='olivia') user = User.objects.get(username='olivia')
view = AccountDetail.as_view() view = AccountDetail.as_view()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment