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:
Paulus Schoutsen 2021-10-07 03:58:00 -07:00 committed by GitHub
parent 750dd9186e
commit a4d9019ffc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
198 changed files with 848 additions and 1114 deletions

View file

@ -5,7 +5,7 @@ from ismartgate import GogoGate2Api, ISmartGateApi
from ismartgate.common import ApiError
from ismartgate.const import GogoGate2ApiErrorCode
from homeassistant import config_entries, setup
from homeassistant import config_entries
from homeassistant.components.gogogate2.const import (
DEVICE_TYPE_GOGOGATE2,
DEVICE_TYPE_ISMARTGATE,
@ -102,7 +102,6 @@ async def test_auth_fail(
async def test_form_homekit_unique_id_already_setup(hass):
"""Test that we abort from homekit if gogogate2 is already setup."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await hass.config_entries.flow.async_init(
DOMAIN,
@ -134,7 +133,6 @@ async def test_form_homekit_unique_id_already_setup(hass):
async def test_form_homekit_ip_address_already_setup(hass):
"""Test that we abort from homekit if gogogate2 is already setup."""
await setup.async_setup_component(hass, "persistent_notification", {})
entry = MockConfigEntry(
domain=DOMAIN,
@ -152,7 +150,6 @@ async def test_form_homekit_ip_address_already_setup(hass):
async def test_form_homekit_ip_address(hass):
"""Test homekit includes the defaults ip address."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await hass.config_entries.flow.async_init(
DOMAIN,
@ -181,7 +178,6 @@ async def test_discovered_dhcp(
ismartgateapi_mock.return_value = api
api.reset_mock()
await setup.async_setup_component(hass, "persistent_notification", {})
result = await hass.config_entries.flow.async_init(
DOMAIN,
@ -227,7 +223,6 @@ async def test_discovered_dhcp(
async def test_discovered_by_homekit_and_dhcp(hass):
"""Test we get the form with homekit and abort for dhcp source when we get both."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await hass.config_entries.flow.async_init(
DOMAIN,