mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Use snapshot in onewire diagnostics tests (#92112)
This commit is contained in:
parent
aac750a44f
commit
7801eeb063
41
tests/components/onewire/snapshots/test_diagnostics.ambr
Normal file
41
tests/components/onewire/snapshots/test_diagnostics.ambr
Normal file
@ -0,0 +1,41 @@
|
||||
# serializer version: 1
|
||||
# name: test_entry_diagnostics[EF.111111111113]
|
||||
dict({
|
||||
'devices': list([
|
||||
dict({
|
||||
'device_info': dict({
|
||||
'identifiers': list([
|
||||
list([
|
||||
'onewire',
|
||||
'EF.111111111113',
|
||||
]),
|
||||
]),
|
||||
'manufacturer': 'Hobby Boards',
|
||||
'model': 'HB_HUB',
|
||||
'name': 'EF.111111111113',
|
||||
}),
|
||||
'family': 'EF',
|
||||
'id': 'EF.111111111113',
|
||||
'path': '/EF.111111111113/',
|
||||
'type': 'HB_HUB',
|
||||
}),
|
||||
]),
|
||||
'entry': dict({
|
||||
'data': dict({
|
||||
'host': '**REDACTED**',
|
||||
'port': 1234,
|
||||
}),
|
||||
'options': dict({
|
||||
'device_options': dict({
|
||||
'28.222222222222': dict({
|
||||
'precision': 'temperature9',
|
||||
}),
|
||||
'28.222222222223': dict({
|
||||
'precision': 'temperature5',
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
'title': 'Mock Title',
|
||||
}),
|
||||
})
|
||||
# ---
|
@ -3,8 +3,8 @@ from collections.abc import Generator
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -43,25 +43,14 @@ async def test_entry_diagnostics(
|
||||
hass_client: ClientSessionGenerator,
|
||||
owproxy: MagicMock,
|
||||
device_id: str,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test config entry diagnostics."""
|
||||
setup_owproxy_mock_devices(owproxy, Platform.SENSOR, [device_id])
|
||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert await get_diagnostics_for_config_entry(hass, hass_client, config_entry) == {
|
||||
"entry": {
|
||||
"data": {
|
||||
"host": REDACTED,
|
||||
"port": 1234,
|
||||
},
|
||||
"options": {
|
||||
"device_options": {
|
||||
"28.222222222222": {"precision": "temperature9"},
|
||||
"28.222222222223": {"precision": "temperature5"},
|
||||
}
|
||||
},
|
||||
"title": "Mock Title",
|
||||
},
|
||||
"devices": [DEVICE_DETAILS],
|
||||
}
|
||||
assert (
|
||||
await get_diagnostics_for_config_entry(hass, hass_client, config_entry)
|
||||
== snapshot
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user