Tests: pytest-Suite für Konten, Haushalt, Kanban, Reisen und Migrationen

- backend/tests: jede Test-Funktion bekommt eine frische Datenbank;
  test_migrationen.py baut ältere Datenbank-Stände nach und prüft die
  verlustfreie Umstellung (auch zweiter Start ohne Änderung)
- requirements-dev.txt mit pytest
- Fix (von den Tests gefunden): Eine neue, leere Datenbank bekam keine
  erste Liste "Zuhause"; jetzt einmalig beim ersten Start

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
guyg1474andClaude Opus 5.5 committed 2026-10-15 18:07:54 +02:00
1 parent dc4ce18593
commit 79cbaab092
10 files changed
+478

No files matched your search

+8
View File
@@ -273,6 +273,13 @@ def _migrate(conn) -> None:
"""
info = {r["name"]: r for r in conn.execute("PRAGMA table_info(household_items)")}
if "list_id" in info and info["list_id"]["notnull"]:
# Neue Datenbank: einmalig eine erste Liste anlegen (wer später alle löscht, bekommt keine zurück)
if get_meta(conn, "haushalt_start") is None:
if not conn.execute("SELECT 1 FROM shopping_lists").fetchone():
conn.execute(
"INSERT INTO shopping_lists (name, everyone, position, created_at) VALUES ('Zuhause', 1, 1, ?)", (now_iso(),)
)
conn.execute("INSERT INTO meta (key, value) VALUES ('haushalt_start', '1')")
return
row = conn.execute("SELECT id FROM shopping_lists ORDER BY position, id LIMIT 1").fetchone()
if row:
@@ -295,6 +302,7 @@ def _migrate(conn) -> None:
(default,),
)
conn.execute("DROP TABLE household_items_alt")
conn.execute("INSERT OR REPLACE INTO meta (key, value) VALUES ('haushalt_start', '1')")
def _migrate_checked(conn) -> None: