mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 22:07:10 +00:00
Use snapshot assertion for Deconz diagnostics test (#98908)
This commit is contained in:
parent
82e92cdf82
commit
1f0e8f93c5
79
tests/components/deconz/snapshots/test_diagnostics.ambr
Normal file
79
tests/components/deconz/snapshots/test_diagnostics.ambr
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
# serializer version: 1
|
||||||
|
# name: test_entry_diagnostics
|
||||||
|
dict({
|
||||||
|
'alarm_systems': dict({
|
||||||
|
}),
|
||||||
|
'config': dict({
|
||||||
|
'data': dict({
|
||||||
|
'api_key': '**REDACTED**',
|
||||||
|
'host': '1.2.3.4',
|
||||||
|
'port': 80,
|
||||||
|
}),
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'deconz',
|
||||||
|
'entry_id': '1',
|
||||||
|
'options': dict({
|
||||||
|
'master': True,
|
||||||
|
}),
|
||||||
|
'pref_disable_new_entities': False,
|
||||||
|
'pref_disable_polling': False,
|
||||||
|
'source': 'user',
|
||||||
|
'title': 'Mock Title',
|
||||||
|
'unique_id': '**REDACTED**',
|
||||||
|
'version': 1,
|
||||||
|
}),
|
||||||
|
'deconz_config': dict({
|
||||||
|
'bridgeid': '**REDACTED**',
|
||||||
|
'ipaddress': '1.2.3.4',
|
||||||
|
'mac': '**REDACTED**',
|
||||||
|
'modelid': 'deCONZ',
|
||||||
|
'name': 'deCONZ mock gateway',
|
||||||
|
'sw_version': '2.05.69',
|
||||||
|
'uuid': '1234',
|
||||||
|
'websocketport': 1234,
|
||||||
|
}),
|
||||||
|
'deconz_ids': dict({
|
||||||
|
}),
|
||||||
|
'entities': dict({
|
||||||
|
'alarm_control_panel': list([
|
||||||
|
]),
|
||||||
|
'binary_sensor': list([
|
||||||
|
]),
|
||||||
|
'button': list([
|
||||||
|
]),
|
||||||
|
'climate': list([
|
||||||
|
]),
|
||||||
|
'cover': list([
|
||||||
|
]),
|
||||||
|
'fan': list([
|
||||||
|
]),
|
||||||
|
'light': list([
|
||||||
|
]),
|
||||||
|
'lock': list([
|
||||||
|
]),
|
||||||
|
'number': list([
|
||||||
|
]),
|
||||||
|
'scene': list([
|
||||||
|
]),
|
||||||
|
'select': list([
|
||||||
|
]),
|
||||||
|
'sensor': list([
|
||||||
|
]),
|
||||||
|
'siren': list([
|
||||||
|
]),
|
||||||
|
'switch': list([
|
||||||
|
]),
|
||||||
|
}),
|
||||||
|
'events': dict({
|
||||||
|
}),
|
||||||
|
'groups': dict({
|
||||||
|
}),
|
||||||
|
'lights': dict({
|
||||||
|
}),
|
||||||
|
'scenes': dict({
|
||||||
|
}),
|
||||||
|
'sensors': dict({
|
||||||
|
}),
|
||||||
|
'websocket_state': 'running',
|
||||||
|
})
|
||||||
|
# ---
|
@ -1,12 +1,10 @@
|
|||||||
"""Test deCONZ diagnostics."""
|
"""Test deCONZ diagnostics."""
|
||||||
from pydeconz.websocket import State
|
from pydeconz.websocket import State
|
||||||
|
from syrupy import SnapshotAssertion
|
||||||
|
|
||||||
from homeassistant.components.deconz.const import CONF_MASTER_GATEWAY
|
|
||||||
from homeassistant.components.diagnostics import REDACTED
|
|
||||||
from homeassistant.const import CONF_API_KEY, CONF_HOST, CONF_PORT, Platform
|
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from .test_gateway import HOST, PORT, setup_deconz_integration
|
from .test_gateway import setup_deconz_integration
|
||||||
|
|
||||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||||
@ -18,6 +16,7 @@ async def test_entry_diagnostics(
|
|||||||
hass_client: ClientSessionGenerator,
|
hass_client: ClientSessionGenerator,
|
||||||
aioclient_mock: AiohttpClientMocker,
|
aioclient_mock: AiohttpClientMocker,
|
||||||
mock_deconz_websocket,
|
mock_deconz_websocket,
|
||||||
|
snapshot: SnapshotAssertion,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test config entry diagnostics."""
|
"""Test config entry diagnostics."""
|
||||||
config_entry = await setup_deconz_integration(hass, aioclient_mock)
|
config_entry = await setup_deconz_integration(hass, aioclient_mock)
|
||||||
@ -25,52 +24,7 @@ async def test_entry_diagnostics(
|
|||||||
await mock_deconz_websocket(state=State.RUNNING)
|
await mock_deconz_websocket(state=State.RUNNING)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert await get_diagnostics_for_config_entry(hass, hass_client, config_entry) == {
|
assert (
|
||||||
"config": {
|
await get_diagnostics_for_config_entry(hass, hass_client, config_entry)
|
||||||
"data": {CONF_API_KEY: REDACTED, CONF_HOST: HOST, CONF_PORT: PORT},
|
== snapshot
|
||||||
"disabled_by": None,
|
)
|
||||||
"domain": "deconz",
|
|
||||||
"entry_id": "1",
|
|
||||||
"options": {CONF_MASTER_GATEWAY: True},
|
|
||||||
"pref_disable_new_entities": False,
|
|
||||||
"pref_disable_polling": False,
|
|
||||||
"source": "user",
|
|
||||||
"title": "Mock Title",
|
|
||||||
"unique_id": REDACTED,
|
|
||||||
"version": 1,
|
|
||||||
},
|
|
||||||
"deconz_config": {
|
|
||||||
"bridgeid": REDACTED,
|
|
||||||
"ipaddress": HOST,
|
|
||||||
"mac": REDACTED,
|
|
||||||
"modelid": "deCONZ",
|
|
||||||
"name": "deCONZ mock gateway",
|
|
||||||
"sw_version": "2.05.69",
|
|
||||||
"uuid": "1234",
|
|
||||||
"websocketport": 1234,
|
|
||||||
},
|
|
||||||
"websocket_state": State.RUNNING.value,
|
|
||||||
"deconz_ids": {},
|
|
||||||
"entities": {
|
|
||||||
str(Platform.ALARM_CONTROL_PANEL): [],
|
|
||||||
str(Platform.BINARY_SENSOR): [],
|
|
||||||
str(Platform.BUTTON): [],
|
|
||||||
str(Platform.CLIMATE): [],
|
|
||||||
str(Platform.COVER): [],
|
|
||||||
str(Platform.FAN): [],
|
|
||||||
str(Platform.LIGHT): [],
|
|
||||||
str(Platform.LOCK): [],
|
|
||||||
str(Platform.NUMBER): [],
|
|
||||||
str(Platform.SCENE): [],
|
|
||||||
str(Platform.SELECT): [],
|
|
||||||
str(Platform.SENSOR): [],
|
|
||||||
str(Platform.SIREN): [],
|
|
||||||
str(Platform.SWITCH): [],
|
|
||||||
},
|
|
||||||
"events": {},
|
|
||||||
"alarm_systems": {},
|
|
||||||
"groups": {},
|
|
||||||
"lights": {},
|
|
||||||
"scenes": {},
|
|
||||||
"sensors": {},
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user