Calculate session expiry times in operations, using a common now timestamp for everything.

This commit is contained in:
Leo Vasanko
2026-02-10 21:35:56 +00:00
parent 4fcfee78c7
commit 2105040661
6 changed files with 15 additions and 25 deletions
+3 -4
View File
@@ -11,7 +11,7 @@ These tests cover:
"""
import secrets
from datetime import UTC, datetime, timedelta
from datetime import timedelta
import httpx
import pytest
@@ -521,15 +521,14 @@ class TestValidateSessionRefresh:
):
"""Validate should return 401 if session disappears during refresh."""
# Create a session with an old expiry time to trigger refresh
old_expiry = datetime.now(UTC) + EXPIRES - timedelta(minutes=10)
# Create a session with a short remaining duration to trigger refresh
token = create_session(
user_uuid=test_user.uuid,
credential_uuid=test_credential.uuid,
host="localhost",
ip="127.0.0.1",
user_agent="pytest",
expiry=old_expiry,
duration=EXPIRES - timedelta(minutes=10),
)
# Delete the session right before validate tries to refresh