test: tighten token expiry tolerance in test_security_extra.py

Agent-Logs-Url: https://github.com/christianlouis/dmarq/sessions/752de981-5cf5-4789-a5b9-1f5ff165d202

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-30 00:38:16 +00:00
parent 3524344a4a
commit dc4e8377ee
+3 -3
View File
@@ -38,11 +38,11 @@ class TestCreateAccessToken:
from app.core.config import get_settings
settings = get_settings()
delta = timedelta(seconds=5)
delta = timedelta(seconds=60)
token = create_access_token("user@example.com", expires_delta=delta)
payload = jwt.decode(token, settings.SECRET_KEY, algorithms=[settings.ALGORITHM])
# exp should be roughly `now + 5 seconds`
assert abs(payload["exp"] - (int(time.time()) + 5)) <= 5
# exp should be roughly `now + 60 seconds` (within a 2-second tolerance)
assert abs(payload["exp"] - (int(time.time()) + 60)) <= 2
# ---------------------------------------------------------------------------