Clean up async_reproduce_state helper usage (#68617)
This commit is contained in:
parent
cbf5b5ead5
commit
8aff8d89d2
22 changed files with 159 additions and 126 deletions
|
@ -1,5 +1,6 @@
|
|||
"""Test reproduce state for Fan."""
|
||||
from homeassistant.core import State
|
||||
from homeassistant.helpers.state import async_reproduce_state
|
||||
|
||||
from tests.common import async_mock_service
|
||||
|
||||
|
@ -19,7 +20,8 @@ async def test_reproducing_states(hass, caplog):
|
|||
set_percentage_calls = async_mock_service(hass, "fan", "set_percentage")
|
||||
|
||||
# These calls should do nothing as entities already in desired state
|
||||
await hass.helpers.state.async_reproduce_state(
|
||||
await async_reproduce_state(
|
||||
hass,
|
||||
[
|
||||
State("fan.entity_off", "off"),
|
||||
State("fan.entity_on", "on"),
|
||||
|
@ -35,9 +37,7 @@ async def test_reproducing_states(hass, caplog):
|
|||
assert len(oscillate_calls) == 0
|
||||
|
||||
# Test invalid state is handled
|
||||
await hass.helpers.state.async_reproduce_state(
|
||||
[State("fan.entity_off", "not_supported")]
|
||||
)
|
||||
await async_reproduce_state(hass, [State("fan.entity_off", "not_supported")])
|
||||
|
||||
assert "not_supported" in caplog.text
|
||||
assert len(turn_on_calls) == 0
|
||||
|
@ -47,7 +47,8 @@ async def test_reproducing_states(hass, caplog):
|
|||
assert len(set_percentage_calls) == 0
|
||||
|
||||
# Make sure correct services are called
|
||||
await hass.helpers.state.async_reproduce_state(
|
||||
await async_reproduce_state(
|
||||
hass,
|
||||
[
|
||||
State("fan.entity_on", "off"),
|
||||
State("fan.entity_off", "on"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue