2022-02-08 21:05:33 +00:00
|
|
|
"""Tests for Tradfri diagnostics."""
|
2023-02-13 17:39:48 +00:00
|
|
|
from __future__ import annotations
|
2023-02-13 14:40:21 +00:00
|
|
|
|
2024-02-11 11:01:12 +00:00
|
|
|
import pytest
|
|
|
|
from pytradfri.device import Device
|
2022-02-08 21:05:33 +00:00
|
|
|
|
|
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
|
|
|
|
from .common import setup_integration
|
|
|
|
|
|
|
|
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
2023-02-02 21:29:57 +00:00
|
|
|
from tests.typing import ClientSessionGenerator
|
2022-02-08 21:05:33 +00:00
|
|
|
|
|
|
|
|
2024-02-11 11:01:12 +00:00
|
|
|
@pytest.mark.parametrize("device", ["air_purifier"], indirect=True)
|
2022-02-08 21:05:33 +00:00
|
|
|
async def test_diagnostics(
|
|
|
|
hass: HomeAssistant,
|
2023-02-02 21:29:57 +00:00
|
|
|
hass_client: ClientSessionGenerator,
|
2024-02-11 11:01:12 +00:00
|
|
|
device: Device,
|
2022-02-08 21:05:33 +00:00
|
|
|
) -> None:
|
|
|
|
"""Test diagnostics for config entry."""
|
2023-02-13 17:39:48 +00:00
|
|
|
config_entry = await setup_integration(hass)
|
2022-02-08 21:05:33 +00:00
|
|
|
|
2023-02-13 17:39:48 +00:00
|
|
|
result = await get_diagnostics_for_config_entry(hass, hass_client, config_entry)
|
2022-02-08 21:05:33 +00:00
|
|
|
|
|
|
|
assert isinstance(result, dict)
|
|
|
|
assert result["gateway_version"] == "1.2.1234"
|
2023-02-13 17:39:48 +00:00
|
|
|
assert result["device_data"] == ["STARKVIND Air purifier"]
|