Use snapshot assertion for ESPHome diagnostics test (#98913)

This commit is contained in:
Joost Lekkerkerker 2023-08-24 01:01:58 +02:00 committed by GitHub
parent a539d851cc
commit f1fb28aad5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 15 deletions

View file

@ -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