aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/test.py
diff options
context:
space:
mode:
authorTom Christie2013-08-23 11:21:45 +0100
committerTom Christie2013-08-23 11:21:52 +0100
commit19a774f97292444a48c5b7521e1b0c0ea48b6502 (patch)
treeabd8cfe85cb7f448639abf6d195dee526a0ebff1 /rest_framework/test.py
parentb8561f41238e0ad79b2cc823518a93314d987979 (diff)
downloaddjango-rest-framework-19a774f97292444a48c5b7521e1b0c0ea48b6502.tar.bz2
force_authenticate(None) also clears session info.
Closes #1055.
Diffstat (limited to 'rest_framework/test.py')
-rw-r--r--rest_framework/test.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/rest_framework/test.py b/rest_framework/test.py
index a18f5a29..234d10a4 100644
--- a/rest_framework/test.py
+++ b/rest_framework/test.py
@@ -134,6 +134,8 @@ class APIClient(APIRequestFactory, DjangoClient):
"""
self.handler._force_user = user
self.handler._force_token = token
+ if user is None:
+ self.logout() # Also clear any possible session info if required
def request(self, **kwargs):
# Ensure that any credentials set get added to every request.