Make Hydrawise initialize data immediately (#101936)
This commit is contained in:
parent
92ec525de1
commit
f160fa4bc3
9 changed files with 45 additions and 86 deletions
|
@ -1,14 +1,11 @@
|
|||
"""Test Hydrawise sensor."""
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
from freezegun.api import FrozenDateTimeFactory
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.hydrawise.const import SCAN_INTERVAL
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry, async_fire_time_changed
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
@pytest.mark.freeze_time("2023-10-01 00:00:00+00:00")
|
||||
|
@ -18,11 +15,6 @@ async def test_states(
|
|||
freezer: FrozenDateTimeFactory,
|
||||
) -> None:
|
||||
"""Test sensor states."""
|
||||
# Make the coordinator refresh data.
|
||||
freezer.tick(SCAN_INTERVAL + timedelta(seconds=30))
|
||||
async_fire_time_changed(hass)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
watering_time1 = hass.states.get("sensor.zone_one_watering_time")
|
||||
assert watering_time1 is not None
|
||||
assert watering_time1.state == "0"
|
||||
|
@ -33,4 +25,4 @@ async def test_states(
|
|||
|
||||
next_cycle = hass.states.get("sensor.zone_one_next_cycle")
|
||||
assert next_cycle is not None
|
||||
assert next_cycle.state == "2023-10-04T19:52:27+00:00"
|
||||
assert next_cycle.state == "2023-10-04T19:49:57+00:00"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue