mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Use snapshots in Linear diagnostics tests (#116169)
* Use snapshots in Linear diagnostics tests * Use snapshots in Linear diagnostics tests
This commit is contained in:
parent
1e06054344
commit
860ac450c4
@ -0,0 +1,79 @@
|
||||
# serializer version: 1
|
||||
# name: test_entry_diagnostics
|
||||
dict({
|
||||
'coordinator_data': dict({
|
||||
'test1': dict({
|
||||
'name': 'Test Garage 1',
|
||||
'subdevices': dict({
|
||||
'GDO': dict({
|
||||
'Open_B': 'true',
|
||||
'Open_P': '100',
|
||||
}),
|
||||
'Light': dict({
|
||||
'On_B': 'true',
|
||||
'On_P': '100',
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
'test2': dict({
|
||||
'name': 'Test Garage 2',
|
||||
'subdevices': dict({
|
||||
'GDO': dict({
|
||||
'Open_B': 'false',
|
||||
'Open_P': '0',
|
||||
}),
|
||||
'Light': dict({
|
||||
'On_B': 'false',
|
||||
'On_P': '0',
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
'test3': dict({
|
||||
'name': 'Test Garage 3',
|
||||
'subdevices': dict({
|
||||
'GDO': dict({
|
||||
'Open_B': 'false',
|
||||
'Opening_P': '0',
|
||||
}),
|
||||
'Light': dict({
|
||||
'On_B': 'false',
|
||||
'On_P': '0',
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
'test4': dict({
|
||||
'name': 'Test Garage 4',
|
||||
'subdevices': dict({
|
||||
'GDO': dict({
|
||||
'Open_B': 'true',
|
||||
'Opening_P': '100',
|
||||
}),
|
||||
'Light': dict({
|
||||
'On_B': 'true',
|
||||
'On_P': '100',
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
'entry': dict({
|
||||
'data': dict({
|
||||
'device_id': 'test-uuid',
|
||||
'email': '**REDACTED**',
|
||||
'password': '**REDACTED**',
|
||||
'site_id': 'test-site-id',
|
||||
}),
|
||||
'disabled_by': None,
|
||||
'domain': 'linear_garage_door',
|
||||
'entry_id': 'acefdd4b3a4a0911067d1cf51414201e',
|
||||
'minor_version': 1,
|
||||
'options': dict({
|
||||
}),
|
||||
'pref_disable_new_entities': False,
|
||||
'pref_disable_polling': False,
|
||||
'source': 'user',
|
||||
'title': 'Mock Title',
|
||||
'unique_id': None,
|
||||
'version': 1,
|
||||
}),
|
||||
})
|
||||
# ---
|
@ -1,5 +1,7 @@
|
||||
"""Test diagnostics of Linear Garage Door."""
|
||||
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .util import async_init_integration
|
||||
@ -9,45 +11,11 @@ from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_entry_diagnostics(
|
||||
hass: HomeAssistant, hass_client: ClientSessionGenerator
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test config entry diagnostics."""
|
||||
entry = await async_init_integration(hass)
|
||||
result = await get_diagnostics_for_config_entry(hass, hass_client, entry)
|
||||
|
||||
assert result["entry"]["data"] == {
|
||||
"email": "**REDACTED**",
|
||||
"password": "**REDACTED**",
|
||||
"site_id": "test-site-id",
|
||||
"device_id": "test-uuid",
|
||||
}
|
||||
assert result["coordinator_data"] == {
|
||||
"test1": {
|
||||
"name": "Test Garage 1",
|
||||
"subdevices": {
|
||||
"GDO": {"Open_B": "true", "Open_P": "100"},
|
||||
"Light": {"On_B": "true", "On_P": "100"},
|
||||
},
|
||||
},
|
||||
"test2": {
|
||||
"name": "Test Garage 2",
|
||||
"subdevices": {
|
||||
"GDO": {"Open_B": "false", "Open_P": "0"},
|
||||
"Light": {"On_B": "false", "On_P": "0"},
|
||||
},
|
||||
},
|
||||
"test3": {
|
||||
"name": "Test Garage 3",
|
||||
"subdevices": {
|
||||
"GDO": {"Open_B": "false", "Opening_P": "0"},
|
||||
"Light": {"On_B": "false", "On_P": "0"},
|
||||
},
|
||||
},
|
||||
"test4": {
|
||||
"name": "Test Garage 4",
|
||||
"subdevices": {
|
||||
"GDO": {"Open_B": "true", "Opening_P": "100"},
|
||||
"Light": {"On_B": "true", "On_P": "100"},
|
||||
},
|
||||
},
|
||||
}
|
||||
assert result == snapshot
|
||||
|
@ -12,6 +12,7 @@ async def async_init_integration(hass: HomeAssistant) -> MockConfigEntry:
|
||||
"""Initialize mock integration."""
|
||||
config_entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
entry_id="acefdd4b3a4a0911067d1cf51414201e",
|
||||
data={
|
||||
"email": "test-email",
|
||||
"password": "test-password",
|
||||
|
Loading…
x
Reference in New Issue
Block a user