#!/usr/bin/env python3 """Run only with SESSION_TTL_SECONDS=2 in the Compose environment.""" import time import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "tests")) from client import Client, Failure, arguments, check, run def main(): args=arguments("Check persisted session expiry with a short TTL") c=Client(args.base_url,args.ca_file) actor=c.user("ttl") c.call("GET","/api/v1/users/me",200,actor=actor,schema="User") time.sleep(2.2) c.call("GET","/api/v1/users/me",401,actor=actor) print("PASS: session expired at the configured two-second TTL") if __name__=="__main__": run(main)