Files
mtusi2026lab2/student-tests/test_expiry.py
T
glebossokin ef96551b7d
Lab 2 application / application (pull_request) Canceled after 0s
Skeleton contracts / contracts (pull_request) Canceled after 0s
ЛР 2: PostgreSQL, Redis-сессии и проверки на оценку 4
2026-10-26 23:25:37 +03:00

15 lines
521 B
Python

"""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.')