summaryrefslogtreecommitdiff
path: root/tests/sessions_tests
diff options
context:
space:
mode:
authorInvalidInterrupt <InvalidInterrupt@users.noreply.github.com>2017-04-11 17:35:17 -0700
committerTim Graham <timograham@gmail.com>2017-04-17 22:27:59 -0400
commit5d556d2aaf64a4181b121e3cb51009d59f02869e (patch)
treea8823972b1a189849d7bd38bc6fc0b23590ece0d /tests/sessions_tests
parent844ae40a7cdcb1738ca3a2e8f13bb6b8c2e22efd (diff)
downloaddjango-5d556d2aaf64a4181b121e3cb51009d59f02869e.tar.gz
[1.11.x] Fixed #28066 -- Prevented SessionBase.cycle_key() from discarding data.
Backport of dda596ca3296f5b2574cf4876a4e176594f52834 from master
Diffstat (limited to 'tests/sessions_tests')
-rw-r--r--tests/sessions_tests/tests.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/sessions_tests/tests.py b/tests/sessions_tests/tests.py
index ae57f1d919..7f32ca8be2 100644
--- a/tests/sessions_tests/tests.py
+++ b/tests/sessions_tests/tests.py
@@ -189,8 +189,13 @@ class SessionTestsMixin(object):
self.assertEqual(list(self.session.items()), prev_data)
def test_cycle_with_no_session_cache(self):
+ self.session['a'], self.session['b'] = 'c', 'd'
+ self.session.save()
+ prev_data = list(self.session.items())
+ self.session = self.backend(self.session.session_key)
self.assertFalse(hasattr(self.session, '_session_cache'))
self.session.cycle_key()
+ self.assertEqual(list(self.session.items()), prev_data)
def test_save_doesnt_clear_data(self):
self.session['a'] = 'b'