Make automations log errors (#18965)

This commit is contained in:
Paulus Schoutsen 2018-12-13 12:21:16 +01:00 committed by GitHub
parent 8ea0a8d40b
commit 9d9e11372b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 110 additions and 4 deletions

View file

@ -864,3 +864,24 @@ def test_automation_not_trigger_on_bootstrap(hass):
assert len(calls) == 1
assert ['hello.world'] == calls[0].data.get(ATTR_ENTITY_ID)
async def test_automation_with_error_in_script(hass, caplog):
"""Test automation with an error in script."""
assert await async_setup_component(hass, automation.DOMAIN, {
automation.DOMAIN: {
'alias': 'hello',
'trigger': {
'platform': 'event',
'event_type': 'test_event',
},
'action': {
'service': 'test.automation',
'entity_id': 'hello.world'
}
}
})
hass.bus.async_fire('test_event')
await hass.async_block_till_done()
assert 'Service test.automation not found' in caplog.text