mirror of
https://github.com/home-assistant/core.git
synced 2025-11-13 13:00:11 +00:00
Add diagnostics per device to Home Connect (#131010)
* Add diagnostics per device to Home Connect * Include programs at device diagnostics * Applied suggestions from epenet Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Applied more suggestions from epenet Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Test naming consistency Co-authored-by: abmantis <amfcalt@gmail.com> * Add return type to `_generate_entry_diagnostics` --------- Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> Co-authored-by: abmantis <amfcalt@gmail.com>
This commit is contained in:
committed by
GitHub
parent
deeb55ac50
commit
80e8b8d61b
@@ -6,11 +6,14 @@ from unittest.mock import MagicMock
|
||||
import pytest
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.home_connect.const import DOMAIN
|
||||
from homeassistant.components.home_connect.diagnostics import (
|
||||
async_get_config_entry_diagnostics,
|
||||
async_get_device_diagnostics,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
|
||||
from .conftest import get_all_appliances
|
||||
|
||||
@@ -26,10 +29,33 @@ async def test_async_get_config_entry_diagnostics(
|
||||
get_appliances: MagicMock,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test setup and unload."""
|
||||
"""Test config entry diagnostics."""
|
||||
get_appliances.side_effect = get_all_appliances
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup()
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
assert await async_get_config_entry_diagnostics(hass, config_entry) == snapshot
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("bypass_throttle")
|
||||
async def test_async_get_device_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
config_entry: MockConfigEntry,
|
||||
integration_setup: Callable[[], Awaitable[bool]],
|
||||
setup_credentials: None,
|
||||
get_appliances: MagicMock,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test device config entry diagnostics."""
|
||||
get_appliances.side_effect = get_all_appliances
|
||||
assert config_entry.state == ConfigEntryState.NOT_LOADED
|
||||
assert await integration_setup()
|
||||
assert config_entry.state == ConfigEntryState.LOADED
|
||||
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DOMAIN, "SIEMENS-HCS02DWH1-6BE58C26DCC1")}
|
||||
)
|
||||
|
||||
assert await async_get_device_diagnostics(hass, config_entry, device) == snapshot
|
||||
|
||||
Reference in New Issue
Block a user