Profiles, presets and sequences export and import as main's bundles. Zones carry group_ids, preset_group_ids, sequence_ids, content_kind and brightness; profiles seed rainbow as colour_cycle, and deleting a profile also deletes its sequences. Groups, zones and sequences written by older versions are migrated at boot. /api/audio (status, event stream, start/stop, reset, anchor-bar, devices) maps main's audio detector onto the mic's beat detector. Audio start/stop picks whether mic beats or the BPM clock time sequences; the clock's beats also go to the drivers while the mic is off. /ws now greets from a post-handshake callback (httpd does not call the handler for the upgrade). The web UI is main's, plus v2's outputs editor, list search and hostname/static IP settings; the bridge, Wi-Fi AP and led-tool parts are gone. API tests follow main's behaviour (119 pass on the board). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
"""Scenes and palettes."""
|
|
|
|
from helpers import find_id_by_field, unique
|
|
|
|
|
|
def test_scenes(c):
|
|
name = unique("pytest-scene")
|
|
assert c.post("/scenes", json={"name": name}).status_code == 201
|
|
sid = find_id_by_field(c.get("/scenes").json(), "name", name)
|
|
assert c.get(f"/scenes/{sid}").status_code == 200
|
|
resp = c.put(f"/scenes/{sid}", json={"name": name + "-updated"})
|
|
assert resp.status_code == 200
|
|
assert resp.json()["name"].endswith("-updated")
|
|
assert c.delete(f"/scenes/{sid}").status_code == 200
|
|
|
|
|
|
def test_palettes(c):
|
|
resp = c.post("/palettes", json={"colors": ["#112233", "#445566"]})
|
|
assert resp.status_code == 201
|
|
pid = str(resp.json()["id"])
|
|
assert resp.json()["colors"] == ["#112233", "#445566"]
|
|
resp = c.get(f"/palettes/{pid}")
|
|
assert resp.status_code == 200
|
|
assert resp.json()["id"] == pid
|
|
resp = c.put(f"/palettes/{pid}", json={"colors": ["#000000"]})
|
|
assert resp.status_code == 200
|
|
assert resp.json()["colors"] == ["#000000"]
|
|
assert c.delete(f"/palettes/{pid}").status_code == 200
|
|
|
|
|
|
def test_palettes_list_is_colour_lists(c):
|
|
pid = str(c.post("/palettes", json={"colors": ["#abcdef"]}).json()["id"])
|
|
assert c.get("/palettes").json()[pid] == ["#abcdef"]
|
|
c.delete(f"/palettes/{pid}")
|