feat: implement committee decision workspace
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_committee.backend.manifest import get_manifest
|
||||
from govoplan_core.db.migrations import migrate_database
|
||||
|
||||
|
||||
class CommitteeMigrationTests(unittest.TestCase):
|
||||
def test_fresh_migration_creates_committee_workspace_and_head(self) -> None:
|
||||
with tempfile.TemporaryDirectory(prefix="govoplan-committee-migration-") as directory:
|
||||
url = f"sqlite:///{Path(directory) / 'committee.db'}"
|
||||
migrate_database(
|
||||
database_url=url,
|
||||
enabled_modules=("committee",),
|
||||
manifest_factories=(get_manifest,),
|
||||
)
|
||||
engine = create_engine(url)
|
||||
try:
|
||||
self.assertTrue(
|
||||
{
|
||||
"committee_decision_projections",
|
||||
"committee_workspace_events",
|
||||
"committee_workspace_revisions",
|
||||
}.issubset(inspect(engine).get_table_names())
|
||||
)
|
||||
with engine.connect() as connection:
|
||||
self.assertIn(
|
||||
"d8b9f0a1c2e3",
|
||||
set(MigrationContext.configure(connection).get_current_heads()),
|
||||
)
|
||||
finally:
|
||||
engine.dispose()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user