25 lines
828 B
Python
25 lines
828 B
Python
import shutil
|
|
|
|
import admin_analytics.config as config
|
|
from admin_analytics.config import UD_UNITID
|
|
from admin_analytics.ipeds.finance import load_finance
|
|
|
|
|
|
def test_load_finance_filters_to_ud(db_conn, fixtures_dir, tmp_path):
|
|
ipeds_dir = tmp_path / "ipeds" / "finance" / "2023"
|
|
ipeds_dir.mkdir(parents=True)
|
|
shutil.copy(fixtures_dir / "f1a2023.csv", ipeds_dir / "f1a2023.csv")
|
|
|
|
original = config.IPEDS_DATA_DIR
|
|
config.IPEDS_DATA_DIR = tmp_path / "ipeds"
|
|
try:
|
|
count = load_finance(db_conn, range(2023, 2024), unitid_filter=UD_UNITID)
|
|
finally:
|
|
config.IPEDS_DATA_DIR = original
|
|
|
|
assert count == 1
|
|
row = db_conn.execute(
|
|
"SELECT institutional_support_expenses FROM raw_ipeds_finance WHERE unitid = ?",
|
|
[UD_UNITID],
|
|
).fetchone()
|
|
assert row[0] == 150000000
|