Refactor persistent notification to no longer route all data via a service (#57157)
* Convert persistent notification tests to async * Create/dismiss persistent notifications in exposed functions, not service calls * Fix notify persistent_notification * Remove setting up persistent_notification * Drop more setups * Empty methods * Undeprecate sync methods because too big task * Fix setup clearing notifications * Fix a bunch of tests * Fix more tests * Uno mas * Test persistent notification events * Clean up stale comment Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
750dd9186e
commit
a4d9019ffc
198 changed files with 848 additions and 1114 deletions
|
@ -15,7 +15,6 @@ from tests.common import (
|
|||
MockConfigEntry,
|
||||
assert_lists_same,
|
||||
async_get_device_automations,
|
||||
async_mock_service,
|
||||
mock_device_registry,
|
||||
mock_registry,
|
||||
)
|
||||
|
@ -169,7 +168,6 @@ async def test_action(
|
|||
async def test_invalid_action(hass, device_reg: DeviceRegistry):
|
||||
"""Test for invalid actions."""
|
||||
device = DEVICE_LIGHTING_1
|
||||
notification_calls = async_mock_service(hass, "persistent_notification", "create")
|
||||
|
||||
await setup_entry(hass, {device.code: {"signal_repetitions": 1}})
|
||||
|
||||
|
@ -199,8 +197,8 @@ async def test_invalid_action(hass, device_reg: DeviceRegistry):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert len(notification_calls) == 1
|
||||
assert len(notifications := hass.states.async_all("persistent_notification")) == 1
|
||||
assert (
|
||||
"The following integrations and platforms could not be set up"
|
||||
in notification_calls[0].data["message"]
|
||||
in notifications[0].attributes["message"]
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue