Migrate homematicip_cloud to use async_forward_entry_setups (#86563)
* Migrate homematicip_cloud to use async_forward_entry_setups Replaces deprecated async_setup_platforms with async_forward_entry_setups * adapt test, this test should be rewritten
This commit is contained in:
parent
e427a70dc7
commit
3bfdba50d9
2 changed files with 11 additions and 6 deletions
|
@ -107,7 +107,9 @@ class HomematicipHAP:
|
|||
"Connected to HomematicIP with HAP %s", self.config_entry.unique_id
|
||||
)
|
||||
|
||||
self.hass.config_entries.async_setup_platforms(self.config_entry, PLATFORMS)
|
||||
await self.hass.config_entries.async_forward_entry_setups(
|
||||
self.config_entry, PLATFORMS
|
||||
)
|
||||
|
||||
return True
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@ from homeassistant.exceptions import ConfigEntryNotReady
|
|||
|
||||
from .helper import HAPID, HAPPIN
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
async def test_auth_setup(hass):
|
||||
"""Test auth setup for client registration."""
|
||||
|
@ -71,18 +73,19 @@ async def test_auth_auth_check_and_register_with_exception(hass):
|
|||
assert await hmip_auth.async_register() is False
|
||||
|
||||
|
||||
async def test_hap_setup_works():
|
||||
async def test_hap_setup_works(hass):
|
||||
"""Test a successful setup of a accesspoint."""
|
||||
hass = Mock()
|
||||
entry = Mock()
|
||||
# This test should not be accessing the integration internals
|
||||
entry = MockConfigEntry(
|
||||
domain=HMIPC_DOMAIN,
|
||||
data={HMIPC_HAPID: "ABC123", HMIPC_AUTHTOKEN: "123", HMIPC_NAME: "hmip"},
|
||||
)
|
||||
home = Mock()
|
||||
entry.data = {HMIPC_HAPID: "ABC123", HMIPC_AUTHTOKEN: "123", HMIPC_NAME: "hmip"}
|
||||
hap = HomematicipHAP(hass, entry)
|
||||
with patch.object(hap, "get_hap", return_value=home):
|
||||
assert await hap.async_setup()
|
||||
|
||||
assert hap.home is home
|
||||
assert len(hass.config_entries.async_setup_platforms.mock_calls) == 1
|
||||
|
||||
|
||||
async def test_hap_setup_connection_error():
|
||||
|
|
Loading…
Add table
Reference in a new issue