Calculate session expiry times in operations, using a common now timestamp for everything.
This commit is contained in:
+1
-3
@@ -21,7 +21,7 @@ import pytest_asyncio
|
||||
|
||||
import paskia.db.operations as ops_db
|
||||
from paskia import globals as paskia_globals
|
||||
from paskia.authsession import expires, reset_expires
|
||||
from paskia.authsession import reset_expires
|
||||
from paskia.db import (
|
||||
Credential,
|
||||
Org,
|
||||
@@ -183,7 +183,6 @@ async def session_token(
|
||||
host="localhost",
|
||||
ip="127.0.0.1",
|
||||
user_agent="pytest",
|
||||
expiry=expires(),
|
||||
)
|
||||
|
||||
|
||||
@@ -198,7 +197,6 @@ async def regular_session_token(
|
||||
host="localhost",
|
||||
ip="127.0.0.1",
|
||||
user_agent="pytest",
|
||||
expiry=expires(),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import pytest_asyncio
|
||||
import uuid7
|
||||
|
||||
from paskia import db
|
||||
from paskia.authsession import expires
|
||||
from paskia.db import (
|
||||
Credential,
|
||||
Org,
|
||||
@@ -104,7 +103,6 @@ async def second_org_session_token(
|
||||
host="localhost",
|
||||
ip="127.0.0.1",
|
||||
user_agent="pytest",
|
||||
expiry=expires(),
|
||||
)
|
||||
|
||||
|
||||
@@ -161,7 +159,6 @@ async def org_admin_session_token(
|
||||
host="localhost",
|
||||
ip="127.0.0.1",
|
||||
user_agent="pytest",
|
||||
expiry=expires(),
|
||||
)
|
||||
|
||||
|
||||
@@ -1299,7 +1296,6 @@ class TestAdminSessions:
|
||||
host="other.host:4401",
|
||||
ip="192.168.1.1",
|
||||
user_agent="other-agent",
|
||||
expiry=expires(),
|
||||
)
|
||||
|
||||
response = await client.delete(
|
||||
|
||||
+3
-4
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user