mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #28763 -- Allowed overriding the session cookie age with SessionStore.get_session_cookie_age().
This commit is contained in:
committed by
Mariusz Felisiak
parent
df28ebd6c8
commit
9d6f981a66
@@ -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):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user