test: port the v1 endpoint and browser tests to v2
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>
This commit is contained in:
1 parent
9d628aa3c8
commit
4b42391a46
15 files changed
+2055
-1
No files matched your search
@@ -0,0 +1,58 @@
|
||||
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
|
||||
|
||||
|
||||
def test_global_brightness(c):
|
||||
assert c.put("/settings/settings", json={"global_brightness": 42}).status_code == 200
|
||||
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