mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Clean up async_reproduce_state helper usage (#68617)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import pytest
|
||||
|
||||
from homeassistant.core import HomeAssistant, State
|
||||
from homeassistant.helpers.state import async_reproduce_state
|
||||
|
||||
from tests.common import async_mock_service
|
||||
|
||||
@@ -17,7 +18,8 @@ async def test_reproducing_states(
|
||||
turn_off_calls = async_mock_service(hass, "NEW_DOMAIN", "turn_off")
|
||||
|
||||
# These calls should do nothing as entities already in desired state
|
||||
await hass.helpers.state.async_reproduce_state(
|
||||
await async_reproduce_state(
|
||||
hass,
|
||||
[
|
||||
State("NEW_DOMAIN.entity_off", "off"),
|
||||
State("NEW_DOMAIN.entity_on", "on", {"color": "red"}),
|
||||
@@ -29,8 +31,8 @@ async def test_reproducing_states(
|
||||
assert len(turn_off_calls) == 0
|
||||
|
||||
# Test invalid state is handled
|
||||
await hass.helpers.state.async_reproduce_state(
|
||||
[State("NEW_DOMAIN.entity_off", "not_supported")], blocking=True
|
||||
await async_reproduce_state(
|
||||
hass, [State("NEW_DOMAIN.entity_off", "not_supported")], blocking=True
|
||||
)
|
||||
|
||||
assert "not_supported" in caplog.text
|
||||
@@ -38,7 +40,8 @@ async def test_reproducing_states(
|
||||
assert len(turn_off_calls) == 0
|
||||
|
||||
# Make sure correct services are called
|
||||
await hass.helpers.state.async_reproduce_state(
|
||||
await async_reproduce_state(
|
||||
hass,
|
||||
[
|
||||
State("NEW_DOMAIN.entity_on", "off"),
|
||||
State("NEW_DOMAIN.entity_off", "on", {"color": "red"}),
|
||||
|
||||
Reference in New Issue
Block a user