summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2013-11-23 20:51:17 +0100
committerClaude Paroz <claude@2xlibre.net>2013-11-26 20:42:54 +0100
commit655b8bb10b3c00d6c96e357d085c20b397a2ffa0 (patch)
tree85c38474cce6ef968573eca6bcef3e56a5f4ac44
parent6cd5c67b694b3469817e38d02f79ddef7c2a7132 (diff)
[1.6.x] Fixed #21448 -- Fixed test client logout with cookie-based sessions
Thanks Gunnar Scherf for the report and the suggested patch. Backport of 384816fcc from master.
-rw-r--r--django/test/client.py1
-rw-r--r--docs/releases/1.6.1.txt2
-rw-r--r--tests/test_client/tests.py4
3 files changed, 7 insertions, 0 deletions
diff --git a/django/test/client.py b/django/test/client.py
index b4bdde6931..6ea811940d 100644
--- a/django/test/client.py
+++ b/django/test/client.py
@@ -595,6 +595,7 @@ class Client(RequestFactory):
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."
diff --git a/docs/releases/1.6.1.txt b/docs/releases/1.6.1.txt
index 156378f928..91c6a9e261 100644
--- a/docs/releases/1.6.1.txt
+++ b/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).
diff --git a/tests/test_client/tests.py b/tests/test_client/tests.py
index 0f3cba7e88..ccd3b56d2e 100644
--- a/tests/test_client/tests.py
+++ b/tests/test_client/tests.py
@@ -356,6 +356,10 @@ class ClientTest(TestCase):
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"