1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Make sure command entities restore from state (#38038)

This commit is contained in:
Joakim Plate
2020-07-22 00:01:31 +02:00
committed by GitHub
parent ad5d7ee615
commit 945acb4e29
11 changed files with 182 additions and 11 deletions

View File

@@ -1,10 +1,15 @@
"""The tests for the Rfxtrx cover platform."""
from unittest.mock import call
import pytest
from homeassistant.core import State
from homeassistant.setup import async_setup_component
from . import _signal_event
from tests.common import mock_restore_cache
async def test_one_cover(hass, rfxtrx):
"""Test with 1 cover."""
@@ -46,6 +51,24 @@ async def test_one_cover(hass, rfxtrx):
]
@pytest.mark.parametrize("state", ["open", "closed"])
async def test_state_restore(hass, rfxtrx, state):
"""State restoration."""
entity_id = "cover.lightwaverf_siemens_0213c7_242"
mock_restore_cache(hass, [State(entity_id, state)])
assert await async_setup_component(
hass,
"rfxtrx",
{"rfxtrx": {"device": "abcd", "devices": {"0b1400cd0213c7f20d010f51": {}}}},
)
await hass.async_block_till_done()
assert hass.states.get(entity_id).state == state
async def test_several_covers(hass, rfxtrx):
"""Test with 3 covers."""
assert await async_setup_component(