summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPreston Timmons <prestontimmons@gmail.com>2014-05-22 17:45:02 -0500
committerTim Graham <timograham@gmail.com>2014-05-22 20:29:48 -0400
commitbe88b062afaa58559bb12623e8ed8843f07b97a1 (patch)
tree1cff618fec57090fc73bfb40ff0b4d96a2a89dbb /tests
parent4dc4d12e27e4e0337568651136eee5b6f2171204 (diff)
Fixed #21357 -- Fixed test client session initialization.
The test client will now create a session when it is first accessed if no session already exists.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_client_regress/tests.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test_client_regress/tests.py b/tests/test_client_regress/tests.py
index a776d10f20..f26adfc99a 100644
--- a/tests/test_client_regress/tests.py
+++ b/tests/test_client_regress/tests.py
@@ -1048,6 +1048,14 @@ class SessionTests(TestCase):
self.assertEqual(response.status_code, 200)
self.assertEqual(response.content, b'YES')
+ def test_session_initiated(self):
+ session = self.client.session
+ session['session_var'] = 'foo'
+ session.save()
+
+ response = self.client.get('/check_session/')
+ self.assertEqual(response.content, b'foo')
+
def test_logout(self):
"""Logout should work whether the user is logged in or not (#9978)."""
self.client.logout()