feat: Einstellungen, Neustart, Diagnose-Sensoren und Diagnose-Download
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
"""Diagnostics download must not leak secrets or network identity."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from pytest_homeassistant_custom_component.components.diagnostics import (
|
||||
get_diagnostics_for_config_entry,
|
||||
)
|
||||
from pytest_homeassistant_custom_component.typing import ClientSessionGenerator
|
||||
|
||||
from tests_unit.samples import HOST_RGB, MAC_RGB, TOKEN
|
||||
|
||||
|
||||
async def test_diagnostics_redacts_secrets(
|
||||
hass: HomeAssistant, hass_client: ClientSessionGenerator, init_integration
|
||||
) -> None:
|
||||
diagnostics = await get_diagnostics_for_config_entry(hass, hass_client, init_integration)
|
||||
text = json.dumps(diagnostics)
|
||||
for secret in (TOKEN, MAC_RGB, "ninIOT", HOST_RGB):
|
||||
assert secret not in text, secret
|
||||
assert diagnostics["info"]["device_type"] == "gu10_rgb"
|
||||
assert diagnostics["state"]["brightness"] == 37
|
||||
Reference in New Issue
Block a user