update
This commit is contained in:
@@ -104,6 +104,13 @@ async def test_pull_prefers_bigger_blocks(testdb):
|
||||
await db.kanban_upsert_card(TOPIC, "inventory", "b", "block", "s1")
|
||||
pulled = await db.kanban_pull(TOPIC, "inventory", "s1", 10)
|
||||
assert [c["card_id"] for c in pulled] == ["a", "b"]
|
||||
# n_size (Board 1) ist der Fallback-Schätzer; subs_n behält Vorrang
|
||||
await db.kanban_upsert_card(TOPIC, "inventory", "n-klein", "block", "s2", {"n_size": 2})
|
||||
await db.kanban_upsert_card(TOPIC, "inventory", "n-gross", "block", "s2", {"n_size": 9})
|
||||
await db.kanban_upsert_card(TOPIC, "inventory", "n-ohne", "block", "s2")
|
||||
await db.kanban_upsert_card(TOPIC, "inventory", "n-subs", "block", "s2", {"subs_n": 3, "n_size": 1})
|
||||
pulled = await db.kanban_pull(TOPIC, "inventory", "s2", 10)
|
||||
assert [c["card_id"] for c in pulled] == ["n-gross", "n-subs", "n-klein", "n-ohne"]
|
||||
|
||||
|
||||
async def test_learnstate_smoke(testdb):
|
||||
@@ -172,3 +179,50 @@ async def test_guide_reset_card_single(testdb):
|
||||
assert await gb.reset_card(TOPIC, "Guide", "beta", 3) is True
|
||||
cards = {c["block_norm"]: c for c in await db.list_guide_cards(TOPIC, "Guide")}
|
||||
assert cards["beta"]["stage"] == "fakten_gate" and cards["beta"]["md"]
|
||||
|
||||
|
||||
async def test_completeness_route(testdb, tmp_path, monkeypatch):
|
||||
import routes, paths
|
||||
db = testdb
|
||||
monkeypatch.setattr(paths, "arbeit_dir", lambda t: tmp_path)
|
||||
await db.upsert_block(TOPIC, "alpha", "Alpha", "d", "[]")
|
||||
await db.set_block_status(TOPIC, "alpha", "consensus")
|
||||
await db.upsert_subblock(TOPIC, "alpha", "s1", "Alpha", "Sub Eins")
|
||||
await db.set_subblock_fields(TOPIC, "alpha", "s1", status="consensus")
|
||||
await db.upsert_question_pattern(TOPIC, "alpha", "s1", "Alpha", "Sub Eins", "Frage?")
|
||||
await db.put_sub_artifact(TOPIC, "alpha", "s1", "flashcard", "Alpha", "Sub Eins", "{}")
|
||||
await db.put_lernziel(TOPIC, "alpha", "z1", "Ziel")
|
||||
await db.set_ziel_covered(TOPIC, "alpha", "z1", True)
|
||||
(tmp_path / "inventar-filter-x.json").write_text(
|
||||
'{"degradiert": 3, "ueberstimmt": ["A"], "floor_veto": []}', encoding="utf-8")
|
||||
res = await routes.blocks_completeness(TOPIC)
|
||||
assert res["bloecke"] == 1 and res["subs"] == 1
|
||||
assert res["frage_bloecke"] == 1 and res["lernkarten"] == 1
|
||||
assert res["ziele_total"] == 1 and res["ziele_covered"] == 1
|
||||
assert res["degradiert_geprueft"] == 3 and res["panel_gerettet"] == 1
|
||||
assert res["dead"] == 0
|
||||
|
||||
|
||||
async def test_blocks_ready_from_db(testdb, monkeypatch):
|
||||
"""Regression: gesynctes Topic ohne blocks.md muss trotzdem ready sein (DB zählt)."""
|
||||
import blocks as blx
|
||||
db = testdb
|
||||
await db.kanban_upsert_card(TOPIC, "inventory", "b-1", "block", "done_block", {"title": "Alpha"})
|
||||
st = await blx.blocks_status(TOPIC)
|
||||
assert st["ready"] is True and st["partial"] is False
|
||||
|
||||
|
||||
async def test_remove_guide_format_clears_everything(testdb, monkeypatch):
|
||||
"""Board-Remove räumt ALLE Läufe eines Formats + Karten (8 error-Zeilen stapelten sich)."""
|
||||
import routes
|
||||
from models import GuideFormatRequest
|
||||
db = testdb
|
||||
for i in range(3):
|
||||
await db.create_guide({"id": f"g{i}", "topic": TOPIC, "format": "Guide",
|
||||
"instructions": "", "status": "error", "progress": None,
|
||||
"created_at": "2026-01-01", "updated_at": "2026-01-01"})
|
||||
await db.upsert_guide_card(TOPIC, "Guide", "alpha", "Alpha")
|
||||
res = await routes.remove_guide_format(GuideFormatRequest(topic=TOPIC, format="Guide"))
|
||||
assert res["removed"] == 3
|
||||
assert await db.list_guides() == [] or all(g["topic"] != TOPIC for g in await db.list_guides())
|
||||
assert await db.list_guide_cards(TOPIC, "Guide") == []
|
||||
|
||||
Reference in New Issue
Block a user