Remove deprecated template support in persistent notifications (#69021)

This commit is contained in:
Franck Nijhof 2022-03-31 22:28:15 +02:00 committed by GitHub
parent 72c4c359a4
commit 5280bf2296
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 51 deletions

View file

@ -20,7 +20,7 @@ async def test_create(hass):
assert len(hass.states.async_entity_ids(pn.DOMAIN)) == 0
assert len(notifications) == 0
pn.async_create(hass, "Hello World {{ 1 + 1 }}", title="{{ 1 + 1 }} beers")
pn.async_create(hass, "Hello World 2", title="2 beers")
entity_ids = hass.states.async_entity_ids(pn.DOMAIN)
assert len(entity_ids) == 1
@ -68,27 +68,6 @@ async def test_create_notification_id(hass):
assert notification["message"] == "test 2"
async def test_create_template_error(hass):
"""Ensure we output templates if contain error."""
notifications = hass.data[pn.DOMAIN]
assert len(hass.states.async_entity_ids(pn.DOMAIN)) == 0
assert len(notifications) == 0
pn.async_create(hass, "{{ message + 1 }}", "{{ title + 1 }}")
entity_ids = hass.states.async_entity_ids(pn.DOMAIN)
assert len(entity_ids) == 1
assert len(notifications) == 1
state = hass.states.get(entity_ids[0])
assert state.attributes.get("message") == "{{ message + 1 }}"
assert state.attributes.get("title") == "{{ title + 1 }}"
notification = notifications.get(entity_ids[0])
assert notification["message"] == "{{ message + 1 }}"
assert notification["title"] == "{{ title + 1 }}"
async def test_dismiss_notification(hass):
"""Ensure removal of specific notification."""
notifications = hass.data[pn.DOMAIN]