Validate device automation capablities WS calls (#58444)
This commit is contained in:
parent
ac5e32d648
commit
77d02d08bc
2 changed files with 14 additions and 6 deletions
|
@ -316,7 +316,9 @@ async def websocket_device_automation_get_action_capabilities(hass, connection,
|
|||
@websocket_api.websocket_command(
|
||||
{
|
||||
vol.Required("type"): "device_automation/condition/capabilities",
|
||||
vol.Required("condition"): dict,
|
||||
vol.Required("condition"): cv.DEVICE_CONDITION_BASE_SCHEMA.extend(
|
||||
{}, extra=vol.ALLOW_EXTRA
|
||||
),
|
||||
}
|
||||
)
|
||||
@websocket_api.async_response
|
||||
|
@ -333,7 +335,9 @@ async def websocket_device_automation_get_condition_capabilities(hass, connectio
|
|||
@websocket_api.websocket_command(
|
||||
{
|
||||
vol.Required("type"): "device_automation/trigger/capabilities",
|
||||
vol.Required("trigger"): dict,
|
||||
vol.Required("trigger"): DEVICE_TRIGGER_BASE_SCHEMA.extend(
|
||||
{}, extra=vol.ALLOW_EXTRA
|
||||
),
|
||||
}
|
||||
)
|
||||
@websocket_api.async_response
|
||||
|
|
|
@ -341,7 +341,7 @@ async def test_websocket_get_bad_condition_capabilities(
|
|||
{
|
||||
"id": 1,
|
||||
"type": "device_automation/condition/capabilities",
|
||||
"condition": {"domain": "beer"},
|
||||
"condition": {"condition": "device", "domain": "beer", "device_id": "1234"},
|
||||
}
|
||||
)
|
||||
msg = await client.receive_json()
|
||||
|
@ -364,7 +364,11 @@ async def test_websocket_get_no_condition_capabilities(
|
|||
{
|
||||
"id": 1,
|
||||
"type": "device_automation/condition/capabilities",
|
||||
"condition": {"domain": "deconz"},
|
||||
"condition": {
|
||||
"condition": "device",
|
||||
"domain": "deconz",
|
||||
"device_id": "abcd",
|
||||
},
|
||||
}
|
||||
)
|
||||
msg = await client.receive_json()
|
||||
|
@ -531,7 +535,7 @@ async def test_websocket_get_bad_trigger_capabilities(
|
|||
{
|
||||
"id": 1,
|
||||
"type": "device_automation/trigger/capabilities",
|
||||
"trigger": {"domain": "beer"},
|
||||
"trigger": {"platform": "device", "domain": "beer", "device_id": "abcd"},
|
||||
}
|
||||
)
|
||||
msg = await client.receive_json()
|
||||
|
@ -554,7 +558,7 @@ async def test_websocket_get_no_trigger_capabilities(
|
|||
{
|
||||
"id": 1,
|
||||
"type": "device_automation/trigger/capabilities",
|
||||
"trigger": {"domain": "deconz"},
|
||||
"trigger": {"platform": "device", "domain": "deconz", "device_id": "abcd"},
|
||||
}
|
||||
)
|
||||
msg = await client.receive_json()
|
||||
|
|
Loading…
Add table
Reference in a new issue