core/tests/components/notion/test_diagnostics.py
Erik Montnemery 4b34d1bbb5
Merge config subentry feature branch to dev (#136121)
* Reapply "Add support for subentries to config entries" (#133470) (#136061)

* Reapply "Add support for subentries to config entries" (#133470)

This reverts commit ecb3bf79f32a2e25d141ff467e5958826ed9fc3a.

* Update test snapshot

* Add config subentry support to device registry (#128157)

* Add config subentry support to device registry

* Apply suggestions from code review

* Update syrupy serializer

* Update snapshots

* Address review comments

* Allow a device to be connected to no or a single subentry of a config entry

* Update snapshots

* Revert "Allow a device to be connected to no or a single subentry of a config entry"

This reverts commit ec6f613151cb4a806b7961033c004b71b76510c2.

* Update test snapshots

* Bump release version in comments

* Rename config_subentries to config_entries_subentries

* Add config subentry support to entity registry (#128155)

* Add config subentry support to entity registry

* Update syrupy serializer

* Update snapshots

* Update snapshots

* Accept suggested changes

* Clean registries when removing subentry (#136671)

* Clean up registries when removing subentry

* Update tests

* Clean up subentries from deleted devices when removing config entry (#136669)

* Clean up subentries from deleted devices when removing config entry

* Move

* Add config subentry support to entity platform (#128161)

* Add config subentry support to entity platform

* Rename subentry_id to config_subentry_id

* Store subentry type in subentry (#136687)

* Add reconfigure support to config subentries (#133353)

* Add reconfigure support to config subentries

* Update test

* Minor adjustment

* Rename supported_subentry_flows to supported_subentry_types

* Address review comments

* Add subentry support to kitchen sink (#136755)

* Add subentry support to kitchen sink

* Add subentry reconfigure support to kitchen_sink

* Update kitchen_sink tests with subentry type stored in config entry

* Update kitchen_sink

* Update kitchen_sink

* Adjust kitchen sink tests

* Fix hassfest

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Improve docstrings and strings.json

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2025-02-10 16:40:07 +01:00

131 lines
4.9 KiB
Python

"""Test Notion diagnostics."""
from homeassistant.components.diagnostics import REDACTED
from homeassistant.components.notion import DOMAIN
from homeassistant.core import HomeAssistant
from tests.common import ANY
from tests.components.diagnostics import get_diagnostics_for_config_entry
from tests.typing import ClientSessionGenerator
async def test_entry_diagnostics(
hass: HomeAssistant,
config_entry,
hass_client: ClientSessionGenerator,
setup_config_entry,
) -> 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,
"minor_version": 1,
"domain": DOMAIN,
"title": REDACTED,
"data": {
"refresh_token": REDACTED,
"user_uuid": REDACTED,
"username": REDACTED,
},
"options": {},
"pref_disable_new_entities": False,
"pref_disable_polling": False,
"source": "user",
"unique_id": REDACTED,
"disabled_by": None,
"created_at": ANY,
"modified_at": ANY,
"discovery_keys": {},
"subentries": [],
},
"data": {
"bridges": [
{
"id": 12345,
"name": "Laundry Closet",
"mode": "home",
"hardware_id": REDACTED,
"hardware_revision": 4,
"firmware_version": {
"wifi": "0.121.0",
"wifi_app": "3.3.0",
"silabs": "1.1.2",
"ti": None,
},
"missing_at": None,
"created_at": "2019-04-30T01:43:50.497000+00:00",
"updated_at": "2023-12-12T22:33:01.073000+00:00",
"system_id": 12345,
"firmware": {
"wifi": "0.121.0",
"wifi_app": "3.3.0",
"silabs": "1.1.2",
"ti": None,
},
"links": {"system": 12345},
}
],
"listeners": [
{
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"definition_id": 24,
"created_at": "2019-06-17T03:29:45.722000+00:00",
"model_version": "1.0",
"sensor_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"status_localized": {
"state": "Idle",
"description": "Jun 18 at 12:17am",
},
"insights": {
"primary": {
"origin": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"type": "Sensor",
},
"value": "idle",
"data_received_at": "2023-06-18T06:17:00.697000+00:00",
}
},
"configuration": {},
"pro_monitoring_status": "ineligible",
"device_type": "sensor",
}
],
"sensors": [
{
"id": 123456,
"uuid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"user": {"id": 12345, "email": REDACTED},
"bridge": {"id": 67890, "hardware_id": REDACTED},
"last_bridge_hardware_id": REDACTED,
"name": "Sensor 1",
"location_id": 123456,
"system_id": 12345,
"hardware_id": REDACTED,
"hardware_revision": 5,
"firmware_version": "1.1.2",
"device_key": REDACTED,
"encryption_key": True,
"installed_at": "2019-06-17T03:30:27.766000+00:00",
"calibrated_at": "2024-01-19T00:38:15.372000+00:00",
"last_reported_at": "2024-01-21T00:00:46.705000+00:00",
"missing_at": None,
"updated_at": "2024-01-19T00:38:16.856000+00:00",
"created_at": "2019-06-17T03:29:45.506000+00:00",
"signal_strength": 4,
"firmware": {"status": "valid"},
"surface_type": None,
}
],
"user_preferences": {
"user_id": REDACTED,
"military_time_enabled": False,
"celsius_enabled": False,
"disconnect_alerts_enabled": True,
"home_away_alerts_enabled": False,
"battery_alerts_enabled": True,
},
},
}