Enforce parent device hierarchy: slots/size unset, battery summary, sub-component toggle
This commit is contained in:
@@ -584,12 +584,6 @@ def test_add_install_delete_battery(client):
|
||||
# Device — battery_size
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
def test_add_device_requires_battery_size(client):
|
||||
"""POST without battery_size returns 400."""
|
||||
resp = client.post("/device/add", data={"name": "No Size Device", "battery_slots": "2"})
|
||||
assert resp.status_code == 400
|
||||
assert b"Battery size is required" in resp.data
|
||||
|
||||
|
||||
def test_add_device_with_battery_size(client):
|
||||
"""Device with battery_size shows it on detail page."""
|
||||
@@ -893,7 +887,7 @@ def test_device_charge_all_no_installed(seeded_client):
|
||||
|
||||
def _setup_rc_car(client):
|
||||
"""Create RC Car Set with Remote and Car sub-components and 6 AA batteries."""
|
||||
client.post("/device/add", data={"name": "RC Car Set", "battery_slots": "6", "battery_size": "AA"})
|
||||
client.post("/device/add", data={"name": "RC Car Set", "battery_slots": "0", "battery_size": ""})
|
||||
# id=1 above; add sub-components with parent_id=1
|
||||
client.post("/device/add", data={"name": "Remote", "battery_slots": "2",
|
||||
"battery_size": "AA", "parent_id": "1"})
|
||||
@@ -967,7 +961,7 @@ def test_device_without_parent_unchanged(client):
|
||||
|
||||
|
||||
def test_subcomponent_ha_entity_id(client):
|
||||
client.post("/device/add", data={"name": "Hub", "battery_slots": "1", "battery_size": "AA"})
|
||||
client.post("/device/add", data={"name": "Hub", "battery_slots": "0", "battery_size": ""})
|
||||
resp = client.post(
|
||||
"/device/add",
|
||||
data={"name": "Sensor A", "battery_slots": "1", "battery_size": "AA",
|
||||
|
||||
Reference in New Issue
Block a user