Do not use get_hub in deCONZ tests (#122706)
parent
5467685bd8
commit
06ee8fdd47
|
@ -9,7 +9,6 @@ from syrupy import SnapshotAssertion
|
|||
from homeassistant.components import ssdp
|
||||
from homeassistant.components.deconz.config_flow import DECONZ_MANUFACTURERURL
|
||||
from homeassistant.components.deconz.const import DOMAIN as DECONZ_DOMAIN
|
||||
from homeassistant.components.deconz.hub import DeconzHub
|
||||
from homeassistant.components.ssdp import (
|
||||
ATTR_UPNP_MANUFACTURER_URL,
|
||||
ATTR_UPNP_SERIAL,
|
||||
|
@ -71,13 +70,15 @@ async def test_update_address(
|
|||
hass: HomeAssistant, config_entry_setup: MockConfigEntry
|
||||
) -> None:
|
||||
"""Make sure that connection status triggers a dispatcher send."""
|
||||
gateway = DeconzHub.get_hub(hass, config_entry_setup)
|
||||
assert gateway.api.host == "1.2.3.4"
|
||||
assert config_entry_setup.data["host"] == "1.2.3.4"
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.deconz.async_setup_entry",
|
||||
return_value=True,
|
||||
) as mock_setup_entry:
|
||||
with (
|
||||
patch(
|
||||
"homeassistant.components.deconz.async_setup_entry",
|
||||
return_value=True,
|
||||
) as mock_setup_entry,
|
||||
patch("pydeconz.gateway.WSClient") as ws_mock,
|
||||
):
|
||||
await hass.config_entries.flow.async_init(
|
||||
DECONZ_DOMAIN,
|
||||
data=ssdp.SsdpServiceInfo(
|
||||
|
@ -94,17 +95,6 @@ async def test_update_address(
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert gateway.api.host == "2.3.4.5"
|
||||
assert ws_mock.call_args[0][1] == "2.3.4.5"
|
||||
assert config_entry_setup.data["host"] == "2.3.4.5"
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
||||
|
||||
async def test_reset_after_successful_setup(
|
||||
hass: HomeAssistant, config_entry_setup: MockConfigEntry
|
||||
) -> None:
|
||||
"""Make sure that connection status triggers a dispatcher send."""
|
||||
gateway = DeconzHub.get_hub(hass, config_entry_setup)
|
||||
|
||||
result = await gateway.async_reset()
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result is True
|
||||
|
|
Loading…
Reference in New Issue