Use snapshot assertion for Enphase Envoy diagnostics test (#98910)
parent
360d2de1e1
commit
a539d851cc
|
@ -24,6 +24,7 @@ def config_entry_fixture(hass: HomeAssistant, config, serial_number):
|
|||
"""Define a config entry fixture."""
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
entry_id="45a36e55aaddb2007c5f6602e0c38e72",
|
||||
title=f"Envoy {serial_number}" if serial_number else "Envoy",
|
||||
unique_id=serial_number,
|
||||
data=config,
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
# serializer version: 1
|
||||
# name: test_entry_diagnostics
|
||||
dict({
|
||||
'data': dict({
|
||||
'varies_by': 'firmware_version',
|
||||
}),
|
||||
'entry': dict({
|
||||
'data': dict({
|
||||
'host': '1.1.1.1',
|
||||
'name': '**REDACTED**',
|
||||
'password': '**REDACTED**',
|
||||
'token': '**REDACTED**',
|
||||
'username': '**REDACTED**',
|
||||
}),
|
||||
'disabled_by': None,
|
||||
'domain': 'enphase_envoy',
|
||||
'entry_id': '45a36e55aaddb2007c5f6602e0c38e72',
|
||||
'options': dict({
|
||||
}),
|
||||
'pref_disable_new_entities': False,
|
||||
'pref_disable_polling': False,
|
||||
'source': 'user',
|
||||
'title': '**REDACTED**',
|
||||
'unique_id': '**REDACTED**',
|
||||
'version': 1,
|
||||
}),
|
||||
})
|
||||
# ---
|
|
@ -1,5 +1,6 @@
|
|||
"""Test Enphase Envoy 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,27 +12,10 @@ async def test_entry_diagnostics(
|
|||
config_entry,
|
||||
hass_client: ClientSessionGenerator,
|
||||
setup_enphase_envoy,
|
||||
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": "enphase_envoy",
|
||||
"title": REDACTED,
|
||||
"data": {
|
||||
"host": "1.1.1.1",
|
||||
"name": REDACTED,
|
||||
"username": REDACTED,
|
||||
"password": REDACTED,
|
||||
"token": REDACTED,
|
||||
},
|
||||
"options": {},
|
||||
"pref_disable_new_entities": False,
|
||||
"pref_disable_polling": False,
|
||||
"source": "user",
|
||||
"unique_id": REDACTED,
|
||||
"disabled_by": None,
|
||||
},
|
||||
"data": {"varies_by": "firmware_version"},
|
||||
}
|
||||
assert (
|
||||
await get_diagnostics_for_config_entry(hass, hass_client, config_entry)
|
||||
== snapshot
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue