From d9c652813d3ab0ddebbb5503ce8ed57c49e1d0d2 Mon Sep 17 00:00:00 2001 From: Paul Hallett Date: Mon, 16 Feb 2015 16:07:08 +0000 Subject: [PATCH] add missing import in tests --- docs/api-guide/testing.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/api-guide/testing.md b/docs/api-guide/testing.md index cd8c7820a..d9a1696dd 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()