Improve validation of device action config (#27029)
This commit is contained in:
parent
2090d650c6
commit
5a1da72d5e
3 changed files with 64 additions and 11 deletions
|
@ -185,6 +185,25 @@ async def test_automation_with_non_existing_integration(hass, caplog):
|
|||
assert "Integration 'beer' not found" in caplog.text
|
||||
|
||||
|
||||
async def test_automation_with_integration_without_device_action(hass, caplog):
|
||||
"""Test automation with integration without device action support."""
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
automation.DOMAIN,
|
||||
{
|
||||
automation.DOMAIN: {
|
||||
"alias": "hello",
|
||||
"trigger": {"platform": "event", "event_type": "test_event1"},
|
||||
"action": {"device_id": "", "domain": "test"},
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
assert (
|
||||
"Integration 'test' does not support device automation actions" in caplog.text
|
||||
)
|
||||
|
||||
|
||||
async def test_automation_with_integration_without_device_trigger(hass, caplog):
|
||||
"""Test automation with integration without device trigger support."""
|
||||
assert await async_setup_component(
|
||||
|
@ -208,6 +227,23 @@ async def test_automation_with_integration_without_device_trigger(hass, caplog):
|
|||
)
|
||||
|
||||
|
||||
async def test_automation_with_bad_action(hass, caplog):
|
||||
"""Test automation with bad device action."""
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
automation.DOMAIN,
|
||||
{
|
||||
automation.DOMAIN: {
|
||||
"alias": "hello",
|
||||
"trigger": {"platform": "event", "event_type": "test_event1"},
|
||||
"action": {"device_id": "", "domain": "light"},
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
assert "required key not provided" in caplog.text
|
||||
|
||||
|
||||
async def test_automation_with_bad_trigger(hass, caplog):
|
||||
"""Test automation with bad device trigger."""
|
||||
assert await async_setup_component(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue