mirror of
https://github.com/home-assistant/core.git
synced 2025-06-24 06:57:08 +00:00

* Add diagnostics * add diagnostics * address review * ruff * ruff * use raw ics data * mypy * mypy * naming * redact ics * ruff * simpify * reduce data * ruff
40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
"""Test the remote calendar diagnostics."""
|
|
|
|
import datetime
|
|
|
|
from httpx import Response
|
|
import pytest
|
|
import respx
|
|
from syrupy.assertion import SnapshotAssertion
|
|
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
from . import setup_integration
|
|
from .conftest import CALENDER_URL
|
|
|
|
from tests.common import MockConfigEntry
|
|
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
|
from tests.typing import ClientSessionGenerator
|
|
|
|
|
|
@respx.mock
|
|
@pytest.mark.freeze_time(datetime.datetime(2023, 6, 5))
|
|
async def test_entry_diagnostics(
|
|
hass: HomeAssistant,
|
|
hass_client: ClientSessionGenerator,
|
|
snapshot: SnapshotAssertion,
|
|
config_entry: MockConfigEntry,
|
|
ics_content: str,
|
|
) -> None:
|
|
"""Test config entry diagnostics."""
|
|
respx.get(CALENDER_URL).mock(
|
|
return_value=Response(
|
|
status_code=200,
|
|
text=ics_content,
|
|
)
|
|
)
|
|
await setup_integration(hass, config_entry)
|
|
await hass.async_block_till_done()
|
|
result = await get_diagnostics_for_config_entry(hass, hass_client, config_entry)
|
|
assert result == snapshot
|