1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Migrate google related tests to use freezegun (#105552)

* Migrate google related tests to use freezegun

* retrigger CI

* Fix google tests

* Add timezone to config_entry_token_expiry

* Separate config_entry_token_expiry from token_expiry

* Also test token refresh for offset-naive tokens

* retrigger CI

* Apply code review suggestion

Co-authored-by: Allen Porter <allen.porter@gmail.com>

* Run ruff-format

---------

Co-authored-by: Allen Porter <allen.porter@gmail.com>
This commit is contained in:
Jan-Philipp Benecke
2023-12-21 12:23:01 +01:00
committed by GitHub
parent f8f31627ce
commit 0ae0331c5c
6 changed files with 40 additions and 31 deletions

View File

@@ -8,6 +8,7 @@ from http import HTTPStatus
from unittest.mock import AsyncMock, Mock, patch
import aiohttp
from freezegun import freeze_time
from google_nest_sdm.event import EventMessage
import pytest
@@ -173,7 +174,7 @@ async def async_get_image(hass, width=None, height=None):
async def fire_alarm(hass, point_in_time):
"""Fire an alarm and wait for callbacks to run."""
with patch("homeassistant.util.dt.utcnow", return_value=point_in_time):
with freeze_time(point_in_time):
async_fire_time_changed(hass, point_in_time)
await hass.async_block_till_done()