Files
led-controller/test/api
jimmyandClaude Opus 5.5 19fea0b0a1 feat: ping drivers and push groups from the devices modal
POST /devices/ping broadcasts an ESP-NOW PING_REQ, collects the drivers'
PING_RSP for timeout_s and registers or renames the ones that answer. A
reply also counts as the driver being heard, so group updates go to it
again. POST /devices/groups sends every ESP-NOW driver its groups and
reports the acks. The devices modal gets the Ping drivers and Update
groups buttons from main, with per-driver ping dots.

UI files are now served with Cache-Control: no-cache and the firmware
build hash as ETag, so a browser picks up a new UI right after an update
instead of a day later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 17:53:56 +13:00
..

API tests

HTTP tests against a running controller, ported from the v1 Python app's tests/test_endpoints_pytest.py and tests/test_endpoints.py. They need pytest and requests.

make test-api HOST=10.1.1.180

or python3 -m pytest test/api --host <ip> (or set LED_HOST). Without a host every test is skipped.

The tests create and delete profiles, presets, zones and so on. Before the run they save every collection (GET /db/<name>), and afterwards they write each one back (PUT /db/<name>). Zone play and preset send do go out over ESP-NOW. They use made-up driver names (pytest-a, pytest-nobody) so real drivers ignore them.

v1 features v2 does not have yet

A test for v1 behaviour that v2 is missing is marked @missing("<feature>"). That is a strict xfail, so the test shows as x, and it fails as XPASS(strict) once the feature works. When that happens, remove the marker. To list what is still missing:

python3 -m pytest test/api --host <ip> -rx

v1 tests that were not ported:

  • the model and engine unit tests (tests/models/, tests/engine_tests/), which test Python modules that have no C counterpart;
  • the Wi-Fi/TCP/UDP driver test servers.

The checks on exact driver messages became checks on status codes and replies, because ESP-NOW frames can't be captured from outside the board.

The Selenium UI tests are in test/browser/ (make test-browser HOST=<ip>).