mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Revert "Improve device_automation trigger validation" (#79778)
Revert "Improve device_automation trigger validation (#75044)"
This reverts commit 55b036ec5e.
This commit is contained in:
@@ -720,28 +720,7 @@ async def test_automation_with_bad_condition_action(hass, caplog):
|
||||
assert "required key not provided" in caplog.text
|
||||
|
||||
|
||||
async def test_automation_with_bad_condition_missing_domain(hass, caplog):
|
||||
"""Test automation with bad device condition."""
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
automation.DOMAIN,
|
||||
{
|
||||
automation.DOMAIN: {
|
||||
"alias": "hello",
|
||||
"trigger": {"platform": "event", "event_type": "test_event1"},
|
||||
"condition": {"condition": "device", "device_id": "hello.device"},
|
||||
"action": {"service": "test.automation", "entity_id": "hello.world"},
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
assert (
|
||||
"Invalid config for [automation]: required key not provided @ data['condition'][0]['domain']"
|
||||
in caplog.text
|
||||
)
|
||||
|
||||
|
||||
async def test_automation_with_bad_condition_missing_device_id(hass, caplog):
|
||||
async def test_automation_with_bad_condition(hass, caplog):
|
||||
"""Test automation with bad device condition."""
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
@@ -756,10 +735,7 @@ async def test_automation_with_bad_condition_missing_device_id(hass, caplog):
|
||||
},
|
||||
)
|
||||
|
||||
assert (
|
||||
"Invalid config for [automation]: required key not provided @ data['condition'][0]['device_id']"
|
||||
in caplog.text
|
||||
)
|
||||
assert "required key not provided" in caplog.text
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -900,25 +876,8 @@ async def test_automation_with_bad_sub_condition(hass, caplog):
|
||||
assert "required key not provided" in caplog.text
|
||||
|
||||
|
||||
async def test_automation_with_bad_trigger_missing_domain(hass, caplog):
|
||||
"""Test automation with device trigger this is missing domain."""
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
automation.DOMAIN,
|
||||
{
|
||||
automation.DOMAIN: {
|
||||
"alias": "hello",
|
||||
"trigger": {"platform": "device", "device_id": "hello.device"},
|
||||
"action": {"service": "test.automation", "entity_id": "hello.world"},
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
assert "required key not provided @ data['domain']" in caplog.text
|
||||
|
||||
|
||||
async def test_automation_with_bad_trigger_missing_device_id(hass, caplog):
|
||||
"""Test automation with device trigger that is missing device_id."""
|
||||
async def test_automation_with_bad_trigger(hass, caplog):
|
||||
"""Test automation with bad device trigger."""
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
automation.DOMAIN,
|
||||
@@ -931,7 +890,7 @@ async def test_automation_with_bad_trigger_missing_device_id(hass, caplog):
|
||||
},
|
||||
)
|
||||
|
||||
assert "required key not provided @ data['device_id']" in caplog.text
|
||||
assert "required key not provided" in caplog.text
|
||||
|
||||
|
||||
async def test_websocket_device_not_found(hass, hass_ws_client):
|
||||
|
||||
Reference in New Issue
Block a user