mirror of
https://github.com/home-assistant/core.git
synced 2026-09-27 01:46:11 -04:00
Add diagnostics for fyta (#118234)
* Add diagnostics * add test for diagnostics * Redact access_token * remove unnecessary redaction
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
# serializer version: 1
|
||||
# name: test_entry_diagnostics
|
||||
dict({
|
||||
'config_entry': dict({
|
||||
'data': dict({
|
||||
'access_token': '**REDACTED**',
|
||||
'expiration': '2030-12-31T10:00:00+00:00',
|
||||
'password': '**REDACTED**',
|
||||
'username': '**REDACTED**',
|
||||
}),
|
||||
'disabled_by': None,
|
||||
'domain': 'fyta',
|
||||
'entry_id': 'ce5f5431554d101905d31797e1232da8',
|
||||
'minor_version': 2,
|
||||
'options': dict({
|
||||
}),
|
||||
'pref_disable_new_entities': False,
|
||||
'pref_disable_polling': False,
|
||||
'source': 'user',
|
||||
'title': 'fyta_user',
|
||||
'unique_id': None,
|
||||
'version': 1,
|
||||
}),
|
||||
'plant_data': dict({
|
||||
'0': dict({
|
||||
'name': 'Gummibaum',
|
||||
'scientific_name': 'Ficus elastica',
|
||||
'status': 1,
|
||||
'sw_version': '1.0',
|
||||
}),
|
||||
'1': dict({
|
||||
'name': 'Kakaobaum',
|
||||
'scientific_name': 'Theobroma cacao',
|
||||
'status': 2,
|
||||
'sw_version': '1.0',
|
||||
}),
|
||||
}),
|
||||
})
|
||||
# ---
|
||||
@@ -0,0 +1,31 @@
|
||||
"""Test Fyta diagnostics."""
|
||||
|
||||
from unittest.mock import AsyncMock
|
||||
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import setup_platform
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_entry_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_fyta_connector: AsyncMock,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test config entry diagnostics."""
|
||||
await setup_platform(hass, mock_config_entry, [Platform.SENSOR])
|
||||
|
||||
result = await get_diagnostics_for_config_entry(
|
||||
hass, hass_client, mock_config_entry
|
||||
)
|
||||
|
||||
assert result == snapshot
|
||||
Reference in New Issue
Block a user