refactor(api): complete fastapi migration and related features
Finish native FastAPI controllers, drop vendored microdot, and add Wi-Fi driver runtime, beat SSE, simulated BPM, sequence playback improvements, bridge ESP-NOW sources, UI updates, and tests. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -55,6 +55,9 @@ def test_main_routes(server):
|
||||
|
||||
with c.websocket_connect("/ws") as ws:
|
||||
ws.send_text('{"v":"1","select":["off"]}')
|
||||
snapshot = ws.receive_json()
|
||||
assert snapshot.get("type") == "device_tcp_snapshot"
|
||||
assert isinstance(snapshot.get("connected_ips"), list)
|
||||
|
||||
|
||||
def test_settings_controller(server):
|
||||
@@ -66,6 +69,9 @@ def test_settings_controller(server):
|
||||
data = resp.json()
|
||||
assert isinstance(data, dict)
|
||||
assert "wifi_channel" in data
|
||||
assert "wifi_driver_ws_port" in data
|
||||
assert "wifi_driver_ws_path" in data
|
||||
assert data.get("wifi_driver_ws_path") == "/ws"
|
||||
|
||||
resp = c.get(f"{base_url}/settings/wifi/ap")
|
||||
assert resp.status_code == 200
|
||||
@@ -183,6 +189,37 @@ def test_profiles_presets_zones_endpoints(server, monkeypatch):
|
||||
assert sent_result["presets_sent"] >= 1
|
||||
assert len(bridge.sent) >= 1
|
||||
|
||||
wifi_sends = []
|
||||
|
||||
async def _fake_wifi_send(ip, msg):
|
||||
wifi_sends.append((ip, msg))
|
||||
return True
|
||||
|
||||
import util.driver_delivery as driver_delivery_mod
|
||||
|
||||
monkeypatch.setattr(driver_delivery_mod, "send_json_line_to_ip", _fake_wifi_send)
|
||||
resp = c.post(
|
||||
f"{base_url}/devices",
|
||||
json={
|
||||
"name": "pytest-wifi-preset",
|
||||
"transport": "wifi",
|
||||
"address": "192.168.50.20",
|
||||
"mac": "203040506070",
|
||||
},
|
||||
)
|
||||
assert resp.status_code == 201
|
||||
bridge.sent.clear()
|
||||
resp = c.post(
|
||||
f"{base_url}/presets/send",
|
||||
json={"preset_ids": [new_preset_id], "save": False},
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
assert len(bridge.sent) >= 1
|
||||
assert len(wifi_sends) >= 1
|
||||
assert wifi_sends[0][0] == "192.168.50.20"
|
||||
resp = c.delete(f"{base_url}/devices/203040506070")
|
||||
assert resp.status_code == 200
|
||||
|
||||
resp = c.delete(f"{base_url}/presets/{new_preset_id}")
|
||||
assert resp.status_code == 200
|
||||
resp = c.get(f"{base_url}/presets/{new_preset_id}")
|
||||
|
||||
Reference in New Issue
Block a user