core/tests/components/wmspro/test_diagnostics.py

35 lines
1.0 KiB
Python

"""Test the wmspro diagnostics."""
from unittest.mock import AsyncMock
from syrupy import SnapshotAssertion
from homeassistant.core import HomeAssistant
from . import setup_config_entry
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,
mock_config_entry: MockConfigEntry,
mock_hub_ping: AsyncMock,
mock_hub_configuration_prod: AsyncMock,
mock_dest_refresh: AsyncMock,
snapshot: SnapshotAssertion,
) -> None:
"""Test that a config entry can be loaded with DeviceConfig."""
assert await setup_config_entry(hass, mock_config_entry)
assert len(mock_hub_ping.mock_calls) == 1
assert len(mock_hub_configuration_prod.mock_calls) == 1
assert len(mock_dest_refresh.mock_calls) == 2
result = await get_diagnostics_for_config_entry(
hass, hass_client, mock_config_entry
)
assert result == snapshot