mirror of
https://github.com/home-assistant/core.git
synced 2025-07-11 15:27:08 +00:00
Remove async_setup from zerproc (#93903)
This commit is contained in:
parent
e0db9ab041
commit
ba76bbee44
@ -1,23 +1,13 @@
|
|||||||
"""Zerproc lights integration."""
|
"""Zerproc lights integration."""
|
||||||
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import Platform
|
from homeassistant.const import Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.typing import ConfigType
|
|
||||||
|
|
||||||
from .const import DATA_ADDRESSES, DATA_DISCOVERY_SUBSCRIPTION, DOMAIN
|
from .const import DATA_ADDRESSES, DATA_DISCOVERY_SUBSCRIPTION, DOMAIN
|
||||||
|
|
||||||
PLATFORMS = [Platform.LIGHT]
|
PLATFORMS = [Platform.LIGHT]
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|
||||||
"""Set up the Zerproc platform."""
|
|
||||||
hass.async_create_task(
|
|
||||||
hass.config_entries.flow.async_init(DOMAIN, context={"source": SOURCE_IMPORT})
|
|
||||||
)
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up Zerproc from a config entry."""
|
"""Set up Zerproc from a config entry."""
|
||||||
if DOMAIN not in hass.data:
|
if DOMAIN not in hass.data:
|
||||||
|
@ -21,8 +21,6 @@ async def test_flow_success(hass: HomeAssistant) -> None:
|
|||||||
"homeassistant.components.zerproc.config_flow.pyzerproc.discover",
|
"homeassistant.components.zerproc.config_flow.pyzerproc.discover",
|
||||||
return_value=["Light1", "Light2"],
|
return_value=["Light1", "Light2"],
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.components.zerproc.async_setup", return_value=True
|
|
||||||
) as mock_setup, patch(
|
|
||||||
"homeassistant.components.zerproc.async_setup_entry",
|
"homeassistant.components.zerproc.async_setup_entry",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
) as mock_setup_entry:
|
) as mock_setup_entry:
|
||||||
@ -36,7 +34,6 @@ async def test_flow_success(hass: HomeAssistant) -> None:
|
|||||||
assert result2["title"] == "Zerproc"
|
assert result2["title"] == "Zerproc"
|
||||||
assert result2["data"] == {}
|
assert result2["data"] == {}
|
||||||
|
|
||||||
assert len(mock_setup.mock_calls) == 1
|
|
||||||
assert len(mock_setup_entry.mock_calls) == 1
|
assert len(mock_setup_entry.mock_calls) == 1
|
||||||
|
|
||||||
|
|
||||||
@ -53,8 +50,6 @@ async def test_flow_no_devices_found(hass: HomeAssistant) -> None:
|
|||||||
"homeassistant.components.zerproc.config_flow.pyzerproc.discover",
|
"homeassistant.components.zerproc.config_flow.pyzerproc.discover",
|
||||||
return_value=[],
|
return_value=[],
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.components.zerproc.async_setup", return_value=True
|
|
||||||
) as mock_setup, patch(
|
|
||||||
"homeassistant.components.zerproc.async_setup_entry",
|
"homeassistant.components.zerproc.async_setup_entry",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
) as mock_setup_entry:
|
) as mock_setup_entry:
|
||||||
@ -66,7 +61,6 @@ async def test_flow_no_devices_found(hass: HomeAssistant) -> None:
|
|||||||
assert result2["type"] == "abort"
|
assert result2["type"] == "abort"
|
||||||
assert result2["reason"] == "no_devices_found"
|
assert result2["reason"] == "no_devices_found"
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert len(mock_setup.mock_calls) == 0
|
|
||||||
assert len(mock_setup_entry.mock_calls) == 0
|
assert len(mock_setup_entry.mock_calls) == 0
|
||||||
|
|
||||||
|
|
||||||
@ -83,8 +77,6 @@ async def test_flow_exceptions_caught(hass: HomeAssistant) -> None:
|
|||||||
"homeassistant.components.zerproc.config_flow.pyzerproc.discover",
|
"homeassistant.components.zerproc.config_flow.pyzerproc.discover",
|
||||||
side_effect=pyzerproc.ZerprocException("TEST"),
|
side_effect=pyzerproc.ZerprocException("TEST"),
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.components.zerproc.async_setup", return_value=True
|
|
||||||
) as mock_setup, patch(
|
|
||||||
"homeassistant.components.zerproc.async_setup_entry",
|
"homeassistant.components.zerproc.async_setup_entry",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
) as mock_setup_entry:
|
) as mock_setup_entry:
|
||||||
@ -96,5 +88,4 @@ async def test_flow_exceptions_caught(hass: HomeAssistant) -> None:
|
|||||||
assert result2["type"] == "abort"
|
assert result2["type"] == "abort"
|
||||||
assert result2["reason"] == "no_devices_found"
|
assert result2["reason"] == "no_devices_found"
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert len(mock_setup.mock_calls) == 0
|
|
||||||
assert len(mock_setup_entry.mock_calls) == 0
|
assert len(mock_setup_entry.mock_calls) == 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user