Use snapshot assertion for ESPHome diagnostics test (#98913)
This commit is contained in:
parent
a539d851cc
commit
f1fb28aad5
3 changed files with 30 additions and 15 deletions
|
@ -1,12 +1,8 @@
|
|||
"""Tests for the diagnostics data provided by the ESPHome integration."""
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
|
||||
from homeassistant.components.esphome.const import CONF_DEVICE_NAME, CONF_NOISE_PSK
|
||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import DASHBOARD_SLUG
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
@ -18,17 +14,9 @@ async def test_diagnostics(
|
|||
init_integration: MockConfigEntry,
|
||||
enable_bluetooth: None,
|
||||
mock_dashboard,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test diagnostics for config entry."""
|
||||
result = await get_diagnostics_for_config_entry(hass, hass_client, init_integration)
|
||||
|
||||
assert isinstance(result, dict)
|
||||
assert result["config"]["data"] == {
|
||||
CONF_DEVICE_NAME: "test",
|
||||
CONF_HOST: "192.168.1.2",
|
||||
CONF_PORT: 6053,
|
||||
CONF_PASSWORD: "**REDACTED**",
|
||||
CONF_NOISE_PSK: "**REDACTED**",
|
||||
}
|
||||
assert result["config"]["unique_id"] == "11:22:33:44:55:aa"
|
||||
assert result["dashboard"] == DASHBOARD_SLUG
|
||||
assert result == snapshot
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue