Clean up superfluous integration setup - part 4 (#49295)

* Clean up superfluous integration setup - part 4

* Adjust tests
This commit is contained in:
Franck Nijhof 2021-04-16 17:46:49 +02:00 committed by GitHub
parent 73a9cb6adb
commit 969c147b77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 20 additions and 267 deletions

View file

@ -24,12 +24,6 @@ PLATFORMS = ["sensor"]
MIN_SCAN_INTERVAL = timedelta(minutes=10) MIN_SCAN_INTERVAL = timedelta(minutes=10)
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Garmin Connect component."""
hass.data[DOMAIN] = {}
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Garmin Connect from a config entry.""" """Set up Garmin Connect from a config entry."""
username = entry.data[CONF_USERNAME] username = entry.data[CONF_USERNAME]
@ -55,6 +49,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
return False return False
garmin_data = GarminConnectData(hass, garmin_client) garmin_data = GarminConnectData(hass, garmin_client)
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = garmin_data hass.data[DOMAIN][entry.entry_id] = garmin_data
for platform in PLATFORMS: for platform in PLATFORMS:

View file

@ -23,14 +23,6 @@ _LOGGER = logging.getLogger(__name__)
PLATFORMS = ["binary_sensor"] PLATFORMS = ["binary_sensor"]
async def async_setup(hass: HomeAssistant, config):
"""Set up the Goal Zero Yeti component."""
hass.data[DOMAIN] = {}
return True
async def async_setup_entry(hass, entry): async def async_setup_entry(hass, entry):
"""Set up Goal Zero Yeti from a config entry.""" """Set up Goal Zero Yeti from a config entry."""
name = entry.data[CONF_NAME] name = entry.data[CONF_NAME]
@ -58,6 +50,7 @@ async def async_setup_entry(hass, entry):
update_method=async_update_data, update_method=async_update_data,
update_interval=MIN_TIME_BETWEEN_UPDATES, update_interval=MIN_TIME_BETWEEN_UPDATES,
) )
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = { hass.data[DOMAIN][entry.entry_id] = {
DATA_KEY_API: api, DATA_KEY_API: api,
DATA_KEY_COORDINATOR: coordinator, DATA_KEY_COORDINATOR: coordinator,

View file

@ -24,13 +24,6 @@ PLATFORMS = ["switch"]
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the kmtronic component."""
hass.data[DOMAIN] = {}
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up kmtronic from a config entry.""" """Set up kmtronic from a config entry."""
session = aiohttp_client.async_get_clientsession(hass) session = aiohttp_client.async_get_clientsession(hass)
@ -60,6 +53,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
) )
await coordinator.async_config_entry_first_refresh() await coordinator.async_config_entry_first_refresh()
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = { hass.data[DOMAIN][entry.entry_id] = {
DATA_HUB: hub, DATA_HUB: hub,
DATA_COORDINATOR: coordinator, DATA_COORDINATOR: coordinator,

View file

@ -29,12 +29,6 @@ _LOGGER = logging.getLogger(__name__)
PLATFORMS = ["media_player"] PLATFORMS = ["media_player"]
async def async_setup(hass, config):
"""Set up the Kodi integration."""
hass.data.setdefault(DOMAIN, {})
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Kodi from a config entry.""" """Set up Kodi from a config entry."""
conn = get_kodi_connection( conn = get_kodi_connection(
@ -66,6 +60,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
remove_stop_listener = hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _close) remove_stop_listener = hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _close)
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = { hass.data[DOMAIN][entry.entry_id] = {
DATA_CONNECTION: conn, DATA_CONNECTION: conn,
DATA_KODI: kodi, DATA_KODI: kodi,

View file

@ -9,11 +9,6 @@ from .const import DATA_ADDRESSES, DATA_DISCOVERY_SUBSCRIPTION, DOMAIN
PLATFORMS = ["light"] PLATFORMS = ["light"]
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Kuler Sky component."""
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Kuler Sky from a config entry.""" """Set up Kuler Sky from a config entry."""
if DOMAIN not in hass.data: if DOMAIN not in hass.data:

View file

@ -13,7 +13,6 @@ from homeassistant.const import (
LENGTH_FEET, LENGTH_FEET,
LENGTH_METERS, LENGTH_METERS,
) )
from homeassistant.core import Config, HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from homeassistant.util.distance import convert as convert_distance from homeassistant.util.distance import convert as convert_distance
@ -32,12 +31,6 @@ URL = "https://aa015h6buqvih86i1.api.met.no/weatherapi/locationforecast/2.0/comp
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
async def async_setup(hass: HomeAssistant, config: Config) -> bool:
"""Set up configured Met."""
hass.data.setdefault(DOMAIN, {})
return True
async def async_setup_entry(hass, config_entry): async def async_setup_entry(hass, config_entry):
"""Set up Met as config entry.""" """Set up Met as config entry."""
# Don't setup if tracking home location and latitude or longitude isn't set. # Don't setup if tracking home location and latitude or longitude isn't set.
@ -60,6 +53,7 @@ async def async_setup_entry(hass, config_entry):
if config_entry.data.get(CONF_TRACK_HOME, False): if config_entry.data.get(CONF_TRACK_HOME, False):
coordinator.track_home() coordinator.track_home()
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][config_entry.entry_id] = coordinator hass.data[DOMAIN][config_entry.entry_id] = coordinator
hass.async_create_task( hass.async_create_task(

View file

@ -13,11 +13,6 @@ from .onewirehub import CannotConnect, OneWireHub
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
async def async_setup(hass, config):
"""Set up 1-Wire integrations."""
return True
async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry): async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry):
"""Set up a 1-Wire proxy for a config entry.""" """Set up a 1-Wire proxy for a config entry."""
hass.data.setdefault(DOMAIN, {}) hass.data.setdefault(DOMAIN, {})

View file

@ -25,11 +25,6 @@ from .const import DATA_CLIENT, DATA_COORDINATOR, DOMAIN
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
"""Set up the OVO Energy components."""
return True
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool: async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
"""Set up OVO Energy from a config entry.""" """Set up OVO Energy from a config entry."""

View file

@ -28,12 +28,6 @@ PLATFORMS = ["media_player", "remote"]
LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__)
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Philips TV component."""
hass.data[DOMAIN] = {}
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Philips TV from a config entry.""" """Set up Philips TV from a config entry."""
@ -47,6 +41,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
coordinator = PhilipsTVDataUpdateCoordinator(hass, tvapi) coordinator = PhilipsTVDataUpdateCoordinator(hass, tvapi)
await coordinator.async_refresh() await coordinator.async_refresh()
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = coordinator hass.data[DOMAIN][entry.entry_id] = coordinator
for platform in PLATFORMS: for platform in PLATFORMS:

View file

@ -84,15 +84,9 @@ WEBHOOK_SCHEMA = vol.Schema(
) )
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Plaato component."""
hass.data.setdefault(DOMAIN, {})
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Configure based on config entry.""" """Configure based on config entry."""
hass.data.setdefault(DOMAIN, {})
use_webhook = entry.data[CONF_USE_WEBHOOK] use_webhook = entry.data[CONF_USE_WEBHOOK]
if use_webhook: if use_webhook:

View file

@ -7,11 +7,6 @@ from homeassistant.core import HomeAssistant
from .gateway import async_setup_entry_gw, async_unload_entry_gw from .gateway import async_setup_entry_gw, async_unload_entry_gw
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Plugwise platform."""
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Plugwise components from a config entry.""" """Set up Plugwise components from a config entry."""
if entry.data.get(CONF_HOST): if entry.data.get(CONF_HOST):

View file

@ -25,13 +25,6 @@ PLATFORMS = ["sensor", "binary_sensor"]
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the PoolSense component."""
# Make sure coordinator is initialized.
hass.data.setdefault(DOMAIN, {})
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up PoolSense from a config entry.""" """Set up PoolSense from a config entry."""
@ -50,6 +43,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
await coordinator.async_config_entry_first_refresh() await coordinator.async_config_entry_first_refresh()
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = coordinator hass.data[DOMAIN][entry.entry_id] = coordinator
for platform in PLATFORMS: for platform in PLATFORMS:

View file

@ -43,13 +43,6 @@ PLATFORMS = ["binary_sensor", "sensor"]
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Tesla Powerwall component."""
hass.data.setdefault(DOMAIN, {})
return True
async def _migrate_old_unique_ids(hass, entry_id, powerwall_data): async def _migrate_old_unique_ids(hass, entry_id, powerwall_data):
serial_numbers = powerwall_data[POWERWALL_API_SERIAL_NUMBERS] serial_numbers = powerwall_data[POWERWALL_API_SERIAL_NUMBERS]
site_info = powerwall_data[POWERWALL_API_SITE_INFO] site_info = powerwall_data[POWERWALL_API_SITE_INFO]
@ -96,6 +89,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
entry_id = entry.entry_id entry_id = entry.entry_id
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN].setdefault(entry_id, {}) hass.data[DOMAIN].setdefault(entry_id, {})
http_session = requests.Session() http_session = requests.Session()

View file

@ -15,7 +15,6 @@ from homeassistant.core import HomeAssistant, ServiceCall
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.event import async_track_time_interval from homeassistant.helpers.event import async_track_time_interval
from homeassistant.helpers.service import async_register_admin_service from homeassistant.helpers.service import async_register_admin_service
from homeassistant.helpers.typing import ConfigType
from .const import DOMAIN from .const import DOMAIN
@ -44,11 +43,6 @@ LOG_INTERVAL_SUB = "log_interval_subscription"
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the profiler component."""
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Profiler from a config entry.""" """Set up Profiler from a config entry."""

View file

@ -13,16 +13,9 @@ from .const import DOMAIN
PLATFORMS = ["switch", "binary_sensor"] PLATFORMS = ["switch", "binary_sensor"]
async def async_setup(hass, config):
"""Set up the ProgettiHWSW Automation component."""
hass.data[DOMAIN] = {}
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up ProgettiHWSW Automation from a config entry.""" """Set up ProgettiHWSW Automation from a config entry."""
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = ProgettiHWSWAPI( hass.data[DOMAIN][entry.entry_id] = ProgettiHWSWAPI(
f'{entry.data["host"]}:{entry.data["port"]}' f'{entry.data["host"]}:{entry.data["port"]}'
) )

View file

@ -27,12 +27,6 @@ LAST_EVENT_TIMESTAMP_KEY = "last_event_timestamp"
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Risco component."""
hass.data.setdefault(DOMAIN, {})
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Risco from a config entry.""" """Set up Risco from a config entry."""
data = entry.data data = entry.data
@ -54,6 +48,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
undo_listener = entry.add_update_listener(_update_listener) undo_listener = entry.add_update_listener(_update_listener)
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = { hass.data[DOMAIN][entry.entry_id] = {
DATA_COORDINATOR: coordinator, DATA_COORDINATOR: coordinator,
UNDO_UPDATE_LISTENER: undo_listener, UNDO_UPDATE_LISTENER: undo_listener,

View file

@ -6,14 +6,9 @@ from .const import DOMAIN
from .server import RoonServer from .server import RoonServer
async def async_setup(hass, config):
"""Set up the Roon platform."""
hass.data[DOMAIN] = {}
return True
async def async_setup_entry(hass, entry): async def async_setup_entry(hass, entry):
"""Set up a roonserver from a config entry.""" """Set up a roonserver from a config entry."""
hass.data.setdefault(DOMAIN, {})
host = entry.data[CONF_HOST] host = entry.data[CONF_HOST]
roonserver = RoonServer(hass, entry) roonserver = RoonServer(hass, entry)

View file

@ -23,12 +23,6 @@ class CannotConnect(exceptions.HomeAssistantError):
"""Error to indicate we cannot connect.""" """Error to indicate we cannot connect."""
async def async_setup(hass, config):
"""Set up the sharkiq environment."""
hass.data.setdefault(DOMAIN, {})
return True
async def async_connect_or_timeout(ayla_api: AylaApi) -> bool: async def async_connect_or_timeout(ayla_api: AylaApi) -> bool:
"""Connect to vacuum.""" """Connect to vacuum."""
try: try:
@ -66,6 +60,7 @@ async def async_setup_entry(hass, config_entry):
await coordinator.async_config_entry_first_refresh() await coordinator.async_config_entry_first_refresh()
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][config_entry.entry_id] = coordinator hass.data[DOMAIN][config_entry.entry_id] = coordinator
for platform in PLATFORMS: for platform in PLATFORMS:

View file

@ -16,11 +16,6 @@ _LOGGER = logging.getLogger(__name__)
PLATFORMS = ["sensor"] PLATFORMS = ["sensor"]
async def async_setup(hass, config):
"""Old way of setting up the srp_energy component."""
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up the SRP Energy component from a config entry.""" """Set up the SRP Energy component from a config entry."""
# Store an SrpEnergyClient object for your srp_energy to access # Store an SrpEnergyClient object for your srp_energy to access

View file

@ -37,12 +37,6 @@ from .const import (
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
async def async_setup(hass, base_config):
"""Do nothing since this integration does not support configuration.yml setup."""
hass.data.setdefault(DOMAIN, {})
return True
async def async_setup_entry(hass, entry): async def async_setup_entry(hass, entry):
"""Set up Subaru from a config entry.""" """Set up Subaru from a config entry."""
config = entry.data config = entry.data
@ -88,6 +82,7 @@ async def async_setup_entry(hass, entry):
await coordinator.async_refresh() await coordinator.async_refresh()
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = { hass.data[DOMAIN][entry.entry_id] = {
ENTRY_CONTROLLER: controller, ENTRY_CONTROLLER: controller,
ENTRY_COORDINATOR: coordinator, ENTRY_COORDINATOR: coordinator,

View file

@ -45,7 +45,7 @@ async def test_step_user(hass, mock_garmin_connect):
with patch( with patch(
"homeassistant.components.garmin_connect.async_setup_entry", return_value=True "homeassistant.components.garmin_connect.async_setup_entry", return_value=True
), patch("homeassistant.components.garmin_connect.async_setup", return_value=True): ):
result = await hass.config_entries.flow.async_init( result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": "user"}, data=MOCK_CONF DOMAIN, context={"source": "user"}, data=MOCK_CONF
) )

View file

@ -23,8 +23,6 @@ async def test_form(hass):
"homeassistant.components.kmtronic.config_flow.KMTronicHubAPI.async_get_status", "homeassistant.components.kmtronic.config_flow.KMTronicHubAPI.async_get_status",
return_value=[Mock()], return_value=[Mock()],
), patch( ), patch(
"homeassistant.components.kmtronic.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.kmtronic.async_setup_entry", "homeassistant.components.kmtronic.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -45,7 +43,6 @@ async def test_form(hass):
"password": "test-password", "password": "test-password",
} }
await hass.async_block_till_done() await hass.async_block_till_done()
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1

View file

@ -47,8 +47,6 @@ async def test_user_flow(hass, user_flow):
"homeassistant.components.kodi.config_flow.get_kodi_connection", "homeassistant.components.kodi.config_flow.get_kodi_connection",
return_value=MockConnection(), return_value=MockConnection(),
), patch( ), patch(
"homeassistant.components.kodi.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.kodi.async_setup_entry", "homeassistant.components.kodi.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -66,7 +64,6 @@ async def test_user_flow(hass, user_flow):
"timeout": DEFAULT_TIMEOUT, "timeout": DEFAULT_TIMEOUT,
} }
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
@ -92,8 +89,6 @@ async def test_form_valid_auth(hass, user_flow):
"homeassistant.components.kodi.config_flow.get_kodi_connection", "homeassistant.components.kodi.config_flow.get_kodi_connection",
return_value=MockConnection(), return_value=MockConnection(),
), patch( ), patch(
"homeassistant.components.kodi.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.kodi.async_setup_entry", "homeassistant.components.kodi.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -112,7 +107,6 @@ async def test_form_valid_auth(hass, user_flow):
"timeout": DEFAULT_TIMEOUT, "timeout": DEFAULT_TIMEOUT,
} }
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
@ -142,8 +136,6 @@ async def test_form_valid_ws_port(hass, user_flow):
"homeassistant.components.kodi.config_flow.get_kodi_connection", "homeassistant.components.kodi.config_flow.get_kodi_connection",
return_value=MockConnection(), return_value=MockConnection(),
), patch( ), patch(
"homeassistant.components.kodi.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.kodi.async_setup_entry", "homeassistant.components.kodi.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -163,7 +155,6 @@ async def test_form_valid_ws_port(hass, user_flow):
"timeout": DEFAULT_TIMEOUT, "timeout": DEFAULT_TIMEOUT,
} }
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
@ -187,8 +178,6 @@ async def test_form_empty_ws_port(hass, user_flow):
assert result["errors"] == {} assert result["errors"] == {}
with patch( with patch(
"homeassistant.components.kodi.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.kodi.async_setup_entry", "homeassistant.components.kodi.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -208,7 +197,6 @@ async def test_form_empty_ws_port(hass, user_flow):
"timeout": DEFAULT_TIMEOUT, "timeout": DEFAULT_TIMEOUT,
} }
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
@ -430,8 +418,6 @@ async def test_discovery(hass):
assert result["step_id"] == "discovery_confirm" assert result["step_id"] == "discovery_confirm"
with patch( with patch(
"homeassistant.components.kodi.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.kodi.async_setup_entry", "homeassistant.components.kodi.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -451,7 +437,6 @@ async def test_discovery(hass):
"timeout": DEFAULT_TIMEOUT, "timeout": DEFAULT_TIMEOUT,
} }
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
@ -594,8 +579,6 @@ async def test_form_import(hass):
"homeassistant.components.kodi.config_flow.get_kodi_connection", "homeassistant.components.kodi.config_flow.get_kodi_connection",
return_value=MockConnection(), return_value=MockConnection(),
), patch( ), patch(
"homeassistant.components.kodi.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.kodi.async_setup_entry", "homeassistant.components.kodi.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -610,7 +593,6 @@ async def test_form_import(hass):
assert result["title"] == TEST_IMPORT["name"] assert result["title"] == TEST_IMPORT["name"]
assert result["data"] == TEST_IMPORT assert result["data"] == TEST_IMPORT
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1

View file

@ -23,8 +23,6 @@ async def test_flow_success(hass):
"homeassistant.components.kulersky.config_flow.pykulersky.discover", "homeassistant.components.kulersky.config_flow.pykulersky.discover",
return_value=[light], return_value=[light],
), patch( ), patch(
"homeassistant.components.kulersky.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.kulersky.async_setup_entry", "homeassistant.components.kulersky.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -38,7 +36,6 @@ async def test_flow_success(hass):
assert result2["title"] == "Kuler Sky" assert result2["title"] == "Kuler Sky"
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
@ -55,8 +52,6 @@ async def test_flow_no_devices_found(hass):
"homeassistant.components.kulersky.config_flow.pykulersky.discover", "homeassistant.components.kulersky.config_flow.pykulersky.discover",
return_value=[], return_value=[],
), patch( ), patch(
"homeassistant.components.kulersky.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.kulersky.async_setup_entry", "homeassistant.components.kulersky.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -68,7 +63,6 @@ async def test_flow_no_devices_found(hass):
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
@ -85,8 +79,6 @@ async def test_flow_exceptions_caught(hass):
"homeassistant.components.kulersky.config_flow.pykulersky.discover", "homeassistant.components.kulersky.config_flow.pykulersky.discover",
side_effect=pykulersky.PykulerskyException("TEST"), side_effect=pykulersky.PykulerskyException("TEST"),
), patch( ), patch(
"homeassistant.components.kulersky.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.kulersky.async_setup_entry", "homeassistant.components.kulersky.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -98,5 +90,4 @@ async def test_flow_exceptions_caught(hass):
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

View file

@ -55,8 +55,6 @@ async def test_user_owserver(hass):
# Valid server # Valid server
with patch("homeassistant.components.onewire.onewirehub.protocol.proxy",), patch( with patch("homeassistant.components.onewire.onewirehub.protocol.proxy",), patch(
"homeassistant.components.onewire.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.onewire.async_setup_entry", "homeassistant.components.onewire.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -73,15 +71,12 @@ async def test_user_owserver(hass):
CONF_PORT: 1234, CONF_PORT: 1234,
} }
await hass.async_block_till_done() await hass.async_block_till_done()
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
async def test_user_owserver_duplicate(hass): async def test_user_owserver_duplicate(hass):
"""Test OWServer flow.""" """Test OWServer flow."""
with patch( with patch(
"homeassistant.components.onewire.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.onewire.async_setup_entry", "homeassistant.components.onewire.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -111,7 +106,6 @@ async def test_user_owserver_duplicate(hass):
assert result["type"] == RESULT_TYPE_ABORT assert result["type"] == RESULT_TYPE_ABORT
assert result["reason"] == "already_configured" assert result["reason"] == "already_configured"
await hass.async_block_till_done() await hass.async_block_till_done()
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
@ -151,8 +145,6 @@ async def test_user_sysbus(hass):
"homeassistant.components.onewire.onewirehub.os.path.isdir", "homeassistant.components.onewire.onewirehub.os.path.isdir",
return_value=True, return_value=True,
), patch( ), patch(
"homeassistant.components.onewire.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.onewire.async_setup_entry", "homeassistant.components.onewire.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -168,15 +160,12 @@ async def test_user_sysbus(hass):
CONF_MOUNT_DIR: "/sys/bus/directory", CONF_MOUNT_DIR: "/sys/bus/directory",
} }
await hass.async_block_till_done() await hass.async_block_till_done()
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
async def test_user_sysbus_duplicate(hass): async def test_user_sysbus_duplicate(hass):
"""Test SysBus duplicate flow.""" """Test SysBus duplicate flow."""
with patch( with patch(
"homeassistant.components.onewire.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.onewire.async_setup_entry", "homeassistant.components.onewire.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -211,7 +200,6 @@ async def test_user_sysbus_duplicate(hass):
assert result["type"] == RESULT_TYPE_ABORT assert result["type"] == RESULT_TYPE_ABORT
assert result["reason"] == "already_configured" assert result["reason"] == "already_configured"
await hass.async_block_till_done() await hass.async_block_till_done()
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
@ -222,8 +210,6 @@ async def test_import_sysbus(hass):
"homeassistant.components.onewire.onewirehub.os.path.isdir", "homeassistant.components.onewire.onewirehub.os.path.isdir",
return_value=True, return_value=True,
), patch( ), patch(
"homeassistant.components.onewire.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.onewire.async_setup_entry", "homeassistant.components.onewire.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -239,7 +225,6 @@ async def test_import_sysbus(hass):
CONF_MOUNT_DIR: DEFAULT_SYSBUS_MOUNT_DIR, CONF_MOUNT_DIR: DEFAULT_SYSBUS_MOUNT_DIR,
} }
await hass.async_block_till_done() await hass.async_block_till_done()
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
@ -250,8 +235,6 @@ async def test_import_sysbus_with_mount_dir(hass):
"homeassistant.components.onewire.onewirehub.os.path.isdir", "homeassistant.components.onewire.onewirehub.os.path.isdir",
return_value=True, return_value=True,
), patch( ), patch(
"homeassistant.components.onewire.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.onewire.async_setup_entry", "homeassistant.components.onewire.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -270,7 +253,6 @@ async def test_import_sysbus_with_mount_dir(hass):
CONF_MOUNT_DIR: DEFAULT_SYSBUS_MOUNT_DIR, CONF_MOUNT_DIR: DEFAULT_SYSBUS_MOUNT_DIR,
} }
await hass.async_block_till_done() await hass.async_block_till_done()
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
@ -278,8 +260,6 @@ async def test_import_owserver(hass):
"""Test import step.""" """Test import step."""
with patch("homeassistant.components.onewire.onewirehub.protocol.proxy",), patch( with patch("homeassistant.components.onewire.onewirehub.protocol.proxy",), patch(
"homeassistant.components.onewire.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.onewire.async_setup_entry", "homeassistant.components.onewire.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -299,7 +279,6 @@ async def test_import_owserver(hass):
CONF_PORT: DEFAULT_OWSERVER_PORT, CONF_PORT: DEFAULT_OWSERVER_PORT,
} }
await hass.async_block_till_done() await hass.async_block_till_done()
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
@ -307,8 +286,6 @@ async def test_import_owserver_with_port(hass):
"""Test import step.""" """Test import step."""
with patch("homeassistant.components.onewire.onewirehub.protocol.proxy",), patch( with patch("homeassistant.components.onewire.onewirehub.protocol.proxy",), patch(
"homeassistant.components.onewire.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.onewire.async_setup_entry", "homeassistant.components.onewire.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -329,7 +306,6 @@ async def test_import_owserver_with_port(hass):
CONF_PORT: 1234, CONF_PORT: 1234,
} }
await hass.async_block_till_done() await hass.async_block_till_done()
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
@ -337,8 +313,6 @@ async def test_import_owserver_duplicate(hass):
"""Test OWServer flow.""" """Test OWServer flow."""
# Initialise with single entry # Initialise with single entry
with patch( with patch(
"homeassistant.components.onewire.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.onewire.async_setup_entry", "homeassistant.components.onewire.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -358,5 +332,4 @@ async def test_import_owserver_duplicate(hass):
assert result["type"] == RESULT_TYPE_ABORT assert result["type"] == RESULT_TYPE_ABORT
assert result["reason"] == "already_configured" assert result["reason"] == "already_configured"
await hass.async_block_till_done() await hass.async_block_till_done()
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1

View file

@ -84,9 +84,6 @@ async def test_full_flow_implementation(hass: HomeAssistant) -> None:
with patch( with patch(
"homeassistant.components.ovo_energy.config_flow.OVOEnergy.authenticate", "homeassistant.components.ovo_energy.config_flow.OVOEnergy.authenticate",
return_value=True, return_value=True,
), patch(
"homeassistant.components.ovo_energy.async_setup",
return_value=True,
), patch( ), patch(
"homeassistant.components.ovo_energy.async_setup_entry", "homeassistant.components.ovo_energy.async_setup_entry",
return_value=True, return_value=True,

View file

@ -18,15 +18,6 @@ from . import (
) )
@fixture(autouse=True)
def mock_setup():
"""Disable component setup."""
with patch(
"homeassistant.components.philips_js.async_setup", return_value=True
) as mock_setup:
yield mock_setup
@fixture(autouse=True) @fixture(autouse=True)
def mock_setup_entry(): def mock_setup_entry():
"""Disable component setup.""" """Disable component setup."""
@ -50,7 +41,7 @@ async def mock_tv_pairable(mock_tv):
return mock_tv return mock_tv
async def test_import(hass, mock_setup, mock_setup_entry): async def test_import(hass, mock_setup_entry):
"""Test we get an item on import.""" """Test we get an item on import."""
result = await hass.config_entries.flow.async_init( result = await hass.config_entries.flow.async_init(
DOMAIN, DOMAIN,
@ -61,7 +52,6 @@ async def test_import(hass, mock_setup, mock_setup_entry):
assert result["type"] == "create_entry" assert result["type"] == "create_entry"
assert result["title"] == "Philips TV (1234567890)" assert result["title"] == "Philips TV (1234567890)"
assert result["data"] == MOCK_CONFIG assert result["data"] == MOCK_CONFIG
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
@ -77,7 +67,7 @@ async def test_import_exist(hass, mock_config_entry):
assert result["reason"] == "already_configured" assert result["reason"] == "already_configured"
async def test_form(hass, mock_setup, mock_setup_entry): async def test_form(hass, mock_setup_entry):
"""Test we get the form.""" """Test we get the form."""
result = await hass.config_entries.flow.async_init( result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER} DOMAIN, context={"source": config_entries.SOURCE_USER}
@ -94,7 +84,6 @@ async def test_form(hass, mock_setup, mock_setup_entry):
assert result2["type"] == "create_entry" assert result2["type"] == "create_entry"
assert result2["title"] == "Philips TV (1234567890)" assert result2["title"] == "Philips TV (1234567890)"
assert result2["data"] == MOCK_CONFIG assert result2["data"] == MOCK_CONFIG
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
@ -128,7 +117,7 @@ async def test_form_unexpected_error(hass, mock_tv):
assert result["errors"] == {"base": "unknown"} assert result["errors"] == {"base": "unknown"}
async def test_pairing(hass, mock_tv_pairable, mock_setup, mock_setup_entry): async def test_pairing(hass, mock_tv_pairable, mock_setup_entry):
"""Test we get the form.""" """Test we get the form."""
mock_tv = mock_tv_pairable mock_tv = mock_tv_pairable
@ -166,13 +155,10 @@ async def test_pairing(hass, mock_tv_pairable, mock_setup, mock_setup_entry):
} }
await hass.async_block_till_done() await hass.async_block_till_done()
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
async def test_pair_request_failed( async def test_pair_request_failed(hass, mock_tv_pairable, mock_setup_entry):
hass, mock_tv_pairable, mock_setup, mock_setup_entry
):
"""Test we get the form.""" """Test we get the form."""
mock_tv = mock_tv_pairable mock_tv = mock_tv_pairable
mock_tv.pairRequest.side_effect = PairingFailure({}) mock_tv.pairRequest.side_effect = PairingFailure({})
@ -197,7 +183,7 @@ async def test_pair_request_failed(
} }
async def test_pair_grant_failed(hass, mock_tv_pairable, mock_setup, mock_setup_entry): async def test_pair_grant_failed(hass, mock_tv_pairable, mock_setup_entry):
"""Test we get the form.""" """Test we get the form."""
mock_tv = mock_tv_pairable mock_tv = mock_tv_pairable

View file

@ -243,8 +243,6 @@ async def test_options(hass):
config_entry.add_to_hass(hass) config_entry.add_to_hass(hass)
with patch( with patch(
"homeassistant.components.plaato.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.plaato.async_setup_entry", return_value=True "homeassistant.components.plaato.async_setup_entry", return_value=True
) as mock_setup_entry: ) as mock_setup_entry:
@ -266,7 +264,6 @@ async def test_options(hass):
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result["data"][CONF_SCAN_INTERVAL] == 10 assert result["data"][CONF_SCAN_INTERVAL] == 10
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
@ -281,8 +278,6 @@ async def test_options_webhook(hass, webhook_id):
config_entry.add_to_hass(hass) config_entry.add_to_hass(hass)
with patch( with patch(
"homeassistant.components.plaato.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.plaato.async_setup_entry", return_value=True "homeassistant.components.plaato.async_setup_entry", return_value=True
) as mock_setup_entry: ) as mock_setup_entry:
@ -305,5 +300,4 @@ async def test_options_webhook(hass, webhook_id):
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result["data"][CONF_WEBHOOK_ID] == CONF_WEBHOOK_ID assert result["data"][CONF_WEBHOOK_ID] == CONF_WEBHOOK_ID
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1

View file

@ -72,9 +72,6 @@ async def test_form(hass):
"homeassistant.components.plugwise.config_flow.Smile.connect", "homeassistant.components.plugwise.config_flow.Smile.connect",
return_value=True, return_value=True,
), patch( ), patch(
"homeassistant.components.plugwise.async_setup",
return_value=True,
) as mock_setup, patch(
"homeassistant.components.plugwise.async_setup_entry", "homeassistant.components.plugwise.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -93,7 +90,6 @@ async def test_form(hass):
CONF_USERNAME: TEST_USERNAME, CONF_USERNAME: TEST_USERNAME,
} }
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
@ -112,9 +108,6 @@ async def test_zeroconf_form(hass):
"homeassistant.components.plugwise.config_flow.Smile.connect", "homeassistant.components.plugwise.config_flow.Smile.connect",
return_value=True, return_value=True,
), patch( ), patch(
"homeassistant.components.plugwise.async_setup",
return_value=True,
) as mock_setup, patch(
"homeassistant.components.plugwise.async_setup_entry", "homeassistant.components.plugwise.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -133,7 +126,6 @@ async def test_zeroconf_form(hass):
CONF_USERNAME: TEST_USERNAME, CONF_USERNAME: TEST_USERNAME,
} }
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
@ -149,9 +141,6 @@ async def test_form_username(hass):
"homeassistant.components.plugwise.config_flow.Smile.connect", "homeassistant.components.plugwise.config_flow.Smile.connect",
return_value=True, return_value=True,
), patch( ), patch(
"homeassistant.components.plugwise.async_setup",
return_value=True,
) as mock_setup, patch(
"homeassistant.components.plugwise.async_setup_entry", "homeassistant.components.plugwise.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -174,7 +163,6 @@ async def test_form_username(hass):
CONF_USERNAME: TEST_USERNAME2, CONF_USERNAME: TEST_USERNAME2,
} }
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
result3 = await hass.config_entries.flow.async_init( result3 = await hass.config_entries.flow.async_init(
@ -189,9 +177,6 @@ async def test_form_username(hass):
"homeassistant.components.plugwise.config_flow.Smile.connect", "homeassistant.components.plugwise.config_flow.Smile.connect",
return_value=True, return_value=True,
), patch( ), patch(
"homeassistant.components.plugwise.async_setup",
return_value=True,
) as mock_setup, patch(
"homeassistant.components.plugwise.async_setup_entry", "homeassistant.components.plugwise.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:

View file

@ -38,8 +38,6 @@ async def test_valid_credentials(hass):
with patch( with patch(
"poolsense.PoolSense.test_poolsense_credentials", return_value=True "poolsense.PoolSense.test_poolsense_credentials", return_value=True
), patch( ), patch(
"homeassistant.components.poolsense.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.poolsense.async_setup_entry", return_value=True "homeassistant.components.poolsense.async_setup_entry", return_value=True
) as mock_setup_entry: ) as mock_setup_entry:
result = await hass.config_entries.flow.async_init( result = await hass.config_entries.flow.async_init(
@ -52,5 +50,4 @@ async def test_valid_credentials(hass):
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result["title"] == "test-email" assert result["title"] == "test-email"
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1

View file

@ -35,8 +35,6 @@ async def test_form_source_user(hass):
"homeassistant.components.powerwall.config_flow.Powerwall", "homeassistant.components.powerwall.config_flow.Powerwall",
return_value=mock_powerwall, return_value=mock_powerwall,
), patch( ), patch(
"homeassistant.components.powerwall.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.powerwall.async_setup_entry", "homeassistant.components.powerwall.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -49,7 +47,6 @@ async def test_form_source_user(hass):
assert result2["type"] == "create_entry" assert result2["type"] == "create_entry"
assert result2["title"] == "My site" assert result2["title"] == "My site"
assert result2["data"] == VALID_CONFIG assert result2["data"] == VALID_CONFIG
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
@ -197,8 +194,6 @@ async def test_dhcp_discovery(hass):
"homeassistant.components.powerwall.config_flow.Powerwall", "homeassistant.components.powerwall.config_flow.Powerwall",
return_value=mock_powerwall, return_value=mock_powerwall,
), patch( ), patch(
"homeassistant.components.powerwall.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.powerwall.async_setup_entry", "homeassistant.components.powerwall.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -211,7 +206,6 @@ async def test_dhcp_discovery(hass):
assert result2["type"] == "create_entry" assert result2["type"] == "create_entry"
assert result2["title"] == "Some site" assert result2["title"] == "Some site"
assert result2["data"] == VALID_CONFIG assert result2["data"] == VALID_CONFIG
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
@ -237,8 +231,6 @@ async def test_form_reauth(hass):
"homeassistant.components.powerwall.config_flow.Powerwall", "homeassistant.components.powerwall.config_flow.Powerwall",
return_value=mock_powerwall, return_value=mock_powerwall,
), patch( ), patch(
"homeassistant.components.powerwall.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.powerwall.async_setup_entry", "homeassistant.components.powerwall.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -253,5 +245,4 @@ async def test_form_reauth(hass):
assert result2["type"] == "abort" assert result2["type"] == "abort"
assert result2["reason"] == "reauth_successful" assert result2["reason"] == "reauth_successful"
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1

View file

@ -17,8 +17,6 @@ async def test_form_user(hass):
assert result["errors"] is None assert result["errors"] is None
with patch( with patch(
"homeassistant.components.profiler.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.profiler.async_setup_entry", "homeassistant.components.profiler.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -31,7 +29,6 @@ async def test_form_user(hass):
assert result2["type"] == "create_entry" assert result2["type"] == "create_entry"
assert result2["title"] == "Profiler" assert result2["title"] == "Profiler"
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

View file

@ -48,9 +48,6 @@ async def test_form(hass):
assert result2["errors"] == {} assert result2["errors"] == {}
with patch( with patch(
"homeassistant.components.progettihwsw.async_setup",
return_value=True,
), patch(
"homeassistant.components.progettihwsw.async_setup_entry", "homeassistant.components.progettihwsw.async_setup_entry",
return_value=True, return_value=True,
): ):

View file

@ -59,8 +59,6 @@ async def test_form(hass):
), patch( ), patch(
"homeassistant.components.risco.config_flow.RiscoAPI.close" "homeassistant.components.risco.config_flow.RiscoAPI.close"
) as mock_close, patch( ) as mock_close, patch(
"homeassistant.components.risco.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.risco.async_setup_entry", "homeassistant.components.risco.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -72,7 +70,6 @@ async def test_form(hass):
assert result2["type"] == "create_entry" assert result2["type"] == "create_entry"
assert result2["title"] == TEST_SITE_NAME assert result2["title"] == TEST_SITE_NAME
assert result2["data"] == TEST_DATA assert result2["data"] == TEST_DATA
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
mock_close.assert_awaited_once() mock_close.assert_awaited_once()

View file

@ -71,8 +71,6 @@ async def test_successful_discovery_and_auth(hass):
), patch( ), patch(
"homeassistant.components.roon.config_flow.RoonDiscovery", "homeassistant.components.roon.config_flow.RoonDiscovery",
return_value=RoonDiscoveryMock(), return_value=RoonDiscoveryMock(),
), patch(
"homeassistant.components.roon.async_setup", return_value=True
), patch( ), patch(
"homeassistant.components.roon.async_setup_entry", "homeassistant.components.roon.async_setup_entry",
return_value=True, return_value=True,
@ -111,8 +109,6 @@ async def test_unsuccessful_discovery_user_form_and_auth(hass):
), patch( ), patch(
"homeassistant.components.roon.config_flow.RoonDiscovery", "homeassistant.components.roon.config_flow.RoonDiscovery",
return_value=RoonDiscoveryFailedMock(), return_value=RoonDiscoveryFailedMock(),
), patch(
"homeassistant.components.roon.async_setup", return_value=True
), patch( ), patch(
"homeassistant.components.roon.async_setup_entry", "homeassistant.components.roon.async_setup_entry",
return_value=True, return_value=True,
@ -160,8 +156,6 @@ async def test_successful_discovery_no_auth(hass):
), patch( ), patch(
"homeassistant.components.roon.config_flow.AUTHENTICATE_TIMEOUT", "homeassistant.components.roon.config_flow.AUTHENTICATE_TIMEOUT",
0.01, 0.01,
), patch(
"homeassistant.components.roon.async_setup", return_value=True
), patch( ), patch(
"homeassistant.components.roon.async_setup_entry", "homeassistant.components.roon.async_setup_entry",
return_value=True, return_value=True,
@ -195,8 +189,6 @@ async def test_unexpected_exception(hass):
), patch( ), patch(
"homeassistant.components.roon.config_flow.RoonDiscovery", "homeassistant.components.roon.config_flow.RoonDiscovery",
return_value=RoonDiscoveryMock(), return_value=RoonDiscoveryMock(),
), patch(
"homeassistant.components.roon.async_setup", return_value=True
), patch( ), patch(
"homeassistant.components.roon.async_setup_entry", "homeassistant.components.roon.async_setup_entry",
return_value=True, return_value=True,

View file

@ -24,8 +24,6 @@ async def test_form(hass):
assert result["errors"] == {} assert result["errors"] == {}
with patch("sharkiqpy.AylaApi.async_sign_in", return_value=True), patch( with patch("sharkiqpy.AylaApi.async_sign_in", return_value=True), patch(
"homeassistant.components.sharkiq.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.sharkiq.async_setup_entry", "homeassistant.components.sharkiq.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -41,7 +39,6 @@ async def test_form(hass):
"password": TEST_PASSWORD, "password": TEST_PASSWORD,
} }
await hass.async_block_till_done() await hass.async_block_till_done()
mock_setup.assert_called_once()
mock_setup_entry.assert_called_once() mock_setup_entry.assert_called_once()

View file

@ -21,8 +21,6 @@ async def test_form(hass):
with patch( with patch(
"homeassistant.components.srp_energy.config_flow.SrpEnergyClient" "homeassistant.components.srp_energy.config_flow.SrpEnergyClient"
), patch( ), patch(
"homeassistant.components.srp_energy.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.srp_energy.async_setup_entry", "homeassistant.components.srp_energy.async_setup_entry",
return_value=True, return_value=True,
) as mock_setup_entry: ) as mock_setup_entry:
@ -36,7 +34,6 @@ async def test_form(hass):
assert result["title"] == "Test" assert result["title"] == "Test"
assert result["data"][CONF_IS_TOU] is False assert result["data"][CONF_IS_TOU] is False
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1

View file

@ -27,7 +27,6 @@ from .conftest import (
from tests.common import MockConfigEntry from tests.common import MockConfigEntry
ASYNC_SETUP = "homeassistant.components.subaru.async_setup"
ASYNC_SETUP_ENTRY = "homeassistant.components.subaru.async_setup_entry" ASYNC_SETUP_ENTRY = "homeassistant.components.subaru.async_setup_entry"
@ -96,8 +95,6 @@ async def test_user_form_pin_not_required(hass, user_form):
MOCK_API_IS_PIN_REQUIRED, MOCK_API_IS_PIN_REQUIRED,
return_value=False, return_value=False,
) as mock_is_pin_required, patch( ) as mock_is_pin_required, patch(
ASYNC_SETUP, return_value=True
) as mock_setup, patch(
ASYNC_SETUP_ENTRY, return_value=True ASYNC_SETUP_ENTRY, return_value=True
) as mock_setup_entry: ) as mock_setup_entry:
result = await hass.config_entries.flow.async_configure( result = await hass.config_entries.flow.async_configure(
@ -106,7 +103,6 @@ async def test_user_form_pin_not_required(hass, user_form):
) )
assert len(mock_connect.mock_calls) == 1 assert len(mock_connect.mock_calls) == 1
assert len(mock_is_pin_required.mock_calls) == 1 assert len(mock_is_pin_required.mock_calls) == 1
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
expected = { expected = {
@ -160,8 +156,6 @@ async def test_pin_form_success(hass, pin_form):
MOCK_API_UPDATE_SAVED_PIN, MOCK_API_UPDATE_SAVED_PIN,
return_value=True, return_value=True,
) as mock_update_saved_pin, patch( ) as mock_update_saved_pin, patch(
ASYNC_SETUP, return_value=True
) as mock_setup, patch(
ASYNC_SETUP_ENTRY, return_value=True ASYNC_SETUP_ENTRY, return_value=True
) as mock_setup_entry: ) as mock_setup_entry:
result = await hass.config_entries.flow.async_configure( result = await hass.config_entries.flow.async_configure(
@ -170,7 +164,6 @@ async def test_pin_form_success(hass, pin_form):
assert len(mock_test_pin.mock_calls) == 1 assert len(mock_test_pin.mock_calls) == 1
assert len(mock_update_saved_pin.mock_calls) == 1 assert len(mock_update_saved_pin.mock_calls) == 1
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
expected = { expected = {
"title": TEST_USERNAME, "title": TEST_USERNAME,