Use snapshot assertion in Tile diagnostic test (#98965)

This commit is contained in:
Joost Lekkerkerker 2023-08-24 17:11:24 +02:00 committed by GitHub
parent d300f2d0cc
commit 4e049f9bed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 24 deletions

View File

@ -0,0 +1,26 @@
# serializer version: 1
# name: test_entry_diagnostics
dict({
'tiles': list([
dict({
'accuracy': 13.496111,
'altitude': '**REDACTED**',
'archetype': 'WALLET',
'dead': False,
'firmware_version': '01.12.14.0',
'hardware_version': '02.09',
'kind': 'TILE',
'last_timestamp': '2020-08-12T17:55:26',
'latitude': '**REDACTED**',
'longitude': '**REDACTED**',
'lost': False,
'lost_timestamp': '1969-12-31T23:59:59.999000',
'name': 'Wallet',
'ring_state': 'STOPPED',
'uuid': '**REDACTED**',
'visible': True,
'voip_state': 'OFFLINE',
}),
]),
})
# ---

View File

@ -1,5 +1,6 @@
"""Test Tile diagnostics."""
from homeassistant.components.diagnostics import REDACTED
from syrupy import SnapshotAssertion
from homeassistant.core import HomeAssistant
from tests.components.diagnostics import get_diagnostics_for_config_entry
@ -11,28 +12,10 @@ async def test_entry_diagnostics(
config_entry,
hass_client: ClientSessionGenerator,
setup_config_entry,
snapshot: SnapshotAssertion,
) -> None:
"""Test config entry diagnostics."""
assert await get_diagnostics_for_config_entry(hass, hass_client, config_entry) == {
"tiles": [
{
"accuracy": 13.496111,
"altitude": REDACTED,
"archetype": "WALLET",
"dead": False,
"firmware_version": "01.12.14.0",
"hardware_version": "02.09",
"kind": "TILE",
"last_timestamp": "2020-08-12T17:55:26",
"latitude": REDACTED,
"longitude": REDACTED,
"lost": False,
"lost_timestamp": "1969-12-31T23:59:59.999000",
"name": "Wallet",
"ring_state": "STOPPED",
"uuid": REDACTED,
"visible": True,
"voip_state": "OFFLINE",
}
]
}
assert (
await get_diagnostics_for_config_entry(hass, hass_client, config_entry)
== snapshot
)