HTTP tests against a running controller (make test-api HOST=ip). They snapshot every collection through /db and restore it afterwards. v1 behaviour v2 does not have yet is marked as a strict xfail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 lines
1.4 KiB
Markdown
28 lines
1.4 KiB
Markdown
# 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`.
|
|
|
|
```bash
|
|
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:
|
|
|
|
```bash
|
|
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>`).
|