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 Paulus Schoutsen
parent 286de1f051
commit 0e50baf007

View File

@@ -212,3 +212,27 @@ async def test_ws_get_subscribe(
assert msg["event"] assert msg["event"]
event = msg["event"] event = msg["event"]
assert event["type"] == "removed" 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