Add config reloaded events for automation and scene (#34664)

This commit is contained in:
Franck Nijhof authored and GitHub committed 2020-06-01 15:19:00 -07:00
1 parent 07469127ce
commit 1883b1d2a2
4 files changed
+22 -1

No files matched your search

@@ -3,6 +3,7 @@ import pytest
import voluptuous as vol
from homeassistant.components.homeassistant import scene as ha_scene
from homeassistant.components.homeassistant.scene import EVENT_SCENE_RELOADED
from homeassistant.setup import async_setup_component
from tests.async_mock import patch
@@ -13,6 +14,11 @@ async def test_reload_config_service(hass):
"""Test the reload config service."""
assert await async_setup_component(hass, "scene", {})
test_reloaded_event = []
hass.bus.async_listen(
EVENT_SCENE_RELOADED, lambda event: test_reloaded_event.append(event)
)
with patch(
"homeassistant.config.load_yaml_config_file",
autospec=True,
@@ -22,6 +28,7 @@ async def test_reload_config_service(hass):
await hass.async_block_till_done()
assert hass.states.get("scene.hallo") is not None
assert len(test_reloaded_event) == 1
with patch(
"homeassistant.config.load_yaml_config_file",
@@ -31,6 +38,7 @@ async def test_reload_config_service(hass):
await hass.services.async_call("scene", "reload", blocking=True)
await hass.async_block_till_done()
assert len(test_reloaded_event) == 2
assert hass.states.get("scene.hallo") is None
assert hass.states.get("scene.bye") is not None