summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/tests/test_session_renewal.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/tests/test_session_renewal.py')
-rw-r--r--packages/meshbay-hub/tests/test_session_renewal.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/packages/meshbay-hub/tests/test_session_renewal.py b/packages/meshbay-hub/tests/test_session_renewal.py
index a839f1e..5d4bcfd 100644
--- a/packages/meshbay-hub/tests/test_session_renewal.py
+++ b/packages/meshbay-hub/tests/test_session_renewal.py
@@ -168,13 +168,18 @@ def test_the_access_token_outlives_a_film_on_its_own():
def test_the_session_is_much_longer_than_the_token():
- """The two must not be confused: the session is the refresh token."""
+ """The two must not be confused: the session is the refresh token.
+
+ Its lifetime is an admin setting (`hub_settings.SESSION_*`); what is held
+ here is what an instance starts with.
+ """
+ from meshbay_hub import hub_settings
from meshbay_hub.config import JWTConfig
- cfg = JWTConfig()
- assert cfg.refresh_token_ttl >= 7 * 86400
- assert cfg.refresh_token_ttl > cfg.access_token_ttl * 20, (
- "the refresh token is barely longer than the access token, so renewing "
- "buys almost nothing and signing in again comes round just as fast")
+ access = JWTConfig().access_token_ttl
+ assert hub_settings.SESSION_DEFAULTS["refresh_idle_hours"] * 3600 > access, (
+ "the refresh token lapses before the access token it is meant to renew")
+ assert hub_settings.SESSION_DEFAULTS["max_hours"] >= 7 * 24, (
+ "a session capped under a week makes signing in again a weekly chore")
# ── The margin ────────────────────────────────────────────────────────────────