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>
This commit is contained in:
1 parent
4b42391a46
commit
57182188ba
30 files changed
+2846
-425
No files matched your search
@@ -1,49 +1,15 @@
|
||||
from helpers import missing, unique
|
||||
|
||||
|
||||
@missing("settings defaults")
|
||||
def test_get_settings(c):
|
||||
resp = c.get("/settings")
|
||||
assert resp.status_code == 200
|
||||
assert "wifi_channel" in resp.json()
|
||||
|
||||
|
||||
@missing("/settings/wifi/ap")
|
||||
def test_wifi_ap_get(c):
|
||||
resp = c.get("/settings/wifi/ap")
|
||||
assert resp.status_code == 200
|
||||
ap = resp.json()
|
||||
assert "saved_ssid" in ap
|
||||
assert "active" in ap
|
||||
|
||||
|
||||
@missing("/settings/wifi/ap")
|
||||
def test_wifi_ap_post(c):
|
||||
ssid = unique("pytest-ssid")
|
||||
resp = c.post("/settings/wifi/ap", json={"ssid": ssid, "password": "secret", "channel": 1})
|
||||
assert resp.status_code == 200
|
||||
assert resp.json()["ssid"] == ssid
|
||||
assert resp.json()["channel"] == 1
|
||||
assert c.get("/settings/wifi/ap").json()["saved_ssid"] == ssid
|
||||
|
||||
|
||||
@missing("/settings/wifi/ap")
|
||||
def test_wifi_ap_rejects_bad_channel(c):
|
||||
resp = c.post("/settings/wifi/ap", json={"ssid": "bad-ssid", "password": "secret", "channel": 12})
|
||||
assert resp.status_code == 400
|
||||
|
||||
|
||||
@missing("/settings/wifi/ap")
|
||||
def test_wifi_ap_requires_ssid(c):
|
||||
assert c.post("/settings/wifi/ap", json={"password": "secret"}).status_code == 400
|
||||
|
||||
|
||||
def test_wifi_channel(c):
|
||||
assert c.put("/settings/settings", json={"wifi_channel": 11}).status_code == 200
|
||||
assert c.get("/settings").json()["wifi_channel"] == 11
|
||||
|
||||
|
||||
@missing("settings validation")
|
||||
def test_wifi_channel_out_of_range(c):
|
||||
assert c.put("/settings/settings", json={"wifi_channel": 12}).status_code == 400
|
||||
|
||||
@@ -53,6 +19,5 @@ def test_global_brightness(c):
|
||||
assert c.get("/settings").json().get("global_brightness") == 42
|
||||
|
||||
|
||||
@missing("settings validation")
|
||||
def test_global_brightness_out_of_range(c):
|
||||
assert c.put("/settings/settings", json={"global_brightness": 300}).status_code == 400
|
||||
Reference in new issue
Block a user