"""Use a separate API process with SESSION_TTL_SECONDS=2, sharing real stores.""" from pathlib import Path import sys import time sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'tests')) from client import Client, check, timestamp c = Client() actor = c.user('expiry') response = c.call('GET', '/api/v1/users/me', actor=actor, schema='User') time.sleep(2.2) c.call('GET', '/api/v1/users/me', 401, actor=actor) print('PASS: session accepted before expiry; rejected after 2.2s with SESSION_TTL_SECONDS=2.')