No automated tests #10
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
paul_loth/krautspaceTV#10
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
There are no tests anywhere in the repo — no unit tests for
db.py/rotation.py/sliderender()/is_available()functions, no integration test hitting the FastAPI app (e.g. viahttpx.AsyncClient+ ASGI transport, orTestClient), nothing for the/proxyHTML-rewriting logic.Given how much of this app's correctness depends on subtle async/state behavior (rotation loop, forced-slide interruption, the multi-process state issue in #1, the proxy regex rewrites in #5), even a small test suite would catch regressions that are currently only found by manually poking the live kiosk.
Suggested fix
Start with the cheapest-to-test, highest-value pieces:
backend/db.pyCRUD functions against a temp SQLite file.rotation.py'sRotationState(forced request/take, interruptible_sleep, snapshot timing) — pure asyncio, no I/O, easy to unit test./proxy's HTML rewriting functions (script stripping, theme link swap, cookie banner CSS) against fixed sample HTML strings.Fixed in
aff4ef0(merged to main at9960e8c): added the project's first test suite — 14 tests for backend/db.py (CRUD round-trips, move_slide boundary behavior, settings upsert) and 8 for rotation.py's RotationState (snapshot/countdown math, forced-slide request/take, interruptible_sleep). All 22 pass. See requirements-dev.txt + pytest.ini for how to run them.