aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_testing.py
diff options
context:
space:
mode:
authorTom Christie2014-08-19 10:11:10 +0100
committerTom Christie2014-08-19 10:11:10 +0100
commite385a7b8eb6e538698f28128e43fe8bfaefd4e97 (patch)
tree3f1cac50c40ec77a0bc5537f1a04628901a4d2ce /tests/test_testing.py
parent2aad8e4b35c3552a065347d7eccad8bd51938783 (diff)
parent48b66ec2a2b744f170034adbdaaa1588e6c14e11 (diff)
downloaddjango-rest-framework-e385a7b8eb6e538698f28128e43fe8bfaefd4e97.tar.bz2
Merge master
Diffstat (limited to 'tests/test_testing.py')
-rw-r--r--tests/test_testing.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_testing.py b/tests/test_testing.py
index e2e4e217..1b126e00 100644
--- a/tests/test_testing.py
+++ b/tests/test_testing.py
@@ -99,6 +99,17 @@ class TestAPITestClient(TestCase):
self.assertEqual(response.status_code, 403)
self.assertEqual(response.data, expected)
+ def test_can_logout(self):
+ """
+ `logout()` reset stored credentials
+ """
+ self.client.credentials(HTTP_AUTHORIZATION='example')
+ response = self.client.get('/view/')
+ self.assertEqual(response.data['auth'], 'example')
+ self.client.logout()
+ response = self.client.get('/view/')
+ self.assertEqual(response.data['auth'], b'')
+
class TestAPIRequestFactory(TestCase):
def test_csrf_exempt_by_default(self):