Skip to content

Commit

Permalink
tests: airzone: use freezer
Browse files Browse the repository at this point in the history
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
  • Loading branch information
Noltari committed Jul 13, 2024
1 parent 05ea5d0 commit 4b66f35
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/components/airzone/test_coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
InvalidMethod,
SystemOutOfRange,
)
from freezegun.api import FrozenDateTimeFactory

from homeassistant.components.airzone.const import DOMAIN
from homeassistant.components.airzone.coordinator import SCAN_INTERVAL
Expand Down Expand Up @@ -66,7 +67,10 @@ async def test_coordinator_client_connector_error(hass: HomeAssistant) -> None:
assert state.state == STATE_UNAVAILABLE


async def test_coordinator_new_devices(hass: HomeAssistant) -> None:
async def test_coordinator_new_devices(
hass: HomeAssistant,
freezer: FrozenDateTimeFactory,
) -> None:
"""Test new devices on coordinator update."""

config_entry = MockConfigEntry(
Expand Down Expand Up @@ -110,9 +114,10 @@ async def test_coordinator_new_devices(hass: HomeAssistant) -> None:
assert state is None

mock_hvac.return_value = HVAC_MOCK
async_fire_time_changed(hass, utcnow() + SCAN_INTERVAL)
freezer.tick(SCAN_INTERVAL)
async_fire_time_changed(hass)
await hass.async_block_till_done()
mock_hvac.assert_called()
mock_hvac.assert_called_once()

state = hass.states.get("sensor.salon_temperature")
assert state.state == "19.6"
Expand Down

0 comments on commit 4b66f35

Please sign in to comment.