Clean up superfluous integration setup - part 2 (#48478)
This commit is contained in:
parent
8393a215e9
commit
6ec3234ccc
17 changed files with 5 additions and 95 deletions
|
@ -9,11 +9,6 @@ from homeassistant.core import HomeAssistant
|
|||
from .const import DATA_LISTENER, DATA_TASK, DOMAIN, PLATFORMS
|
||||
|
||||
|
||||
async def async_setup(hass, config: dict):
|
||||
"""Set up the DSMR platform."""
|
||||
return True
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||
"""Set up DSMR from a config entry."""
|
||||
hass.data.setdefault(DOMAIN, {})
|
||||
|
|
|
@ -29,12 +29,6 @@ _LOGGER = logging.getLogger(__name__)
|
|||
PLATFORMS = [SENSOR_DOMAIN, BINARYSENSOR_DOMAIN, SWITCH_DOMAIN]
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: dict) -> bool:
|
||||
"""Set up the FireServiceRota component."""
|
||||
|
||||
return True
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Set up FireServiceRota from a config entry."""
|
||||
|
||||
|
|
|
@ -4,11 +4,6 @@ from homeassistant.components.media_player import DOMAIN as MP_DOMAIN
|
|||
from .const import DOMAIN, HASS_DATA_REMOVE_LISTENERS_KEY, HASS_DATA_UPDATER_KEY
|
||||
|
||||
|
||||
async def async_setup(hass, config):
|
||||
"""Set up the forked-daapd component."""
|
||||
return True
|
||||
|
||||
|
||||
async def async_setup_entry(hass, entry):
|
||||
"""Set up forked-daapd from a config entry by forwarding to platform."""
|
||||
hass.async_create_task(
|
||||
|
|
|
@ -21,11 +21,6 @@ from .const import (
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_setup(hass, config):
|
||||
"""Set up the fritzbox_callmonitor integration."""
|
||||
return True
|
||||
|
||||
|
||||
async def async_setup_entry(hass, config_entry):
|
||||
"""Set up the fritzbox_callmonitor platforms."""
|
||||
fritzbox_phonebook = FritzBoxPhonebook(
|
||||
|
|
|
@ -5,7 +5,6 @@ from aiohttp.client_exceptions import ClientConnectorError
|
|||
from async_timeout import timeout
|
||||
from gios import ApiError, Gios, InvalidSensorsData, NoStationError
|
||||
|
||||
from homeassistant.core import Config, HomeAssistant
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
|
||||
|
@ -14,11 +13,6 @@ from .const import CONF_STATION_ID, DOMAIN, SCAN_INTERVAL
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: Config) -> bool:
|
||||
"""Set up configured GIOS."""
|
||||
return True
|
||||
|
||||
|
||||
async def async_setup_entry(hass, config_entry):
|
||||
"""Set up GIOS as config entry."""
|
||||
station_id = config_entry.data[CONF_STATION_ID]
|
||||
|
|
|
@ -13,11 +13,6 @@ from .const import DEVICE_TYPE_GOGOGATE2
|
|||
PLATFORMS = [COVER, SENSOR]
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistant, base_config: dict) -> bool:
|
||||
"""Set up for Gogogate2 controllers."""
|
||||
return True
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
|
||||
"""Do setup of Gogogate2."""
|
||||
|
||||
|
|
|
@ -11,11 +11,6 @@ from .const import DISCOVERY_TASK, DOMAIN, PLAYER_DISCOVERY_UNSUB
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: dict):
|
||||
"""Set up the Logitech Squeezebox component."""
|
||||
return True
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||
"""Set up Logitech Squeezebox from a config entry."""
|
||||
hass.async_create_task(
|
||||
|
|
|
@ -3,7 +3,7 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_SCAN_INTERVAL
|
||||
from homeassistant.core import Config, HomeAssistant
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
|
||||
from .account import StarlineAccount
|
||||
|
@ -19,11 +19,6 @@ from .const import (
|
|||
)
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: Config) -> bool:
|
||||
"""Set up configured StarLine."""
|
||||
return True
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
|
||||
"""Set up the StarLine device from a config entry."""
|
||||
account = StarlineAccount(hass, config_entry)
|
||||
|
|
|
@ -4,9 +4,8 @@ import asyncio
|
|||
import upb_lib
|
||||
|
||||
from homeassistant.const import ATTR_COMMAND, CONF_FILE_PATH, CONF_HOST
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .const import (
|
||||
ATTR_ADDRESS,
|
||||
|
@ -19,11 +18,6 @@ from .const import (
|
|||
PLATFORMS = ["light", "scene"]
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistant, hass_config: ConfigType) -> bool:
|
||||
"""Set up the UPB platform."""
|
||||
return True
|
||||
|
||||
|
||||
async def async_setup_entry(hass, config_entry):
|
||||
"""Set up a new config_entry for UPB PIM."""
|
||||
|
||||
|
|
|
@ -14,11 +14,6 @@ from .const import DATA_INFO, DATA_VOLUMIO, DOMAIN
|
|||
PLATFORMS = ["media_player"]
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: dict):
|
||||
"""Set up the Volumio component."""
|
||||
return True
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||
"""Set up Volumio from a config entry."""
|
||||
|
||||
|
|
|
@ -33,11 +33,6 @@ _LOGGER = logging.getLogger(__name__)
|
|||
PLATFORMS = ["sensor", "binary_sensor"]
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: dict):
|
||||
"""Set up the wiffi component. config contains data from configuration.yaml."""
|
||||
return True
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry):
|
||||
"""Set up wiffi from a config entry, config_entry contains data from config entry database."""
|
||||
if not config_entry.update_listeners:
|
||||
|
|
|
@ -39,7 +39,7 @@ async def test_setup_platform(hass, dsmr_connection_fixture):
|
|||
|
||||
serial_data = {"serial_id": "1234", "serial_id_gas": "5678"}
|
||||
|
||||
with patch("homeassistant.components.dsmr.async_setup", return_value=True), patch(
|
||||
with patch(
|
||||
"homeassistant.components.dsmr.async_setup_entry", return_value=True
|
||||
), patch(
|
||||
"homeassistant.components.dsmr.config_flow._validate_dsmr_connection",
|
||||
|
|
|
@ -78,8 +78,6 @@ async def test_step_user(hass):
|
|||
with patch(
|
||||
"homeassistant.components.fireservicerota.config_flow.FireServiceRota"
|
||||
) as mock_fsr, patch(
|
||||
"homeassistant.components.fireservicerota.async_setup", return_value=True
|
||||
) as mock_setup, patch(
|
||||
"homeassistant.components.fireservicerota.async_setup_entry",
|
||||
return_value=True,
|
||||
) as mock_setup_entry:
|
||||
|
@ -108,5 +106,4 @@ async def test_step_user(hass):
|
|||
},
|
||||
}
|
||||
|
||||
assert len(mock_setup.mock_calls) == 1
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
|
|
@ -26,11 +26,10 @@ from tests.common import MockConfigEntry
|
|||
MOCK_MAC_ADDR = "AA:BB:CC:DD:EE:FF"
|
||||
|
||||
|
||||
@patch("homeassistant.components.gogogate2.async_setup", return_value=True)
|
||||
@patch("homeassistant.components.gogogate2.async_setup_entry", return_value=True)
|
||||
@patch("homeassistant.components.gogogate2.common.GogoGate2Api")
|
||||
async def test_auth_fail(
|
||||
gogogate2api_mock, async_setup_entry_mock, async_setup_mock, hass: HomeAssistant
|
||||
gogogate2api_mock, async_setup_entry_mock, hass: HomeAssistant
|
||||
) -> None:
|
||||
"""Test authorization failures."""
|
||||
api: GogoGate2Api = MagicMock(spec=GogoGate2Api)
|
||||
|
|
|
@ -45,8 +45,6 @@ async def patch_async_query_unauthorized(self, *args):
|
|||
async def test_user_form(hass):
|
||||
"""Test user-initiated flow, including discovery and the edit step."""
|
||||
with patch("pysqueezebox.Server.async_query", return_value={"uuid": UUID},), patch(
|
||||
"homeassistant.components.squeezebox.async_setup", return_value=True
|
||||
) as mock_setup, patch(
|
||||
"homeassistant.components.squeezebox.async_setup_entry",
|
||||
return_value=True,
|
||||
) as mock_setup_entry, patch(
|
||||
|
@ -77,7 +75,6 @@ async def test_user_form(hass):
|
|||
}
|
||||
|
||||
await hass.async_block_till_done()
|
||||
assert len(mock_setup.mock_calls) == 1
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
||||
|
||||
|
@ -111,8 +108,6 @@ async def test_user_form_duplicate(hass):
|
|||
"homeassistant.components.squeezebox.config_flow.async_discover",
|
||||
mock_discover,
|
||||
), patch("homeassistant.components.squeezebox.config_flow.TIMEOUT", 0.1), patch(
|
||||
"homeassistant.components.squeezebox.async_setup", return_value=True
|
||||
), patch(
|
||||
"homeassistant.components.squeezebox.async_setup_entry",
|
||||
return_value=True,
|
||||
):
|
||||
|
@ -204,8 +199,6 @@ async def test_discovery_no_uuid(hass):
|
|||
async def test_import(hass):
|
||||
"""Test handling of configuration imported."""
|
||||
with patch("pysqueezebox.Server.async_query", return_value={"uuid": UUID},), patch(
|
||||
"homeassistant.components.squeezebox.async_setup", return_value=True
|
||||
) as mock_setup, patch(
|
||||
"homeassistant.components.squeezebox.async_setup_entry",
|
||||
return_value=True,
|
||||
) as mock_setup_entry:
|
||||
|
@ -217,7 +210,6 @@ async def test_import(hass):
|
|||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
|
||||
await hass.async_block_till_done()
|
||||
assert len(mock_setup.mock_calls) == 1
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
||||
|
||||
|
@ -253,8 +245,6 @@ async def test_import_bad_auth(hass):
|
|||
async def test_import_existing(hass):
|
||||
"""Test handling of configuration import of existing server."""
|
||||
with patch(
|
||||
"homeassistant.components.squeezebox.async_setup", return_value=True
|
||||
), patch(
|
||||
"homeassistant.components.squeezebox.async_setup_entry",
|
||||
return_value=True,
|
||||
), patch(
|
||||
|
|
|
@ -43,8 +43,6 @@ async def test_full_upb_flow_with_serial_port(hass):
|
|||
await setup.async_setup_component(hass, "persistent_notification", {})
|
||||
|
||||
with mocked_upb(), patch(
|
||||
"homeassistant.components.upb.async_setup", return_value=True
|
||||
) as mock_setup, patch(
|
||||
"homeassistant.components.upb.async_setup_entry", return_value=True
|
||||
) as mock_setup_entry:
|
||||
flow = await hass.config_entries.flow.async_init(
|
||||
|
@ -69,7 +67,6 @@ async def test_full_upb_flow_with_serial_port(hass):
|
|||
"host": "serial:///dev/ttyS0:115200",
|
||||
"file_path": "upb.upe",
|
||||
}
|
||||
assert len(mock_setup.mock_calls) == 1
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
||||
|
||||
|
@ -116,8 +113,6 @@ async def test_form_import(hass):
|
|||
await setup.async_setup_component(hass, "persistent_notification", {})
|
||||
|
||||
with mocked_upb(), patch(
|
||||
"homeassistant.components.upb.async_setup", return_value=True
|
||||
) as mock_setup, patch(
|
||||
"homeassistant.components.upb.async_setup_entry", return_value=True
|
||||
) as mock_setup_entry:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
|
@ -131,7 +126,6 @@ async def test_form_import(hass):
|
|||
assert result["title"] == "UPB"
|
||||
|
||||
assert result["data"] == {"host": "tcp://42.4.2.42", "file_path": "upb.upe"}
|
||||
assert len(mock_setup.mock_calls) == 1
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
||||
|
||||
|
|
|
@ -42,8 +42,6 @@ async def test_form(hass):
|
|||
"homeassistant.components.volumio.config_flow.Volumio.get_system_info",
|
||||
return_value=TEST_SYSTEM_INFO,
|
||||
), patch(
|
||||
"homeassistant.components.volumio.async_setup", return_value=True
|
||||
) as mock_setup, patch(
|
||||
"homeassistant.components.volumio.async_setup_entry",
|
||||
return_value=True,
|
||||
) as mock_setup_entry:
|
||||
|
@ -57,7 +55,6 @@ async def test_form(hass):
|
|||
assert result2["title"] == "TestVolumio"
|
||||
assert result2["data"] == {**TEST_SYSTEM_INFO, **TEST_CONNECTION}
|
||||
|
||||
assert len(mock_setup.mock_calls) == 1
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
||||
|
||||
|
@ -82,7 +79,7 @@ async def test_form_updates_unique_id(hass):
|
|||
with patch(
|
||||
"homeassistant.components.volumio.config_flow.Volumio.get_system_info",
|
||||
return_value=TEST_SYSTEM_INFO,
|
||||
), patch("homeassistant.components.volumio.async_setup", return_value=True), patch(
|
||||
), patch(
|
||||
"homeassistant.components.volumio.async_setup_entry",
|
||||
return_value=True,
|
||||
):
|
||||
|
@ -110,8 +107,6 @@ async def test_empty_system_info(hass):
|
|||
"homeassistant.components.volumio.config_flow.Volumio.get_system_info",
|
||||
return_value={},
|
||||
), patch(
|
||||
"homeassistant.components.volumio.async_setup", return_value=True
|
||||
) as mock_setup, patch(
|
||||
"homeassistant.components.volumio.async_setup_entry",
|
||||
return_value=True,
|
||||
) as mock_setup_entry:
|
||||
|
@ -130,7 +125,6 @@ async def test_empty_system_info(hass):
|
|||
"id": None,
|
||||
}
|
||||
|
||||
assert len(mock_setup.mock_calls) == 1
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
||||
|
||||
|
@ -183,8 +177,6 @@ async def test_discovery(hass):
|
|||
"homeassistant.components.volumio.config_flow.Volumio.get_system_info",
|
||||
return_value=TEST_SYSTEM_INFO,
|
||||
), patch(
|
||||
"homeassistant.components.volumio.async_setup", return_value=True
|
||||
) as mock_setup, patch(
|
||||
"homeassistant.components.volumio.async_setup_entry",
|
||||
return_value=True,
|
||||
) as mock_setup_entry:
|
||||
|
@ -201,7 +193,6 @@ async def test_discovery(hass):
|
|||
assert result2["result"]
|
||||
assert result2["result"].unique_id == TEST_DISCOVERY_RESULT["id"]
|
||||
|
||||
assert len(mock_setup.mock_calls) == 1
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
||||
|
||||
|
@ -257,8 +248,6 @@ async def test_discovery_updates_unique_id(hass):
|
|||
entry.add_to_hass(hass)
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.volumio.async_setup", return_value=True
|
||||
) as mock_setup, patch(
|
||||
"homeassistant.components.volumio.async_setup_entry",
|
||||
return_value=True,
|
||||
) as mock_setup_entry:
|
||||
|
@ -271,5 +260,4 @@ async def test_discovery_updates_unique_id(hass):
|
|||
assert result["reason"] == "already_configured"
|
||||
|
||||
assert entry.data == TEST_DISCOVERY_RESULT
|
||||
assert len(mock_setup.mock_calls) == 1
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue