summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/sessions_tests/models.py3
-rw-r--r--tests/sessions_tests/tests.py12
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/sessions_tests/models.py b/tests/sessions_tests/models.py
index 4fa216d9e6..557dbf7865 100644
--- a/tests/sessions_tests/models.py
+++ b/tests/sessions_tests/models.py
@@ -38,3 +38,6 @@ class SessionStore(DBStore):
obj.account_id = account_id
return obj
+
+ def get_session_cookie_age(self):
+ return 60 * 60 * 24 # One day.
diff --git a/tests/sessions_tests/tests.py b/tests/sessions_tests/tests.py
index e9896dc18a..24e4e0c81b 100644
--- a/tests/sessions_tests/tests.py
+++ b/tests/sessions_tests/tests.py
@@ -454,6 +454,7 @@ class DatabaseSessionWithTimeZoneTests(DatabaseSessionTests):
class CustomDatabaseSessionTests(DatabaseSessionTests):
backend = CustomDatabaseSession
session_engine = 'sessions_tests.models'
+ custom_session_cookie_age = 60 * 60 * 24 # One day.
def test_extra_session_field(self):
# Set the account ID to be picked up by a custom session storage
@@ -473,6 +474,17 @@ class CustomDatabaseSessionTests(DatabaseSessionTests):
s = self.model.objects.get(session_key=self.session.session_key)
self.assertIsNone(s.account_id)
+ def test_custom_expiry_reset(self):
+ self.session.set_expiry(None)
+ self.session.set_expiry(10)
+ self.session.set_expiry(None)
+ self.assertEqual(self.session.get_expiry_age(), self.custom_session_cookie_age)
+
+ def test_default_expiry(self):
+ self.assertEqual(self.session.get_expiry_age(), self.custom_session_cookie_age)
+ self.session.set_expiry(0)
+ self.assertEqual(self.session.get_expiry_age(), self.custom_session_cookie_age)
+
class CacheDBSessionTests(SessionTestsMixin, TestCase):