2022-01-26 22:35:41 +00:00
|
|
|
"""Tests for the diagnostics data provided by the ESPHome integration."""
|
|
|
|
|
|
|
|
from aiohttp import ClientSession
|
2022-11-27 19:59:37 +00:00
|
|
|
import pytest
|
2022-01-26 22:35:41 +00:00
|
|
|
|
|
|
|
from homeassistant.components.esphome import CONF_NOISE_PSK
|
|
|
|
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT
|
|
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
|
|
|
|
from tests.common import MockConfigEntry
|
|
|
|
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
|
|
|
|
|
|
|
|
|
|
|
async def test_diagnostics(
|
2022-11-27 19:59:37 +00:00
|
|
|
hass: HomeAssistant,
|
|
|
|
hass_client: ClientSession,
|
|
|
|
init_integration: MockConfigEntry,
|
|
|
|
enable_bluetooth: pytest.fixture,
|
2022-01-26 22:35:41 +00:00
|
|
|
):
|
|
|
|
"""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_HOST: "192.168.1.2",
|
|
|
|
CONF_PORT: 6053,
|
|
|
|
CONF_PASSWORD: "**REDACTED**",
|
|
|
|
CONF_NOISE_PSK: "**REDACTED**",
|
|
|
|
}
|
2022-12-11 03:26:42 +00:00
|
|
|
assert result["config"]["unique_id"] == "11:22:33:44:55:aa"
|