forked from mtusi2026/mtusi2026lab2
reworked
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import os
|
||||
import time
|
||||
|
||||
import pytest
|
||||
from client import Client
|
||||
|
||||
|
||||
@pytest.mark.expiry
|
||||
def test_session_expires(live: Client):
|
||||
ttl = int(os.environ.get("SESSION_TTL_SECONDS", "3600"))
|
||||
if os.environ.get("RUN_EXPIRY") != "1":
|
||||
pytest.skip("set RUN_EXPIRY=1 and SESSION_TTL_SECONDS<=3")
|
||||
assert ttl <= 3
|
||||
actor = live.user("ttl")
|
||||
live.call("GET", "/api/v1/users/me", actor=actor, schema="User")
|
||||
time.sleep(ttl + 1.5)
|
||||
live.call("GET", "/api/v1/users/me", 401, actor=actor)
|
||||
Reference in New Issue
Block a user