Use snapshot assertion for Watttime diagnostics test (#99023)

pull/97467/head
Joost Lekkerkerker 2023-08-27 16:19:15 +02:00 committed by GitHub
parent 11cecc3f0a
commit b266096ae1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 30 deletions

View File

@ -0,0 +1,32 @@
# serializer version: 1
# name: test_entry_diagnostics
dict({
'data': dict({
'ba': 'CAISO_NORTH',
'freq': '300',
'moer': '850.743982',
'percent': '53',
'point_time': '2019-01-29T14:55:00.00Z',
}),
'entry': dict({
'data': dict({
'balancing_authority': '**REDACTED**',
'balancing_authority_abbreviation': '**REDACTED**',
'latitude': '**REDACTED**',
'longitude': '**REDACTED**',
'password': '**REDACTED**',
'username': '**REDACTED**',
}),
'disabled_by': None,
'domain': 'watttime',
'options': dict({
}),
'pref_disable_new_entities': False,
'pref_disable_polling': False,
'source': 'user',
'title': '**REDACTED**',
'unique_id': '**REDACTED**',
'version': 1,
}),
})
# ---

View File

@ -1,5 +1,7 @@
"""Test WattTime diagnostics."""
from homeassistant.components.diagnostics import REDACTED
from syrupy import SnapshotAssertion
from syrupy.filters import props
from homeassistant.core import HomeAssistant
from tests.components.diagnostics import get_diagnostics_for_config_entry
@ -11,34 +13,9 @@ async def test_entry_diagnostics(
config_entry,
hass_client: ClientSessionGenerator,
setup_watttime,
snapshot: SnapshotAssertion,
) -> None:
"""Test config entry diagnostics."""
assert await get_diagnostics_for_config_entry(hass, hass_client, config_entry) == {
"entry": {
"entry_id": config_entry.entry_id,
"version": 1,
"domain": "watttime",
"title": REDACTED,
"data": {
"username": REDACTED,
"password": REDACTED,
"latitude": REDACTED,
"longitude": REDACTED,
"balancing_authority": REDACTED,
"balancing_authority_abbreviation": REDACTED,
},
"options": {},
"pref_disable_new_entities": False,
"pref_disable_polling": False,
"source": "user",
"unique_id": REDACTED,
"disabled_by": None,
},
"data": {
"freq": "300",
"ba": "CAISO_NORTH",
"percent": "53",
"moer": "850.743982",
"point_time": "2019-01-29T14:55:00.00Z",
},
}
assert await get_diagnostics_for_config_entry(
hass, hass_client, config_entry
) == snapshot(exclude=props("entry_id"))