mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 09:47:52 +00:00
Use freezegun in image_upload test (#106045)
This commit is contained in:
parent
f84e43bc0a
commit
7d74c89606
@ -4,6 +4,7 @@ import tempfile
|
||||
from unittest.mock import patch
|
||||
|
||||
from aiohttp import ClientSession, ClientWebSocketResponse
|
||||
from freezegun.api import FrozenDateTimeFactory
|
||||
|
||||
from homeassistant.components.websocket_api import const as ws_const
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -17,15 +18,17 @@ from tests.typing import ClientSessionGenerator, WebSocketGenerator
|
||||
|
||||
async def test_upload_image(
|
||||
hass: HomeAssistant,
|
||||
freezer: FrozenDateTimeFactory,
|
||||
hass_client: ClientSessionGenerator,
|
||||
hass_ws_client: WebSocketGenerator,
|
||||
) -> None:
|
||||
"""Test we can upload an image."""
|
||||
now = dt_util.utcnow()
|
||||
freezer.move_to(now)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tempdir, patch.object(
|
||||
hass.config, "path", return_value=tempdir
|
||||
), patch("homeassistant.util.dt.utcnow", return_value=now):
|
||||
):
|
||||
assert await async_setup_component(hass, "image_upload", {})
|
||||
ws_client: ClientWebSocketResponse = await hass_ws_client()
|
||||
client: ClientSession = await hass_client()
|
||||
|
Loading…
x
Reference in New Issue
Block a user