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

Use freezegun in AEMET tests (#99253)

This commit is contained in:
Álvaro Fernández Rojas
2023-08-29 16:33:12 +02:00
committed by GitHub
parent 5006244f4c
commit 2e0a22fdaf
4 changed files with 55 additions and 49 deletions

View File

@@ -7,7 +7,6 @@ from homeassistant.components.aemet.const import DOMAIN
from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME
from homeassistant.core import HomeAssistant
import homeassistant.util.dt as dt_util
from .util import mock_api_call
@@ -21,13 +20,15 @@ CONFIG = {
}
async def test_unload_entry(hass: HomeAssistant) -> None:
"""Test that the options form."""
async def test_unload_entry(
hass: HomeAssistant,
freezer: FrozenDateTimeFactory,
) -> None:
"""Test (un)loading the AEMET integration."""
now = dt_util.parse_datetime("2021-01-09 12:00:00+00:00")
with patch("homeassistant.util.dt.now", return_value=now), patch(
"homeassistant.util.dt.utcnow", return_value=now
), patch(
hass.config.set_time_zone("UTC")
freezer.move_to("2021-01-09 12:00:00+00:00")
with patch(
"homeassistant.components.aemet.AEMET.api_call",
side_effect=mock_api_call,
):