Use freezer for time change in Whirlpool config flow test (#143162)

This commit is contained in:
Abílio Costa 2025-04-17 15:14:21 +01:00 committed by GitHub
parent f9bb7e404e
commit c0b2193718
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,6 +3,7 @@
from datetime import UTC, datetime, timedelta
from unittest.mock import MagicMock
from freezegun.api import FrozenDateTimeFactory
import pytest
from syrupy import SnapshotAssertion
from whirlpool.washerdryer import MachineState
@ -58,6 +59,7 @@ async def test_washer_dryer_time_sensor(
entity_id: str,
mock_fixture: str,
request: pytest.FixtureRequest,
freezer: FrozenDateTimeFactory,
) -> None:
"""Test Washer/Dryer end time sensors."""
now = utcnow()
@ -113,7 +115,8 @@ async def test_washer_dryer_time_sensor(
# Test that periodic updates call the API to fetch data
mock_instance.fetch_data.reset_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_instance.fetch_data.assert_called_once()