test: make full discovery optional-state independent

This commit is contained in:
2026-08-19 19:20:05 +02:00
parent ffaab543d2
commit d600bca374
3 changed files with 74 additions and 10 deletions
+15
View File
@@ -14,11 +14,22 @@ from govoplan_core.core.principal_cache import (
auth_principal_revision,
invalidate_auth_principals,
)
from govoplan_core.core.runtime import (
clear_runtime,
configure_runtime,
get_runtime_context,
)
from govoplan_core.db.base import Base
class AuthPrincipalRevisionTests(unittest.TestCase):
def setUp(self) -> None:
# These tests create only the Core change-sequence tables. Keep them
# independent of a registry configured by an earlier discovery test;
# that registry may expose an optional durable Audit outbox whose
# tables intentionally are not part of this fixture.
self._runtime_context = get_runtime_context()
clear_runtime()
self.engine = create_engine("sqlite:///:memory:")
Base.metadata.create_all(
bind=self.engine,
@@ -31,6 +42,10 @@ class AuthPrincipalRevisionTests(unittest.TestCase):
def tearDown(self) -> None:
self.engine.dispose()
if self._runtime_context is None:
clear_runtime()
else:
configure_runtime(self._runtime_context)
def test_revisions_are_tenant_scoped_and_include_system_changes(self) -> None:
with self.SessionLocal() as session: