Files
X-Financial/server/tests/test_schema_ownership.py

27 lines
727 B
Python
Raw Normal View History

from __future__ import annotations
from sqlalchemy import create_engine, inspect
from app.db.schema_ownership import MIGRATION_OWNED_TABLES, create_legacy_schema
def test_create_legacy_schema_never_creates_migration_owned_tables() -> None:
engine = create_engine("sqlite+pysqlite:///:memory:")
try:
create_legacy_schema(engine)
table_names = set(inspect(engine).get_table_names())
finally:
engine.dispose()
assert MIGRATION_OWNED_TABLES == frozenset(
{
"auth_sessions",
"business_events",
"expense_case_links",
"expense_cases",
}
)
assert table_names
assert table_names.isdisjoint(MIGRATION_OWNED_TABLES)