summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/test/client.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/django/test/client.py b/django/test/client.py
index 7e62715205..9ec3615973 100644
--- a/django/test/client.py
+++ b/django/test/client.py
@@ -253,3 +253,14 @@ class Client:
else:
return False
+ def logout(self):
+ """Removes the authenticated user's cookies.
+
+ Causes the authenticated user to be logged out.
+ """
+ try:
+ Session.objects.get(session_key=self.cookies['sessionid'].value).delete()
+ except KeyError:
+ pass
+
+ self.cookies = SimpleCookie()