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
|
@ -9,6 +9,7 @@ from homeassistant.components.timer import (
|
|||
STATUS_PAUSED,
|
||||
)
|
||||
from homeassistant.core import State
|
||||
from homeassistant.helpers.state import async_reproduce_state
|
||||
|
||||
from tests.common import async_mock_service
|
||||
|
||||
|
@ -27,7 +28,8 @@ async def test_reproducing_states(hass, caplog):
|
|||
cancel_calls = async_mock_service(hass, "timer", SERVICE_CANCEL)
|
||||
|
||||
# These calls should do nothing as entities already in desired state
|
||||
await hass.helpers.state.async_reproduce_state(
|
||||
await async_reproduce_state(
|
||||
hass,
|
||||
[
|
||||
State("timer.entity_idle", STATUS_IDLE),
|
||||
State("timer.entity_paused", STATUS_PAUSED),
|
||||
|
@ -43,9 +45,7 @@ async def test_reproducing_states(hass, caplog):
|
|||
assert len(cancel_calls) == 0
|
||||
|
||||
# Test invalid state is handled
|
||||
await hass.helpers.state.async_reproduce_state(
|
||||
[State("timer.entity_idle", "not_supported")]
|
||||
)
|
||||
await async_reproduce_state(hass, [State("timer.entity_idle", "not_supported")])
|
||||
|
||||
assert "not_supported" in caplog.text
|
||||
assert len(start_calls) == 0
|
||||
|
@ -53,7 +53,8 @@ async def test_reproducing_states(hass, caplog):
|
|||
assert len(cancel_calls) == 0
|
||||
|
||||
# Make sure correct services are called
|
||||
await hass.helpers.state.async_reproduce_state(
|
||||
await async_reproduce_state(
|
||||
hass,
|
||||
[
|
||||
State("timer.entity_idle", STATUS_ACTIVE, {ATTR_DURATION: "00:01:00"}),
|
||||
State("timer.entity_paused", STATUS_ACTIVE),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue