Complete persistent notifications migration (#92828)

* Complete migration of persistent notifications

Persistent notifications are no longer stored in
the state machine and no longer fire events

* Complete migration of persistent notifications

Persistent notifications are no longer stored in
the state machine and no longer fire events

* fixes

* fixes

* fixes

* ws test

* update tests

* update tests

* fix more tests

* fix more tests

* more fixes

* fix

* fix person

* fix person

* keep whitelist

* use singleton
This commit is contained in:
J. Nick Koston 2023-05-25 22:09:13 -05:00 committed by GitHub
parent e2b69fc470
commit 48485fc2bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 310 additions and 195 deletions

View file

@ -4,6 +4,8 @@ import homeassistant.components.persistent_notification as pn
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component
from tests.common import async_get_persistent_notifications
async def test_async_send_message(hass: HomeAssistant) -> None:
"""Test sending a message to notify.persistent_notification service."""
@ -17,9 +19,9 @@ async def test_async_send_message(hass: HomeAssistant) -> None:
)
await hass.async_block_till_done()
entity_ids = hass.states.async_entity_ids(pn.DOMAIN)
assert len(entity_ids) == 1
notifications = async_get_persistent_notifications(hass)
assert len(notifications) == 1
notification = notifications[list(notifications)[0]]
state = hass.states.get(entity_ids[0])
assert state.attributes.get("message") == "Hello"
assert state.attributes.get("title") == "Test notification"
assert notification["message"] == "Hello"
assert notification["title"] == "Test notification"