Add diagnostics to Workday (#126691)
parent
03968b44bd
commit
ab8e2d92c8
|
@ -0,0 +1,18 @@
|
|||
"""Diagnostics support for Workday."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
|
||||
async def async_get_config_entry_diagnostics(
|
||||
hass: HomeAssistant, entry: ConfigEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a config entry."""
|
||||
|
||||
return {
|
||||
"config_entry": entry,
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
# serializer version: 1
|
||||
# name: test_diagnostics
|
||||
dict({
|
||||
'config_entry': dict({
|
||||
'data': dict({
|
||||
}),
|
||||
'disabled_by': None,
|
||||
'discovery_keys': dict({
|
||||
}),
|
||||
'domain': 'workday',
|
||||
'entry_id': '1',
|
||||
'minor_version': 1,
|
||||
'options': dict({
|
||||
'add_holidays': list([
|
||||
'2022-12-01',
|
||||
'2022-12-05,2022-12-15',
|
||||
]),
|
||||
'country': 'DE',
|
||||
'days_offset': 0,
|
||||
'excludes': list([
|
||||
'sat',
|
||||
'sun',
|
||||
'holiday',
|
||||
]),
|
||||
'language': 'de',
|
||||
'name': 'Workday Sensor',
|
||||
'province': 'BW',
|
||||
'remove_holidays': list([
|
||||
'2022-12-04',
|
||||
'2022-12-24,2022-12-26',
|
||||
]),
|
||||
'workdays': list([
|
||||
'mon',
|
||||
'tue',
|
||||
'wed',
|
||||
'thu',
|
||||
'fri',
|
||||
]),
|
||||
}),
|
||||
'pref_disable_new_entities': False,
|
||||
'pref_disable_polling': False,
|
||||
'source': 'user',
|
||||
'title': 'Mock Title',
|
||||
'unique_id': None,
|
||||
'version': 1,
|
||||
}),
|
||||
})
|
||||
# ---
|
|
@ -0,0 +1,28 @@
|
|||
"""Test Workday diagnostics."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
from syrupy.filters import props
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import TEST_CONFIG_ADD_REMOVE_DATE_RANGE, init_integration
|
||||
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test generating diagnostics for a config entry."""
|
||||
entry = await init_integration(hass, TEST_CONFIG_ADD_REMOVE_DATE_RANGE)
|
||||
|
||||
diag = await get_diagnostics_for_config_entry(hass, hass_client, entry)
|
||||
|
||||
assert diag == snapshot(
|
||||
exclude=props("full_features", "created_at", "modified_at"),
|
||||
)
|
Loading…
Reference in New Issue