Remove async_setup from zerproc (#93903)

This commit is contained in:
Erik Montnemery 2023-06-01 11:33:37 +02:00 committed by GitHub
parent e0db9ab041
commit ba76bbee44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 20 deletions

View file

@ -1,23 +1,13 @@
"""Zerproc lights integration."""
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers.typing import ConfigType
from .const import DATA_ADDRESSES, DATA_DISCOVERY_SUBSCRIPTION, DOMAIN
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:
"""Set up Zerproc from a config entry."""
if DOMAIN not in hass.data:

View file

@ -21,8 +21,6 @@ async def test_flow_success(hass: HomeAssistant) -> None:
"homeassistant.components.zerproc.config_flow.pyzerproc.discover",
return_value=["Light1", "Light2"],
), patch(
"homeassistant.components.zerproc.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.zerproc.async_setup_entry",
return_value=True,
) as mock_setup_entry:
@ -36,7 +34,6 @@ async def test_flow_success(hass: HomeAssistant) -> None:
assert result2["title"] == "Zerproc"
assert result2["data"] == {}
assert len(mock_setup.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",
return_value=[],
), patch(
"homeassistant.components.zerproc.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.zerproc.async_setup_entry",
return_value=True,
) as mock_setup_entry:
@ -66,7 +61,6 @@ async def test_flow_no_devices_found(hass: HomeAssistant) -> None:
assert result2["type"] == "abort"
assert result2["reason"] == "no_devices_found"
await hass.async_block_till_done()
assert len(mock_setup.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",
side_effect=pyzerproc.ZerprocException("TEST"),
), patch(
"homeassistant.components.zerproc.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.zerproc.async_setup_entry",
return_value=True,
) as mock_setup_entry:
@ -96,5 +88,4 @@ async def test_flow_exceptions_caught(hass: HomeAssistant) -> None:
assert result2["type"] == "abort"
assert result2["reason"] == "no_devices_found"
await hass.async_block_till_done()
assert len(mock_setup.mock_calls) == 0
assert len(mock_setup_entry.mock_calls) == 0