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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user