#!/usr/bin/env python3 """Check short server-side session expiry on a dedicated local test stack.""" import time from client import Client, arguments, check, run def main(): def configure(parser): parser.add_argument("--ttl", type=int, default=2) args = arguments("Verify session expiry with SESSION_TTL_SECONDS set to a short value", configure) check(args.ttl >= 1, "TTL must be positive") client = Client(args.base_url) actor = client.user("expiry") client.call("GET", "/api/v1/users/me", actor=actor, schema="User") time.sleep(args.ttl + 1) client.call("GET", "/api/v1/users/me", expected=401, actor=actor) print("PASS: expired Bearer session rejected after configured TTL") if __name__ == "__main__": run(main)