2022-10-13 13:31:33 +00:00
|
|
|
"""Test AirNow diagnostics."""
|
2024-03-08 13:50:25 +00:00
|
|
|
|
2024-06-22 15:31:39 +00:00
|
|
|
from unittest.mock import patch
|
|
|
|
|
2024-06-07 07:03:35 +00:00
|
|
|
import pytest
|
2023-08-21 12:19:21 +00:00
|
|
|
from syrupy import SnapshotAssertion
|
2024-07-29 20:08:46 +00:00
|
|
|
from syrupy.filters import props
|
2023-08-21 12:19:21 +00:00
|
|
|
|
2023-02-09 15:09:13 +00:00
|
|
|
from homeassistant.core import HomeAssistant
|
2022-10-13 13:31:33 +00:00
|
|
|
|
2024-06-07 07:03:35 +00:00
|
|
|
from tests.common import MockConfigEntry
|
2022-10-13 13:31:33 +00:00
|
|
|
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
2023-02-09 15:09:13 +00:00
|
|
|
from tests.typing import ClientSessionGenerator
|
2022-10-13 13:31:33 +00:00
|
|
|
|
|
|
|
|
2024-06-07 07:03:35 +00:00
|
|
|
@pytest.mark.usefixtures("setup_airnow")
|
2023-02-09 15:09:13 +00:00
|
|
|
async def test_entry_diagnostics(
|
2023-08-21 12:19:21 +00:00
|
|
|
hass: HomeAssistant,
|
2024-06-07 07:03:35 +00:00
|
|
|
config_entry: MockConfigEntry,
|
2023-08-21 12:19:21 +00:00
|
|
|
hass_client: ClientSessionGenerator,
|
|
|
|
snapshot: SnapshotAssertion,
|
2023-02-09 15:09:13 +00:00
|
|
|
) -> None:
|
2022-10-13 13:31:33 +00:00
|
|
|
"""Test config entry diagnostics."""
|
2024-06-22 15:31:39 +00:00
|
|
|
|
|
|
|
# Fake LocalTimeZoneInfo
|
|
|
|
with patch(
|
|
|
|
"homeassistant.util.dt.async_get_time_zone",
|
|
|
|
return_value="PST",
|
|
|
|
):
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
2024-07-29 20:08:46 +00:00
|
|
|
assert await get_diagnostics_for_config_entry(
|
|
|
|
hass, hass_client, config_entry
|
|
|
|
) == snapshot(exclude=props("created_at", "modified_at"))
|