Catch device not found in device automations (#31401)

This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2020-02-02 07:13:07 -08:00
1 parent 55aa341dab
commit 7127310f10
3 files changed
+45 -1

No files matched your search

@@ -761,3 +761,17 @@ async def test_automation_with_bad_trigger(hass, caplog):
)
assert "required key not provided" in caplog.text
async def test_websocket_device_not_found(hass, hass_ws_client):
"""Test caling command with unknown device."""
await async_setup_component(hass, "device_automation", {})
client = await hass_ws_client(hass)
await client.send_json(
{"id": 1, "type": "device_automation/action/list", "device_id": "non-existing"}
)
msg = await client.receive_json()
assert msg["id"] == 1
assert not msg["success"]
assert msg["error"] == {"code": "not_found", "message": "Device not found"}