Replace session.renewed with .expiry for consistency with other expiring items. Fix migration script.
This commit is contained in:
+4
-2
@@ -18,6 +18,8 @@ from uuid import UUID
|
||||
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
from paskia.authsession import expires
|
||||
import pytest_asyncio
|
||||
import uuid7
|
||||
|
||||
@@ -190,7 +192,7 @@ async def session_token(
|
||||
host="localhost:4401",
|
||||
ip="127.0.0.1",
|
||||
user_agent="pytest",
|
||||
renewed=datetime.now(timezone.utc),
|
||||
expiry=expires(),
|
||||
)
|
||||
return token
|
||||
|
||||
@@ -208,7 +210,7 @@ async def regular_session_token(
|
||||
host="localhost:4401",
|
||||
ip="127.0.0.1",
|
||||
user_agent="pytest",
|
||||
renewed=datetime.now(timezone.utc),
|
||||
expiry=expires(),
|
||||
)
|
||||
return token
|
||||
|
||||
|
||||
+4
-3
@@ -19,6 +19,7 @@ import pytest
|
||||
import pytest_asyncio
|
||||
import uuid7
|
||||
|
||||
from paskia.authsession import expires
|
||||
from paskia.db import Credential, Org, Permission, Role, User
|
||||
from paskia.db.json import DB
|
||||
from paskia.util.tokens import create_token, encode_session_key, session_key
|
||||
@@ -101,7 +102,7 @@ async def second_org_session_token(
|
||||
host="localhost:4401",
|
||||
ip="127.0.0.1",
|
||||
user_agent="pytest",
|
||||
renewed=datetime.now(timezone.utc),
|
||||
expiry=expires(),
|
||||
)
|
||||
return token
|
||||
|
||||
@@ -167,7 +168,7 @@ async def org_admin_session_token(
|
||||
host="localhost:4401",
|
||||
ip="127.0.0.1",
|
||||
user_agent="pytest",
|
||||
renewed=datetime.now(timezone.utc),
|
||||
expiry=expires(),
|
||||
)
|
||||
return token
|
||||
|
||||
@@ -1181,7 +1182,7 @@ class TestAdminSessions:
|
||||
host="other.host:4401",
|
||||
ip="192.168.1.1",
|
||||
user_agent="other-agent",
|
||||
renewed=datetime.now(timezone.utc),
|
||||
expiry=expires(),
|
||||
)
|
||||
|
||||
encoded_key = encode_session_key(extra_key)
|
||||
|
||||
+4
-3
@@ -520,11 +520,12 @@ class TestValidateSessionRefresh:
|
||||
"""Validate should return 401 if session disappears during refresh."""
|
||||
from datetime import timedelta
|
||||
|
||||
from paskia.authsession import EXPIRES
|
||||
from paskia.util.tokens import create_token, session_key
|
||||
|
||||
# Create a session with an old renewed time to trigger refresh
|
||||
# Create a session with an old expiry time to trigger refresh
|
||||
token = create_token()
|
||||
old_time = datetime.now(timezone.utc) - timedelta(minutes=10)
|
||||
old_expiry = datetime.now(timezone.utc) + EXPIRES - timedelta(minutes=10)
|
||||
test_db.create_session(
|
||||
user_uuid=test_user.uuid,
|
||||
credential_uuid=test_credential.uuid,
|
||||
@@ -532,7 +533,7 @@ class TestValidateSessionRefresh:
|
||||
host="localhost:4401",
|
||||
ip="127.0.0.1",
|
||||
user_agent="pytest",
|
||||
renewed=old_time,
|
||||
expiry=old_expiry,
|
||||
)
|
||||
|
||||
# Delete the session right before validate tries to refresh
|
||||
|
||||
Reference in New Issue
Block a user