Skip to content
Snippets Groups Projects
Unverified Commit ab8e2d92 authored by G Johansson's avatar G Johansson Committed by GitHub
Browse files

Add diagnostics to Workday (#126691)

parent 03968b44
No related branches found
No related tags found
No related merge requests found
"""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,
}
# 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,
}),
})
# ---
"""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"),
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment