mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
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
@ -107,7 +107,9 @@ class HomematicipHAP:
|
|||||||
"Connected to HomematicIP with HAP %s", self.config_entry.unique_id
|
"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
|
return True
|
||||||
|
|
||||||
|
@ -23,6 +23,8 @@ from homeassistant.exceptions import ConfigEntryNotReady
|
|||||||
|
|
||||||
from .helper import HAPID, HAPPIN
|
from .helper import HAPID, HAPPIN
|
||||||
|
|
||||||
|
from tests.common import MockConfigEntry
|
||||||
|
|
||||||
|
|
||||||
async def test_auth_setup(hass):
|
async def test_auth_setup(hass):
|
||||||
"""Test auth setup for client registration."""
|
"""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
|
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."""
|
"""Test a successful setup of a accesspoint."""
|
||||||
hass = Mock()
|
# This test should not be accessing the integration internals
|
||||||
entry = Mock()
|
entry = MockConfigEntry(
|
||||||
|
domain=HMIPC_DOMAIN,
|
||||||
|
data={HMIPC_HAPID: "ABC123", HMIPC_AUTHTOKEN: "123", HMIPC_NAME: "hmip"},
|
||||||
|
)
|
||||||
home = Mock()
|
home = Mock()
|
||||||
entry.data = {HMIPC_HAPID: "ABC123", HMIPC_AUTHTOKEN: "123", HMIPC_NAME: "hmip"}
|
|
||||||
hap = HomematicipHAP(hass, entry)
|
hap = HomematicipHAP(hass, entry)
|
||||||
with patch.object(hap, "get_hap", return_value=home):
|
with patch.object(hap, "get_hap", return_value=home):
|
||||||
assert await hap.async_setup()
|
assert await hap.async_setup()
|
||||||
|
|
||||||
assert hap.home is home
|
assert hap.home is home
|
||||||
assert len(hass.config_entries.async_setup_platforms.mock_calls) == 1
|
|
||||||
|
|
||||||
|
|
||||||
async def test_hap_setup_connection_error():
|
async def test_hap_setup_connection_error():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user