mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 00:37:53 +00:00
Migrate directv test to use freezegun (#105894)
This commit is contained in:
parent
556be26040
commit
0972dc5867
@ -4,6 +4,7 @@ from __future__ import annotations
|
||||
from datetime import datetime, timedelta
|
||||
from unittest.mock import patch
|
||||
|
||||
from freezegun.api import FrozenDateTimeFactory
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.directv.media_player import (
|
||||
@ -305,6 +306,7 @@ async def test_check_attributes(
|
||||
async def test_attributes_paused(
|
||||
hass: HomeAssistant,
|
||||
mock_now: dt_util.dt.datetime,
|
||||
freezer: FrozenDateTimeFactory,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
) -> None:
|
||||
"""Test attributes while paused."""
|
||||
@ -315,11 +317,9 @@ async def test_attributes_paused(
|
||||
|
||||
# Test to make sure that ATTR_MEDIA_POSITION_UPDATED_AT is not
|
||||
# updated if TV is paused.
|
||||
with patch(
|
||||
"homeassistant.util.dt.utcnow", return_value=mock_now + timedelta(minutes=5)
|
||||
):
|
||||
await async_media_pause(hass, CLIENT_ENTITY_ID)
|
||||
await hass.async_block_till_done()
|
||||
freezer.move_to(mock_now + timedelta(minutes=5))
|
||||
await async_media_pause(hass, CLIENT_ENTITY_ID)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get(CLIENT_ENTITY_ID)
|
||||
assert state.state == STATE_PAUSED
|
||||
|
Loading…
x
Reference in New Issue
Block a user