Browse files

Fixed #21448 -- Fixed test client logout with cookie-based sessions

Thanks Gunnar Scherf for the report and the suggested patch.
  • Loading branch information...
1 parent 5725236 commit 384816fccb6dfc7fc40f8059811341ba3572d9ff @claudep claudep committed Nov 23, 2013
Showing with 7 additions and 0 deletions.
  1. +1 −0 django/test/client.py
  2. +2 −0 docs/releases/1.6.1.txt
  3. +4 −0 tests/test_client/tests.py
View
1 django/test/client.py
@@ -600,6 +600,7 @@ def logout(self):
else:
request.session = engine.SessionStore()
logout(request)
+ self.cookies = SimpleCookie()
def _handle_redirects(self, response, **extra):
"Follows any redirects by requesting responses from the server using GET."
View
2 docs/releases/1.6.1.txt
@@ -37,3 +37,5 @@ Bug fixes
multiple times (#21488, #17181).
* Fixed a regression that unnecessarily triggered settings configuration when
importing ``get_wsgi_application`` (#21486).
+* Fixed test client ``logout()`` method when using the cookie-based session
+ backend (#21448).
View
4 tests/test_client/tests.py
@@ -368,6 +368,10 @@ def test_logout(self):
response = self.client.get('/test_client/login_protected_view/')
self.assertRedirects(response, 'http://testserver/accounts/login/?next=/test_client/login_protected_view/')
+ @override_settings(SESSION_ENGINE="django.contrib.sessions.backends.signed_cookies")
+ def test_logout_cookie_sessions(self):
+ self.test_logout()
+
def test_view_with_permissions(self):
"Request a page that is protected with @permission_required"

0 comments on commit 384816f

Please sign in to comment.