diff options
| author | Tymur Maryokhin | 2015-02-20 20:12:39 +0100 | 
|---|---|---|
| committer | Tymur Maryokhin | 2015-02-20 20:12:39 +0100 | 
| commit | 7345830c88615839891f12fd4ed6abee99bb1468 (patch) | |
| tree | 54b22b46bb2702f866481721b752368df2c059c7 | |
| parent | dc8cc8607763fccc6eb3668ea7e2a976c08dd614 (diff) | |
| download | django-rest-framework-7345830c88615839891f12fd4ed6abee99bb1468.tar.bz2 | |
Check if sessions are enabled before calling logout. Closes #2545.
| -rw-r--r-- | rest_framework/test.py | 3 | 
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): | 
