Raise when zwave_js device automation fails validation (#65610)

This commit is contained in:
Raman Gupta
2022-02-04 11:55:51 -08:00
committed by Paulus Schoutsen
parent 3babc43fa5
commit 9eeaec4f79
5 changed files with 55 additions and 3 deletions
@@ -596,6 +596,23 @@ async def test_failure_scenarios(hass, client, hank_binary_switch, integration):
== INVALID_CONFIG
)
# Test invalid device ID fails validation
with pytest.raises(InvalidDeviceAutomationConfig):
await device_condition.async_validate_condition_config(
hass,
{
"condition": "device",
"domain": DOMAIN,
"type": "value",
"device_id": "invalid_device_id",
"command_class": CommandClass.DOOR_LOCK.value,
"property": 9999,
"property_key": 9999,
"endpoint": 9999,
"value": 9999,
},
)
async def test_get_value_from_config_failure(
hass, client, hank_binary_switch, integration
@@ -1370,3 +1370,19 @@ async def test_failure_scenarios(hass, client, hank_binary_switch, integration):
await device_trigger.async_validate_trigger_config(hass, INVALID_CONFIG)
== INVALID_CONFIG
)
# Test invalid device ID fails validation
with pytest.raises(InvalidDeviceAutomationConfig):
await device_trigger.async_validate_trigger_config(
hass,
{
"platform": "device",
"domain": DOMAIN,
"device_id": "invalid_device_id",
"type": "zwave_js.value_updated.value",
"command_class": CommandClass.DOOR_LOCK.value,
"property": 9999,
"property_key": 9999,
"endpoint": 9999,
},
)