Release govoplan-access v0.1.25: harden authentication and repair identity mappings
Module Package Release / publish-packages (push) Successful in 15s

This commit is contained in:
2026-09-08 01:32:20 +02:00
parent 0f8a05f8b9
commit 8f8072b4ae
25 changed files with 742 additions and 38 deletions
+31 -1
View File
@@ -3,7 +3,7 @@ from __future__ import annotations
import unittest
from datetime import datetime, timedelta, timezone
from sqlalchemy import create_engine
from sqlalchemy import create_engine, event
from sqlalchemy.orm import sessionmaker
from govoplan_access.backend.db.base import AccessBase
@@ -182,6 +182,36 @@ class SessionManagementTests(unittest.TestCase):
self.assertIsNone(hidden)
self.assertFalse(changed)
def test_listing_applies_activity_filter_and_limit_before_loading_history(self) -> None:
statements: list[str] = []
def capture_query(connection, cursor, statement, parameters, context, executemany):
if statement.lstrip().upper().startswith("SELECT") and "access_auth_sessions" in statement:
statements.append(statement)
event.listen(self.engine, "before_cursor_execute", capture_query)
try:
for include_inactive in (False, True):
with self.subTest(include_inactive=include_inactive):
statements.clear()
summaries = list_account_sessions(
self.session,
account_id="account-1",
current_session_id="session-current",
include_inactive=include_inactive,
limit=1,
now=self.now,
)
self.assertEqual(1, len(summaries))
self.assertEqual(1, len(statements))
self.assertIn("LIMIT", statements[0])
if not include_inactive:
self.assertEqual("active", summaries[0].status)
self.assertIn("revoked_at IS NULL", statements[0])
self.assertIn("expires_at >", statements[0])
finally:
event.remove(self.engine, "before_cursor_execute", capture_query)
def test_current_session_is_protected_and_revoke_others_skips_expired(self) -> None:
with self.assertRaisesRegex(ValueError, "current session"):
revoke_account_session(