aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/tests/test_session_renewal.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-09-15 02:16:39 +0200
committerChristophe Besson <cbesson@gmail.com>2026-09-15 02:21:01 +0200
commit73ad8e4eb566fe682107fa7e50ef624591199e99 (patch)
treeff0017d014d46d8835487c080dca55c6def7fd6b /packages/meshbay-hub/tests/test_session_renewal.py
parentbdefcd025604f2c3009fe5e0cc01213c2ba62a6a (diff)
downloadmeshbay-73ad8e4eb566fe682107fa7e50ef624591199e99.tar.gz
feat(hub): session lifetime is an admin setting, and a browser signs out when idle
Browser idle sign-out (media playback counts as activity; not the desktop app), refresh idle window and maximum session length, in hours. Sign-out now revokes on the hub, and the profile has "sign out everywhere". Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XuNrwLf5EFWCMHzfoEvnpm
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 ────────────────────────────────────────────────────────────────