AdminAnalytics/tests/test_db_schema.py
2026-03-30 07:15:14 -04:00

22 lines
729 B
Python

def test_tables_created(db_conn):
tables = db_conn.execute(
"SELECT table_name FROM information_schema.tables WHERE table_schema = 'main'"
).fetchall()
table_names = {t[0] for t in tables}
expected = {
"raw_institution",
"raw_ipeds_finance",
"raw_ipeds_staff",
"raw_ipeds_enrollment",
"raw_990_filing",
"raw_990_schedule_j",
"raw_990_part_vii",
"raw_cpi_u",
}
assert expected.issubset(table_names)
def test_schema_idempotent(db_conn):
"""Calling ensure_schema twice should not raise."""
from admin_analytics.db.schema import ensure_schema
ensure_schema(db_conn) # already called in fixture; second call should be fine