feat: implement sanctions screening vertical
This commit is contained in:
57
tests/test_migrations.py
Normal file
57
tests/test_migrations.py
Normal file
@@ -0,0 +1,57 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from alembic.runtime.migration import MigrationContext
|
||||
from sqlalchemy import create_engine, inspect
|
||||
|
||||
from govoplan_core.db.migrations import migrate_database
|
||||
from govoplan_risk_compliance.backend.manifest import get_manifest
|
||||
|
||||
|
||||
class RiskComplianceMigrationTests(unittest.TestCase):
|
||||
def test_baseline_creates_screening_evidence_tables(self) -> None:
|
||||
with tempfile.TemporaryDirectory(
|
||||
prefix="govoplan-risk-migration-"
|
||||
) as directory:
|
||||
url = f"sqlite:///{Path(directory) / 'risk.db'}"
|
||||
migrate_database(
|
||||
database_url=url,
|
||||
enabled_modules=("risk_compliance",),
|
||||
manifest_factories=(get_manifest,),
|
||||
)
|
||||
engine = create_engine(url)
|
||||
try:
|
||||
with engine.connect() as connection:
|
||||
self.assertIn(
|
||||
"a8b9c0d1e2f3",
|
||||
set(
|
||||
MigrationContext.configure(
|
||||
connection
|
||||
).get_current_heads()
|
||||
),
|
||||
)
|
||||
tables = set(
|
||||
inspect(connection).get_table_names()
|
||||
)
|
||||
self.assertIn(
|
||||
"risk_sanctions_list_snapshots",
|
||||
tables,
|
||||
)
|
||||
self.assertIn("risk_screening_runs", tables)
|
||||
self.assertIn(
|
||||
"risk_screening_dispositions",
|
||||
tables,
|
||||
)
|
||||
self.assertIn(
|
||||
"risk_screening_exceptions",
|
||||
tables,
|
||||
)
|
||||
finally:
|
||||
engine.dispose()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user