Files
led-controller/test/api
jimmyandClaude Opus 5.5 57182188ba feat: port the remaining v1 API to the v2 controller
Profiles seed presets, a default zone and a palette, and clone with their
own copies; deleting a profile removes what it owned. Zones get the v1
list shape, set-current, current, clone and content-fragment. Devices are
keyed by MAC with v1 validation and identify. Patterns: definitions, OTA
file and manifest, upload, driver, and send over ESP-NOW (the led-driver
pattern sources are embedded in the firmware). Pixel outputs get v1
validation and a DDP/Art-Net/sACN test pattern. Sequences, palettes and
settings follow v1 replies and validation, and /ws forwards browser
messages to the drivers.

The resource handlers move out of api.c into res_*.c, patterns.c and
outputs.c. cJSON now allocates from PSRAM: the store had grown enough to
starve internal RAM and abort the mic at boot. /status reports
free_internal.

The Wi-Fi AP and led-tool routes are left out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 09:58:17 +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>).