mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Add service to reload scenes from configuration.yaml (#25680)
* Allow reloading scenes * Update requirements * address comments * fix typing * fix tests * Update homeassistant/components/homeassistant/scene.py Co-Authored-By: Martin Hjelmare <marhje52@kth.se> * Address comments
This commit is contained in:
committed by
Pascal Vizeli
parent
0449132c35
commit
7a90808e52
30
tests/components/homeassistant/test_scene.py
Normal file
30
tests/components/homeassistant/test_scene.py
Normal file
@@ -0,0 +1,30 @@
|
||||
"""Test Home Assistant scenes."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
||||
async def test_reload_config_service(hass):
|
||||
"""Test the reload config service."""
|
||||
assert await async_setup_component(hass, "scene", {})
|
||||
|
||||
with patch(
|
||||
"homeassistant.config.load_yaml_config_file",
|
||||
autospec=True,
|
||||
return_value={"scene": {"name": "Hallo", "entities": {"light.kitchen": "on"}}},
|
||||
), patch("homeassistant.config.find_config_file", return_value=""):
|
||||
await hass.services.async_call("scene", "reload", blocking=True)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert hass.states.get("scene.hallo") is not None
|
||||
|
||||
with patch(
|
||||
"homeassistant.config.load_yaml_config_file",
|
||||
autospec=True,
|
||||
return_value={"scene": {"name": "Bye", "entities": {"light.kitchen": "on"}}},
|
||||
), patch("homeassistant.config.find_config_file", return_value=""):
|
||||
await hass.services.async_call("scene", "reload", blocking=True)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert hass.states.get("scene.hallo") is None
|
||||
assert hass.states.get("scene.bye") is not None
|
||||
Reference in New Issue
Block a user