Add config reloaded events for automation and scene (#34664)
This commit is contained in:
parent
07469127ce
commit
1883b1d2a2
4 changed files with 22 additions and 1 deletions
|
@ -4,7 +4,7 @@ from datetime import timedelta
|
|||
import pytest
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components.automation import DOMAIN
|
||||
from homeassistant.components.automation import DOMAIN, EVENT_AUTOMATION_RELOADED
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
ATTR_NAME,
|
||||
|
@ -483,6 +483,11 @@ async def test_reload_config_service(hass, calls, hass_admin_user, hass_read_onl
|
|||
assert len(calls) == 1
|
||||
assert calls[0].data.get("event") == "test_event"
|
||||
|
||||
test_reload_event = []
|
||||
hass.bus.async_listen(
|
||||
EVENT_AUTOMATION_RELOADED, lambda event: test_reload_event.append(event)
|
||||
)
|
||||
|
||||
with patch(
|
||||
"homeassistant.config.load_yaml_config_file",
|
||||
autospec=True,
|
||||
|
@ -505,6 +510,8 @@ async def test_reload_config_service(hass, calls, hass_admin_user, hass_read_onl
|
|||
# De-flake ?!
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert len(test_reload_event) == 1
|
||||
|
||||
assert hass.states.get("automation.hello") is None
|
||||
assert hass.states.get("automation.bye") is not None
|
||||
listeners = hass.bus.async_listeners()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue