mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Freeze time on timer
tests that assert on remaining time (#94078)
This commit is contained in:
parent
0d4af6fb1e
commit
83b0ec5136
@ -265,6 +265,7 @@ async def test_methods_and_events(hass: HomeAssistant) -> None:
|
|||||||
assert len(results) == expected_events
|
assert len(results) == expected_events
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.freeze_time("2023-06-05 17:47:50")
|
||||||
async def test_start_service(hass: HomeAssistant) -> None:
|
async def test_start_service(hass: HomeAssistant) -> None:
|
||||||
"""Test the start/stop service."""
|
"""Test the start/stop service."""
|
||||||
await async_setup_component(hass, DOMAIN, {DOMAIN: {"test1": {CONF_DURATION: 10}}})
|
await async_setup_component(hass, DOMAIN, {DOMAIN: {"test1": {CONF_DURATION: 10}}})
|
||||||
@ -880,6 +881,7 @@ async def test_restore_idle(hass: HomeAssistant) -> None:
|
|||||||
assert entity.extra_state_attributes[ATTR_RESTORE]
|
assert entity.extra_state_attributes[ATTR_RESTORE]
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.freeze_time("2023-06-05 17:47:50")
|
||||||
async def test_restore_paused(hass: HomeAssistant) -> None:
|
async def test_restore_paused(hass: HomeAssistant) -> None:
|
||||||
"""Test entity restore logic when timer is paused."""
|
"""Test entity restore logic when timer is paused."""
|
||||||
utc_now = utcnow()
|
utc_now = utcnow()
|
||||||
@ -917,6 +919,7 @@ async def test_restore_paused(hass: HomeAssistant) -> None:
|
|||||||
assert entity.extra_state_attributes[ATTR_RESTORE]
|
assert entity.extra_state_attributes[ATTR_RESTORE]
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.freeze_time("2023-06-05 17:47:50")
|
||||||
async def test_restore_active_resume(hass: HomeAssistant) -> None:
|
async def test_restore_active_resume(hass: HomeAssistant) -> None:
|
||||||
"""Test entity restore logic when timer is active and end time is after startup."""
|
"""Test entity restore logic when timer is active and end time is after startup."""
|
||||||
events = async_capture_events(hass, EVENT_TIMER_RESTARTED)
|
events = async_capture_events(hass, EVENT_TIMER_RESTARTED)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user