import os import time from client import Client base=os.environ.get("BASE_URL","http://localhost:8080") ttl=int(os.environ.get("SESSION_TTL_SECONDS","3")) if ttl>10: raise SystemExit("Run with a short SESSION_TTL_SECONDS (10 seconds or less)") c=Client(base) actor=c.user("expiry") time.sleep(ttl+1.2) response=c.call("GET","/api/v1/users/me",401,actor=actor) assert response["status"]==401 print("PASS: expired Bearer session rejected after short TTL")