aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTymur Maryokhin2015-02-20 20:12:39 +0100
committerTymur Maryokhin2015-02-20 20:12:39 +0100
commit7345830c88615839891f12fd4ed6abee99bb1468 (patch)
tree54b22b46bb2702f866481721b752368df2c059c7
parentdc8cc8607763fccc6eb3668ea7e2a976c08dd614 (diff)
downloaddjango-rest-framework-7345830c88615839891f12fd4ed6abee99bb1468.tar.bz2
Check if sessions are enabled before calling logout. Closes #2545.
-rw-r--r--rest_framework/test.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/rest_framework/test.py b/rest_framework/test.py
index 4f4b7c20..a83d082a 100644
--- a/rest_framework/test.py
+++ b/rest_framework/test.py
@@ -209,7 +209,8 @@ class APIClient(APIRequestFactory, DjangoClient):
self.handler._force_user = None
self.handler._force_token = None
- return super(APIClient, self).logout()
+ if self.session:
+ super(APIClient, self).logout()
class APITransactionTestCase(testcases.TransactionTestCase):