Verify persistant notifications can be dismissed by the id they are created with (#94112)

This commit is contained in:
J. Nick Koston 2023-06-06 19:42:11 -05:00 committed by GitHub
parent 6ab7b0f99c
commit 001da39a47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -151,3 +151,27 @@ async def test_ws_get_subscribe(
assert msg["event"]
event = msg["event"]
assert event["type"] == "removed"
async def test_manual_notification_id_round_trip(hass: HomeAssistant) -> None:
"""Test that a manual notification id can be round tripped."""
notifications = pn._async_get_or_create_notifications(hass)
assert len(notifications) == 0
await hass.services.async_call(
pn.DOMAIN,
"create",
{"notification_id": "synology_diskstation_hub_notification", "message": "test"},
blocking=True,
)
assert len(notifications) == 1
await hass.services.async_call(
pn.DOMAIN,
"dismiss",
{"notification_id": "synology_diskstation_hub_notification"},
blocking=True,
)
assert len(notifications) == 0