From dc4e8377ee404c9ffb275c21950f5354b32b9094 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 30 Mar 2026 00:38:16 +0000 Subject: [PATCH] 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> --- backend/app/tests/test_security_extra.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/app/tests/test_security_extra.py b/backend/app/tests/test_security_extra.py index f024718..8702891 100644 --- a/backend/app/tests/test_security_extra.py +++ b/backend/app/tests/test_security_extra.py @@ -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 # ---------------------------------------------------------------------------