mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
Add diagnostics platform to Bring integration (#126695)
This commit is contained in:
parent
161f37bb98
commit
3d4ac7ca63
16
homeassistant/components/bring/diagnostics.py
Normal file
16
homeassistant/components/bring/diagnostics.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
"""Diagnostics support for Bring."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
|
from . import BringConfigEntry
|
||||||
|
from .coordinator import BringData
|
||||||
|
|
||||||
|
|
||||||
|
async def async_get_config_entry_diagnostics(
|
||||||
|
hass: HomeAssistant, config_entry: BringConfigEntry
|
||||||
|
) -> dict[str, BringData]:
|
||||||
|
"""Return diagnostics for a config entry."""
|
||||||
|
|
||||||
|
return config_entry.runtime_data.data
|
69
tests/components/bring/snapshots/test_diagnostics.ambr
Normal file
69
tests/components/bring/snapshots/test_diagnostics.ambr
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
# serializer version: 1
|
||||||
|
# name: test_diagnostics
|
||||||
|
dict({
|
||||||
|
'b4776778-7f6c-496e-951b-92a35d3db0dd': dict({
|
||||||
|
'listUuid': 'b4776778-7f6c-496e-951b-92a35d3db0dd',
|
||||||
|
'name': 'Baumarkt',
|
||||||
|
'purchase': list([
|
||||||
|
dict({
|
||||||
|
'attributes': list([
|
||||||
|
]),
|
||||||
|
'itemId': 'Paprika',
|
||||||
|
'specification': 'Rot',
|
||||||
|
'uuid': 'b5d0790b-5f32-4d5c-91da-e29066f167de',
|
||||||
|
}),
|
||||||
|
dict({
|
||||||
|
'attributes': list([
|
||||||
|
]),
|
||||||
|
'itemId': 'Pouletbrüstli',
|
||||||
|
'specification': 'Bio',
|
||||||
|
'uuid': '72d370ab-d8ca-4e41-b956-91df94795b4e',
|
||||||
|
}),
|
||||||
|
]),
|
||||||
|
'recently': list([
|
||||||
|
dict({
|
||||||
|
'attributes': list([
|
||||||
|
]),
|
||||||
|
'itemId': 'Ananas',
|
||||||
|
'specification': '',
|
||||||
|
'uuid': 'fc8db30a-647e-4e6c-9d71-3b85d6a2d954',
|
||||||
|
}),
|
||||||
|
]),
|
||||||
|
'status': 'REGISTERED',
|
||||||
|
'theme': 'ch.publisheria.bring.theme.home',
|
||||||
|
'uuid': '77a151f8-77c4-47a3-8295-c750a0e69d4f',
|
||||||
|
}),
|
||||||
|
'e542eef6-dba7-4c31-a52c-29e6ab9d83a5': dict({
|
||||||
|
'listUuid': 'e542eef6-dba7-4c31-a52c-29e6ab9d83a5',
|
||||||
|
'name': 'Einkauf',
|
||||||
|
'purchase': list([
|
||||||
|
dict({
|
||||||
|
'attributes': list([
|
||||||
|
]),
|
||||||
|
'itemId': 'Paprika',
|
||||||
|
'specification': 'Rot',
|
||||||
|
'uuid': 'b5d0790b-5f32-4d5c-91da-e29066f167de',
|
||||||
|
}),
|
||||||
|
dict({
|
||||||
|
'attributes': list([
|
||||||
|
]),
|
||||||
|
'itemId': 'Pouletbrüstli',
|
||||||
|
'specification': 'Bio',
|
||||||
|
'uuid': '72d370ab-d8ca-4e41-b956-91df94795b4e',
|
||||||
|
}),
|
||||||
|
]),
|
||||||
|
'recently': list([
|
||||||
|
dict({
|
||||||
|
'attributes': list([
|
||||||
|
]),
|
||||||
|
'itemId': 'Ananas',
|
||||||
|
'specification': '',
|
||||||
|
'uuid': 'fc8db30a-647e-4e6c-9d71-3b85d6a2d954',
|
||||||
|
}),
|
||||||
|
]),
|
||||||
|
'status': 'REGISTERED',
|
||||||
|
'theme': 'ch.publisheria.bring.theme.home',
|
||||||
|
'uuid': '77a151f8-77c4-47a3-8295-c750a0e69d4f',
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
# ---
|
27
tests/components/bring/test_diagnostics.py
Normal file
27
tests/components/bring/test_diagnostics.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
"""Test for diagnostics platform of the Bring! integration."""
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from syrupy.assertion import SnapshotAssertion
|
||||||
|
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
|
from tests.common import MockConfigEntry
|
||||||
|
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||||
|
from tests.typing import ClientSessionGenerator
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("mock_bring_client")
|
||||||
|
async def test_diagnostics(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
hass_client: ClientSessionGenerator,
|
||||||
|
bring_config_entry: MockConfigEntry,
|
||||||
|
snapshot: SnapshotAssertion,
|
||||||
|
) -> None:
|
||||||
|
"""Test diagnostics."""
|
||||||
|
bring_config_entry.add_to_hass(hass)
|
||||||
|
await hass.config_entries.async_setup(bring_config_entry.entry_id)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
assert (
|
||||||
|
await get_diagnostics_for_config_entry(hass, hass_client, bring_config_entry)
|
||||||
|
== snapshot
|
||||||
|
)
|
Loading…
x
Reference in New Issue
Block a user