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
-11
@@ -1,6 +1,6 @@
|
||||
import pytest
|
||||
|
||||
from helpers import missing, new_id, unique
|
||||
from helpers import new_id, unique
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -21,7 +21,6 @@ def zone(c, profile):
|
||||
c.delete(f"/zones/{zid}")
|
||||
|
||||
|
||||
@missing("v1 zone list shape and profile zone order")
|
||||
def test_list(c, profile, zone):
|
||||
resp = c.get("/zones")
|
||||
assert resp.status_code == 200
|
||||
@@ -32,12 +31,10 @@ def test_list(c, profile, zone):
|
||||
assert "current_zone_id" in data
|
||||
|
||||
|
||||
@missing("adding new zones to the current profile")
|
||||
def test_create_adds_to_profile(c, profile, zone):
|
||||
assert zone in c.get(f"/profiles/{profile}").json()["zones"]
|
||||
|
||||
|
||||
@missing("zone validation")
|
||||
def test_create_requires_name(c, profile):
|
||||
assert c.post("/zones", json={"names": ["1"]}).status_code == 400
|
||||
|
||||
@@ -48,7 +45,6 @@ def test_get(c, zone):
|
||||
assert resp.json()["name"].startswith("pytest-zone")
|
||||
|
||||
|
||||
@missing("zone set-current")
|
||||
def test_set_current(c, zone):
|
||||
resp = c.post(f"/zones/{zone}/set-current")
|
||||
assert resp.status_code == 200
|
||||
@@ -59,7 +55,6 @@ def test_set_current(c, zone):
|
||||
assert resp.json()["zone_id"] == zone
|
||||
|
||||
|
||||
@missing("zone set-current")
|
||||
def test_set_current_unknown(c):
|
||||
assert c.post("/zones/999999/set-current").status_code == 404
|
||||
|
||||
@@ -75,7 +70,6 @@ def test_edit_workflow(c, zone):
|
||||
assert stored["names"] == ["2", "3", "4"]
|
||||
|
||||
|
||||
@missing("zone clone")
|
||||
def test_clone(c, profile, zone):
|
||||
resp = c.post(f"/zones/{zone}/clone", json={"name": "pytest-zone-clone"})
|
||||
assert resp.status_code == 201
|
||||
@@ -88,7 +82,6 @@ def test_clone(c, profile, zone):
|
||||
assert c.delete(f"/zones/{clone}").status_code == 200
|
||||
|
||||
|
||||
@missing("zone clone")
|
||||
def test_clone_default_name(c, zone):
|
||||
resp = c.post(f"/zones/{zone}/clone", json={})
|
||||
clone = new_id(resp)
|
||||
@@ -96,14 +89,12 @@ def test_clone_default_name(c, zone):
|
||||
c.delete(f"/zones/{clone}")
|
||||
|
||||
|
||||
@missing("zone content-fragment")
|
||||
def test_content_fragment(c, zone):
|
||||
resp = c.get(f"/zones/{zone}/content-fragment", headers={"HX-Request": "true", "Accept": "text/html"})
|
||||
assert resp.status_code == 200
|
||||
assert f'data-zone-id="{zone}"' in resp.text
|
||||
|
||||
|
||||
@missing("removing deleted zones from the profile")
|
||||
def test_delete_removes_from_profile(c, profile):
|
||||
zid = new_id(c.post("/zones", json={"name": unique("pytest-zone"), "names": ["1"]}))
|
||||
assert c.delete(f"/zones/{zid}").status_code == 200
|
||||
@@ -119,7 +110,6 @@ def test_play_unknown_preset(c, zone):
|
||||
assert c.post(f"/zones/{zone}/play", json={"preset_id": "nope"}).status_code == 404
|
||||
|
||||
|
||||
@missing("zone stop reply ({stopped})")
|
||||
def test_play_and_stop(c, zone):
|
||||
preset = new_id(c.post("/presets", json={"name": "pytest-on", "pattern": "on", "colors": ["#ff0000"]}))
|
||||
resp = c.post(f"/zones/{zone}/play", json={"preset_id": preset})
|
||||
|
||||
Reference in new issue
Block a user