feat: add governed payment request slice
Module Package Release / publish-packages (push) Successful in 13s
Module Package Release / publish-packages (push) Successful in 13s
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
from alembic.runtime.migration import MigrationContext
|
||||
from sqlalchemy import create_engine, inspect
|
||||
|
||||
from govoplan_core.db.migrations import migrate_database
|
||||
from govoplan_payments.backend.manifest import get_manifest
|
||||
|
||||
|
||||
class PaymentsMigrationTests(unittest.TestCase):
|
||||
def test_fresh_migration_creates_payment_evidence_tables(self) -> None:
|
||||
with tempfile.TemporaryDirectory(prefix="govoplan-payments-") as directory:
|
||||
url = f"sqlite:///{Path(directory) / 'payments.db'}"
|
||||
migrate_database(
|
||||
database_url=url,
|
||||
enabled_modules=("payments",),
|
||||
manifest_factories=(get_manifest,),
|
||||
)
|
||||
engine = create_engine(url)
|
||||
try:
|
||||
self.assertTrue(
|
||||
{
|
||||
"payment_obligations",
|
||||
"payment_reconciliations",
|
||||
"payment_events",
|
||||
}.issubset(set(inspect(engine).get_table_names()))
|
||||
)
|
||||
with engine.connect() as connection:
|
||||
self.assertIn(
|
||||
"e7b9c1d3f5a7",
|
||||
set(MigrationContext.configure(connection).get_current_heads()),
|
||||
)
|
||||
finally:
|
||||
engine.dispose()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user