Clean up superfluous integration setup - part 6 (#49298)

pull/49308/head^2
Franck Nijhof 2021-04-16 18:23:27 +02:00 committed by GitHub
parent af80ca6795
commit 7264c95217
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 22 additions and 199 deletions

View File

@ -22,16 +22,11 @@ from .const import CONF_TOKEN_EXPIRES_IN, CONF_TOKEN_EXPIRY, DOMAIN
CONF_ID_TOKEN = "id_token"
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Flick Electric component."""
hass.data[DOMAIN] = {}
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Flick Electric from a config entry."""
auth = HassFlickAuth(hass, entry)
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = FlickAPI(auth)
hass.async_create_task(

View File

@ -19,15 +19,10 @@ _LOGGER = logging.getLogger(__name__)
PLATFORMS = ["binary_sensor", "sensor", "switch"]
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the flo component."""
hass.data[DOMAIN] = {}
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up flo from a config entry."""
session = async_get_clientsession(hass)
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = {}
try:
hass.data[DOMAIN][entry.entry_id][CLIENT] = client = await async_get_api(

View File

@ -16,13 +16,6 @@ from .data import HarmonyData
_LOGGER = logging.getLogger(__name__)
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Logitech Harmony Hub component."""
hass.data.setdefault(DOMAIN, {})
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Logitech Harmony Hub from a config entry."""
# As there currently is no way to import options from yaml
@ -42,6 +35,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
if not connected_ok:
raise ConfigEntryNotReady
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = data
await _migrate_old_unique_ids(hass, entry.entry_id, data)

View File

@ -63,12 +63,6 @@ PLATFORMS = ["cover", "scene", "sensor"]
_LOGGER = logging.getLogger(__name__)
async def async_setup(hass: HomeAssistant, hass_config: dict):
"""Set up the Hunter Douglas PowerView component."""
hass.data.setdefault(DOMAIN, {})
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Hunter Douglas PowerView from a config entry."""
@ -122,6 +116,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
update_interval=timedelta(seconds=60),
)
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = {
PV_API: pv_request,
PV_ROOM_DATA: room_data,

View File

@ -40,15 +40,9 @@ SCAN_INTERVAL = timedelta(seconds=60)
_LOGGER = logging.getLogger(__name__)
async def async_setup(hass: HomeAssistant, config: dict) -> bool:
"""Set up the IPP component."""
hass.data.setdefault(DOMAIN, {})
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up IPP from a config entry."""
hass.data.setdefault(DOMAIN, {})
coordinator = hass.data[DOMAIN].get(entry.entry_id)
if not coordinator:
# Create IPP instance for this entry

View File

@ -13,15 +13,9 @@ from .hub import LitterRobotHub
PLATFORMS = ["sensor", "switch", "vacuum"]
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Litter-Robot component."""
hass.data.setdefault(DOMAIN, {})
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Litter-Robot from a config entry."""
hass.data.setdefault(DOMAIN, {})
hub = hass.data[DOMAIN][entry.entry_id] = LitterRobotHub(hass, entry.data)
try:
await hub.login(load_robots=True)

View File

@ -38,12 +38,6 @@ async def with_timeout(task, timeout_seconds=10):
return await task
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Mazda Connected Services component."""
hass.data[DOMAIN] = {}
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Mazda Connected Services from a config entry."""
email = entry.data[CONF_EMAIL]
@ -111,6 +105,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
update_interval=timedelta(seconds=60),
)
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = {
DATA_CLIENT: mazda_client,
DATA_COORDINATOR: coordinator,

View File

@ -23,11 +23,6 @@ _LOGGER = logging.getLogger(__name__)
PLATFORMS = ["sensor", "weather"]
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Met Office weather component."""
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up a Met Office entry."""

View File

@ -27,11 +27,6 @@ PLATFORMS = ["binary_sensor", "sensor"]
_LOGGER = logging.getLogger(__name__)
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
"""Set up the Minecraft Server component."""
return True
async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry) -> bool:
"""Set up Minecraft Server from a config entry."""
domain_data = hass.data.setdefault(DOMAIN, {})

View File

@ -23,11 +23,6 @@ PLATFORMS = ["media_player"]
_LOGGER = logging.getLogger(__name__)
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Monoprice 6-Zone Amplifier component."""
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Monoprice 6-Zone Amplifier from a config entry."""
port = entry.data[CONF_PORT]

View File

@ -24,14 +24,6 @@ CONFIG_SCHEMA = cv.deprecated(DOMAIN)
DEFAULT_UPDATE_RATE = 120
async def async_setup(hass: HomeAssistant, config: dict) -> bool:
"""Set up the nexia component from YAML."""
hass.data.setdefault(DOMAIN, {})
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Configure the base Nexia device for Home Assistant."""
@ -75,6 +67,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
update_interval=timedelta(seconds=DEFAULT_UPDATE_RATE),
)
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = {
NEXIA_DEVICE: nexia_home,
UPDATE_COORDINATOR: coordinator,

View File

@ -25,12 +25,6 @@ _LOGGER = logging.getLogger(__name__)
CONFIG_SCHEMA = cv.deprecated(DOMAIN)
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the NuHeat component."""
hass.data.setdefault(DOMAIN, {})
return True
def _get_thermostat(api, serial_number):
"""Authenticate and create the thermostat object."""
api.authenticate()
@ -78,6 +72,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
update_interval=timedelta(minutes=5),
)
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = (thermostat, coordinator)
for platform in PLATFORMS:

View File

@ -3,11 +3,6 @@ from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Raspberry Pi Power Supply Checker component."""
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Raspberry Pi Power Supply Checker from a config entry."""
hass.async_create_task(

View File

@ -27,12 +27,6 @@ from .const import (
from .coordinator import RuckusUnleashedDataUpdateCoordinator
async def async_setup(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up the Ruckus Unleashed component."""
hass.data[DOMAIN] = {}
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Ruckus Unleashed from a config entry."""
try:
@ -64,6 +58,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
sw_version=system_info[API_SYSTEM_OVERVIEW][API_VERSION],
)
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = {
COORDINATOR: coordinator,
UNDO_UPDATE_LISTENERS: [],

View File

@ -32,12 +32,6 @@ _LOGGER = logging.getLogger(__name__)
PLATFORMS = ["sensor"]
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Smart Meter Texas component."""
hass.data.setdefault(DOMAIN, {})
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Smart Meter Texas from a config entry."""
@ -76,6 +70,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
),
)
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = {
DATA_COORDINATOR: coordinator,
DATA_SMART_METER: smart_meter_texas_data,

View File

@ -10,18 +10,11 @@ _LOGGER = logging.getLogger(__name__)
PLATFORMS = ["binary_sensor", "climate", "light", "sensor", "switch"]
async def async_setup(hass, config):
"""Set up smarttub component."""
hass.data.setdefault(DOMAIN, {})
return True
async def async_setup_entry(hass, entry):
"""Set up a smarttub config entry."""
controller = SmartTubController(hass)
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = {
SMARTTUB_CONTROLLER: controller,
}

View File

@ -41,12 +41,6 @@ SCAN_INTERVAL = timedelta(seconds=30)
_LOGGER = logging.getLogger(__name__)
async def async_setup(hass: HomeAssistantType, config: dict) -> bool:
"""Set up the Sonarr component."""
hass.data.setdefault(DOMAIN, {})
return True
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
"""Set up Sonarr from a config entry."""
if not entry.options:
@ -81,6 +75,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool
undo_listener = entry.add_update_listener(_async_update_listener)
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = {
DATA_SONARR: sonarr,
DATA_UNDO_UPDATE_LISTENER: undo_listener,

View File

@ -39,14 +39,6 @@ SCAN_INTERVAL = timedelta(minutes=5)
CONFIG_SCHEMA = cv.deprecated(DOMAIN)
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Tado component."""
hass.data.setdefault(DOMAIN, {})
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Tado from a config entry."""
@ -86,6 +78,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
update_listener = entry.add_update_listener(_async_update_listener)
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = {
DATA: tadoconnector,
UPDATE_TRACK: update_track,

View File

@ -10,7 +10,6 @@ from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_HOST
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
from homeassistant.util import Throttle
from .const import ATTR_BOOT_TIME, ATTR_LOAD, DOMAIN, ROUTER_DEFAULT_HOST
@ -22,12 +21,6 @@ DEFAULT_SCAN_INTERVAL = timedelta(seconds=30)
_LOGGER = logging.getLogger(__name__)
async def async_setup(hass: HomeAssistantType, config: ConfigType):
"""Set up the Vilfo Router component."""
hass.data.setdefault(DOMAIN, {})
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Vilfo Router from a config entry."""
host = entry.data[CONF_HOST]
@ -40,6 +33,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
if not vilfo_router.available:
raise ConfigEntryNotReady
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = vilfo_router
for platform in PLATFORMS:

View File

@ -35,11 +35,6 @@ VACUUM_PLATFORMS = ["vacuum"]
AIR_MONITOR_PLATFORMS = ["air_quality", "sensor"]
async def async_setup(hass: core.HomeAssistant, config: dict):
"""Set up the Xiaomi Miio component."""
return True
async def async_setup_entry(
hass: core.HomeAssistant, entry: config_entries.ConfigEntry
):

View File

@ -34,8 +34,6 @@ async def test_form(hass):
"homeassistant.components.flick_electric.config_flow.SimpleFlickAuth.async_get_access_token",
return_value="123456789abcdef",
), patch(
"homeassistant.components.flick_electric.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.flick_electric.async_setup_entry",
return_value=True,
) as mock_setup_entry:
@ -48,7 +46,6 @@ async def test_form(hass):
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result2["title"] == "Flick Electric: test-username"
assert result2["data"] == CONF
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1

View File

@ -20,8 +20,6 @@ async def test_form(hass, aioclient_mock_fixture):
assert result["errors"] == {}
with patch(
"homeassistant.components.flo.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.flo.async_setup_entry", return_value=True
) as mock_setup_entry:
result2 = await hass.config_entries.flow.async_configure(
@ -32,7 +30,6 @@ async def test_form(hass, aioclient_mock_fixture):
assert result2["title"] == "Home"
assert result2["data"] == {"username": TEST_USER_ID, "password": TEST_PASSWORD}
await hass.async_block_till_done()
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1

View File

@ -31,8 +31,6 @@ async def test_user_form(hass):
"homeassistant.components.harmony.util.HarmonyAPI",
return_value=harmonyapi,
), patch(
"homeassistant.components.harmony.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.harmony.async_setup_entry",
return_value=True,
) as mock_setup_entry:
@ -45,7 +43,6 @@ async def test_user_form(hass):
assert result2["type"] == "create_entry"
assert result2["title"] == "friend"
assert result2["data"] == {"host": "1.2.3.4", "name": "friend"}
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1
@ -83,8 +80,6 @@ async def test_form_ssdp(hass):
"homeassistant.components.harmony.util.HarmonyAPI",
return_value=harmonyapi,
), patch(
"homeassistant.components.harmony.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.harmony.async_setup_entry",
return_value=True,
) as mock_setup_entry:
@ -97,7 +92,6 @@ async def test_form_ssdp(hass):
assert result2["type"] == "create_entry"
assert result2["title"] == "Harmony Hub"
assert result2["data"] == {"host": "192.168.1.12", "name": "Harmony Hub"}
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1

View File

@ -36,9 +36,6 @@ async def test_user_form(hass):
"homeassistant.components.hunterdouglas_powerview.UserData",
return_value=mock_powerview_userdata,
), patch(
"homeassistant.components.hunterdouglas_powerview.async_setup",
return_value=True,
) as mock_setup, patch(
"homeassistant.components.hunterdouglas_powerview.async_setup_entry",
return_value=True,
) as mock_setup_entry:
@ -53,7 +50,6 @@ async def test_user_form(hass):
assert result2["data"] == {
"host": "1.2.3.4",
}
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1
result3 = await hass.config_entries.flow.async_init(
@ -103,9 +99,6 @@ async def test_form_homekit(hass):
"homeassistant.components.hunterdouglas_powerview.UserData",
return_value=mock_powerview_userdata,
), patch(
"homeassistant.components.hunterdouglas_powerview.async_setup",
return_value=True,
) as mock_setup, patch(
"homeassistant.components.hunterdouglas_powerview.async_setup_entry",
return_value=True,
) as mock_setup_entry:
@ -117,7 +110,6 @@ async def test_form_homekit(hass):
assert result2["data"] == {"host": "1.2.3.4"}
assert result2["result"].unique_id == "ABC123"
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1
result3 = await hass.config_entries.flow.async_init(

View File

@ -344,9 +344,7 @@ async def test_full_user_flow_implementation(
assert result["step_id"] == "user"
assert result["type"] == RESULT_TYPE_FORM
with patch(
"homeassistant.components.ipp.async_setup_entry", return_value=True
), patch("homeassistant.components.ipp.async_setup", return_value=True):
with patch("homeassistant.components.ipp.async_setup_entry", return_value=True):
result = await hass.config_entries.flow.async_configure(
result["flow_id"],
user_input={CONF_HOST: "192.168.1.31", CONF_BASE_PATH: "/ipp/print"},
@ -379,9 +377,7 @@ async def test_full_zeroconf_flow_implementation(
assert result["step_id"] == "zeroconf_confirm"
assert result["type"] == RESULT_TYPE_FORM
with patch(
"homeassistant.components.ipp.async_setup_entry", return_value=True
), patch("homeassistant.components.ipp.async_setup", return_value=True):
with patch("homeassistant.components.ipp.async_setup_entry", return_value=True):
result = await hass.config_entries.flow.async_configure(
result["flow_id"], user_input={}
)
@ -416,9 +412,7 @@ async def test_full_zeroconf_tls_flow_implementation(
assert result["type"] == RESULT_TYPE_FORM
assert result["description_placeholders"] == {CONF_NAME: "EPSON XP-6000 Series"}
with patch(
"homeassistant.components.ipp.async_setup_entry", return_value=True
), patch("homeassistant.components.ipp.async_setup", return_value=True):
with patch("homeassistant.components.ipp.async_setup_entry", return_value=True):
result = await hass.config_entries.flow.async_configure(
result["flow_id"], user_input={}
)

View File

@ -24,8 +24,6 @@ async def test_form(hass, mock_account):
"homeassistant.components.litterrobot.hub.Account",
return_value=mock_account,
), patch(
"homeassistant.components.litterrobot.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.litterrobot.async_setup_entry",
return_value=True,
) as mock_setup_entry:
@ -37,7 +35,6 @@ async def test_form(hass, mock_account):
assert result2["type"] == "create_entry"
assert result2["title"] == CONFIG[DOMAIN][CONF_USERNAME]
assert result2["data"] == CONFIG[DOMAIN]
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1

View File

@ -39,8 +39,6 @@ async def test_form(hass):
"homeassistant.components.mazda.config_flow.MazdaAPI.validate_credentials",
return_value=True,
), patch(
"homeassistant.components.mazda.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.mazda.async_setup_entry",
return_value=True,
) as mock_setup_entry:
@ -53,7 +51,6 @@ async def test_form(hass):
assert result2["type"] == "create_entry"
assert result2["title"] == FIXTURE_USER_INPUT[CONF_EMAIL]
assert result2["data"] == FIXTURE_USER_INPUT
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1

View File

@ -34,8 +34,6 @@ async def test_form(hass, requests_mock):
assert result["errors"] == {}
with patch(
"homeassistant.components.metoffice.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.metoffice.async_setup_entry",
return_value=True,
) as mock_setup_entry:
@ -52,7 +50,6 @@ async def test_form(hass, requests_mock):
"longitude": TEST_LONGITUDE_WAVERTREE,
"name": TEST_SITE_NAME_WAVERTREE,
}
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1

View File

@ -36,8 +36,6 @@ async def test_form(hass):
"homeassistant.components.monoprice.config_flow.get_async_monoprice",
return_value=True,
), patch(
"homeassistant.components.monoprice.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.monoprice.async_setup_entry",
return_value=True,
) as mock_setup_entry:
@ -52,7 +50,6 @@ async def test_form(hass):
CONF_PORT: CONFIG[CONF_PORT],
CONF_SOURCES: {"1": CONFIG[CONF_SOURCE_1], "4": CONFIG[CONF_SOURCE_4]},
}
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1

View File

@ -24,8 +24,6 @@ async def test_form(hass):
"homeassistant.components.nexia.config_flow.NexiaHome.login",
side_effect=MagicMock(),
), patch(
"homeassistant.components.nexia.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.nexia.async_setup_entry",
return_value=True,
) as mock_setup_entry:
@ -41,7 +39,6 @@ async def test_form(hass):
CONF_USERNAME: "username",
CONF_PASSWORD: "password",
}
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1

View File

@ -28,8 +28,6 @@ async def test_form_user(hass):
"homeassistant.components.nuheat.config_flow.nuheat.NuHeat.get_thermostat",
return_value=mock_thermostat,
), patch(
"homeassistant.components.nuheat.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.nuheat.async_setup_entry", return_value=True
) as mock_setup_entry:
result2 = await hass.config_entries.flow.async_configure(
@ -49,7 +47,6 @@ async def test_form_user(hass):
CONF_USERNAME: "test-username",
CONF_PASSWORD: "test-password",
}
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1

View File

@ -30,8 +30,6 @@ async def test_form(hass):
"homeassistant.components.ruckus_unleashed.Ruckus.system_info",
return_value=DEFAULT_SYSTEM_INFO,
), patch(
"homeassistant.components.ruckus_unleashed.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.ruckus_unleashed.async_setup_entry",
return_value=True,
) as mock_setup_entry:
@ -44,7 +42,6 @@ async def test_form(hass):
assert result2["type"] == "create_entry"
assert result2["title"] == DEFAULT_TITLE
assert result2["data"] == CONFIG
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1

View File

@ -28,8 +28,6 @@ async def test_form(hass):
assert result["errors"] == {}
with patch("smart_meter_texas.Client.authenticate", return_value=True), patch(
"homeassistant.components.smart_meter_texas.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.smart_meter_texas.async_setup_entry",
return_value=True,
) as mock_setup_entry:
@ -41,7 +39,6 @@ async def test_form(hass):
assert result2["type"] == "create_entry"
assert result2["title"] == TEST_LOGIN[CONF_USERNAME]
assert result2["data"] == TEST_LOGIN
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1

View File

@ -16,8 +16,6 @@ async def test_form(hass):
assert result["errors"] == {}
with patch(
"homeassistant.components.smarttub.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.smarttub.async_setup_entry",
return_value=True,
) as mock_setup_entry:
@ -33,7 +31,6 @@ async def test_form(hass):
"password": "test-password",
}
await hass.async_block_till_done()
mock_setup.assert_called_once()
mock_setup_entry.assert_called_once()
result = await hass.config_entries.flow.async_init(

View File

@ -227,13 +227,6 @@ async def setup_integration(
return entry
def _patch_async_setup(return_value=True):
"""Patch the async setup of sonarr."""
return patch(
"homeassistant.components.sonarr.async_setup", return_value=return_value
)
def _patch_async_setup_entry(return_value=True):
"""Patch the async entry setup of sonarr."""
return patch(

View File

@ -21,7 +21,6 @@ from tests.components.sonarr import (
HOST,
MOCK_REAUTH_INPUT,
MOCK_USER_INPUT,
_patch_async_setup,
_patch_async_setup_entry,
mock_connection,
mock_connection_error,
@ -123,7 +122,7 @@ async def test_full_reauth_flow_implementation(
assert result["step_id"] == "user"
user_input = MOCK_REAUTH_INPUT.copy()
with _patch_async_setup(), _patch_async_setup_entry() as mock_setup_entry:
with _patch_async_setup_entry() as mock_setup_entry:
result = await hass.config_entries.flow.async_configure(
result["flow_id"], user_input=user_input
)
@ -153,7 +152,7 @@ async def test_full_user_flow_implementation(
user_input = MOCK_USER_INPUT.copy()
with _patch_async_setup(), _patch_async_setup_entry():
with _patch_async_setup_entry():
result = await hass.config_entries.flow.async_configure(
result["flow_id"],
user_input=user_input,
@ -184,7 +183,7 @@ async def test_full_user_flow_advanced_options(
CONF_VERIFY_SSL: True,
}
with _patch_async_setup(), _patch_async_setup_entry():
with _patch_async_setup_entry():
result = await hass.config_entries.flow.async_configure(
result["flow_id"],
user_input=user_input,
@ -211,7 +210,7 @@ async def test_options_flow(hass, aioclient_mock: AiohttpClientMocker):
assert result["type"] == RESULT_TYPE_FORM
assert result["step_id"] == "init"
with _patch_async_setup(), _patch_async_setup_entry():
with _patch_async_setup_entry():
result = await hass.config_entries.options.async_configure(
result["flow_id"],
user_input={CONF_UPCOMING_DAYS: 2, CONF_WANTED_MAX_ITEMS: 100},

View File

@ -34,8 +34,6 @@ async def test_form(hass):
"homeassistant.components.tado.config_flow.Tado",
return_value=mock_tado_api,
), patch(
"homeassistant.components.tado.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.tado.async_setup_entry",
return_value=True,
) as mock_setup_entry:
@ -51,7 +49,6 @@ async def test_form(hass):
"username": "test-username",
"password": "test-password",
}
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1

View File

@ -21,8 +21,6 @@ async def test_form(hass):
with patch("vilfo.Client.ping", return_value=None), patch(
"vilfo.Client.get_board_information", return_value=None
), patch("vilfo.Client.resolve_mac_address", return_value=mock_mac), patch(
"homeassistant.components.vilfo.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.vilfo.async_setup_entry"
) as mock_setup_entry:
result2 = await hass.config_entries.flow.async_configure(
@ -38,7 +36,6 @@ async def test_form(hass):
"access_token": "test-token",
}
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1