Files
core/tests/components/pi_hole/test_diagnostics.py
HarvsG 1b21c986e8 Enable Pihole API v6 (#145890)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Josef Zweck <josef@zweck.dev>
2025-07-05 10:21:32 +02:00

36 lines
1.1 KiB
Python

"""Test pi_hole component."""
from syrupy.assertion import SnapshotAssertion
from syrupy.filters import props
from homeassistant.components import pi_hole
from homeassistant.core import HomeAssistant
from . import CONFIG_DATA_DEFAULTS, _create_mocked_hole, _patch_init_hole
from tests.common import MockConfigEntry
from tests.components.diagnostics import get_diagnostics_for_config_entry
from tests.typing import ClientSessionGenerator
async def test_diagnostics(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
snapshot: SnapshotAssertion,
) -> None:
"""Tests diagnostics."""
mocked_hole = _create_mocked_hole(api_version=5)
config_entry = {**CONFIG_DATA_DEFAULTS, "api_version": 5}
entry = MockConfigEntry(
domain=pi_hole.DOMAIN, data=config_entry, entry_id="pi_hole_mock_entry"
)
entry.add_to_hass(hass)
with _patch_init_hole(mocked_hole):
assert await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
assert await get_diagnostics_for_config_entry(hass, hass_client, entry) == snapshot(
exclude=props("created_at", "modified_at")
)