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:
@@ -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
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user