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:
committed by
GitHub
parent
5006244f4c
commit
2e0a22fdaf
@@ -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,
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user