fix: align schema 15 settlement tests and integer validation

This commit is contained in:
2026-10-17 15:58:28 +09:00
parent 38a854d525
commit a97548c36b
8 changed files with 76 additions and 144 deletions
+3 -3
View File
@@ -13,11 +13,11 @@ def _insert_sql():
VALUES (?, ?, ?, 'draft', 1, 'tester', '2026-10-15T00:00:00+09:00', 'tester', '2026-10-15T00:00:00+09:00')"""
def test_fresh_db_has_month_settlement_schema_16_without_latest_run_id(tmp_path):
def test_fresh_db_has_month_settlement_schema_15_without_latest_run_id(tmp_path):
path = str(tmp_path / "fresh.sqlite3")
init_db(path)
with sqlite3.connect(path) as conn:
assert conn.execute("SELECT value FROM schema_meta WHERE key='schema_version'").fetchone()[0] == "16"
assert conn.execute("SELECT value FROM schema_meta WHERE key='schema_version'").fetchone()[0] == "15"
assert conn.execute("SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='monthly_settlement'").fetchone()[0] == 1
columns = {row[1]: row for row in conn.execute("PRAGMA table_info(monthly_settlement)")}
assert columns["approval_flags_json"][4] == "'{}'"
@@ -57,7 +57,7 @@ def test_schema15_upgrade_drops_only_latest_run_id_and_preserves_closed_row(tmp_
init_db(path)
init_db(path)
with sqlite3.connect(path) as conn:
assert conn.execute("SELECT value FROM schema_meta WHERE key='schema_version'").fetchone()[0] == "16"
assert conn.execute("SELECT value FROM schema_meta WHERE key='schema_version'").fetchone()[0] == "15"
assert conn.execute("SELECT id,month,basis_date,status,version,memo,approved_by,closed_by FROM monthly_settlement").fetchall() == before
assert "latest_run_id" not in {row[1] for row in conn.execute("PRAGMA table_info(monthly_settlement)")}
assert conn.execute("PRAGMA foreign_key_list(monthly_settlement)").fetchall() == []