mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 19:09:32 +00:00
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Josef Zweck <josef@zweck.dev>
36 lines
1.1 KiB
Python
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")
|
|
)
|