1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #5189 -- Added logout method to test Client. Thanks, Jakub Wisniowski <restless.being@gmail.com>.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5916 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee
2007-08-17 14:20:25 +00:00
parent 55c0b35acf
commit 8dff1cd91d
4 changed files with 42 additions and 3 deletions

View File

@@ -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()