mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Fix failing google diagnostics test (#113095)
This commit is contained in:
parent
324266a4e6
commit
e29b012eba
@ -1,6 +1,7 @@
|
|||||||
"""Tests for diagnostics platform of google calendar."""
|
"""Tests for diagnostics platform of google calendar."""
|
||||||
|
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
|
import time
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from aiohttp.test_utils import TestClient
|
from aiohttp.test_utils import TestClient
|
||||||
@ -16,6 +17,7 @@ from .conftest import TEST_EVENT, ComponentSetup
|
|||||||
|
|
||||||
from tests.common import CLIENT_ID, MockConfigEntry, MockUser
|
from tests.common import CLIENT_ID, MockConfigEntry, MockUser
|
||||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||||
|
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||||
from tests.typing import ClientSessionGenerator
|
from tests.typing import ClientSessionGenerator
|
||||||
|
|
||||||
|
|
||||||
@ -70,8 +72,21 @@ async def test_diagnostics(
|
|||||||
aiohttp_client: ClientSessionGenerator,
|
aiohttp_client: ClientSessionGenerator,
|
||||||
socket_enabled: None,
|
socket_enabled: None,
|
||||||
snapshot: SnapshotAssertion,
|
snapshot: SnapshotAssertion,
|
||||||
|
aioclient_mock: AiohttpClientMocker,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test diagnostics for the calendar."""
|
"""Test diagnostics for the calendar."""
|
||||||
|
|
||||||
|
expires_in = 86400
|
||||||
|
expires_at = time.time() + expires_in
|
||||||
|
aioclient_mock.post(
|
||||||
|
"https://oauth2.googleapis.com/token",
|
||||||
|
json={
|
||||||
|
"refresh_token": "some-refresh-token",
|
||||||
|
"access_token": "some-updated-token",
|
||||||
|
"expires_at": expires_at,
|
||||||
|
"expires_in": expires_in,
|
||||||
|
},
|
||||||
|
)
|
||||||
mock_events_list_items(
|
mock_events_list_items(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user