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