mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 08:47:57 +00:00
Fix fyta test warning (#116688)
This commit is contained in:
parent
217795865b
commit
15b24dfbc2
@ -1,6 +1,7 @@
|
||||
"""Test helpers."""
|
||||
|
||||
from collections.abc import Generator
|
||||
from datetime import UTC, datetime, timedelta
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
import pytest
|
||||
@ -32,14 +33,17 @@ def mock_fyta_init():
|
||||
"""Build a fixture for the Fyta API that connects successfully and returns one device."""
|
||||
|
||||
mock_fyta_api = AsyncMock()
|
||||
with patch(
|
||||
"homeassistant.components.fyta.FytaConnector",
|
||||
return_value=mock_fyta_api,
|
||||
) as mock_fyta_api:
|
||||
mock_fyta_api.return_value.login.return_value = {
|
||||
mock_fyta_api.expiration = datetime.now(tz=UTC) + timedelta(days=1)
|
||||
mock_fyta_api.login = AsyncMock(
|
||||
return_value={
|
||||
CONF_ACCESS_TOKEN: ACCESS_TOKEN,
|
||||
CONF_EXPIRATION: EXPIRATION,
|
||||
}
|
||||
)
|
||||
with patch(
|
||||
"homeassistant.components.fyta.FytaConnector.__new__",
|
||||
return_value=mock_fyta_api,
|
||||
):
|
||||
yield mock_fyta_api
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user