1
0
mirror of https://github.com/home-assistant/core.git synced 2026-05-16 13:31:01 +01:00

Fix shelly device_trigger tests (#169305)

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
epenet
2026-04-28 12:50:02 +02:00
committed by GitHub
parent eb2217cfa6
commit 7e2a7b9393
@@ -402,6 +402,8 @@ async def test_rpc_no_runtime_data(
) -> None:
"""Test the device trigger for the RPC device when there is no runtime_data in the entry."""
entry = await init_integration(hass, 2)
# Cache initial runtime_data
runtime_data = entry.runtime_data
monkeypatch.delattr(entry, "runtime_data")
device = dr.async_entries_for_config_entry(device_registry, entry.entry_id)[0]
@@ -437,6 +439,9 @@ async def test_rpc_no_runtime_data(
assert len(service_calls) == 1
assert service_calls[0].data["some"] == "test_trigger_single_push"
# Restore runtime_data to avoid issues on cleanup
entry.runtime_data = runtime_data
async def test_block_no_runtime_data(
hass: HomeAssistant,
@@ -447,6 +452,8 @@ async def test_block_no_runtime_data(
) -> None:
"""Test the device trigger for the block device when there is no runtime_data in the entry."""
entry = await init_integration(hass, 1)
# Cache initial runtime_data
runtime_data = entry.runtime_data
monkeypatch.delattr(entry, "runtime_data")
device = dr.async_entries_for_config_entry(device_registry, entry.entry_id)[0]
@@ -481,3 +488,6 @@ async def test_block_no_runtime_data(
assert len(service_calls) == 1
assert service_calls[0].data["some"] == "test_trigger_single"
# Restore runtime_data to avoid issues on cleanup
entry.runtime_data = runtime_data