Consolidate config flow components (#20635)
* Consolidate config flow components * Fix tests * Fix tests * Put unifi back * Fix reqs * Update coveragerc
This commit is contained in:
parent
57ef8c271e
commit
ec57db78b5
53 changed files with 50 additions and 63 deletions
54
.coveragerc
54
.coveragerc
|
@ -19,8 +19,7 @@ omit =
|
|||
homeassistant/components/alarmdecoder.py
|
||||
homeassistant/components/*/alarmdecoder.py
|
||||
|
||||
homeassistant/components/ambient_station/__init__.py
|
||||
homeassistant/components/ambient_station/sensor.py
|
||||
homeassistant/components/ambient_station/*
|
||||
|
||||
homeassistant/components/amcrest.py
|
||||
homeassistant/components/*/amcrest.py
|
||||
|
@ -69,16 +68,13 @@ omit =
|
|||
homeassistant/components/sensor/coinbase.py
|
||||
|
||||
homeassistant/components/cast/*
|
||||
homeassistant/components/*/cast.py
|
||||
|
||||
homeassistant/components/cloudflare.py
|
||||
|
||||
homeassistant/components/comfoconnect.py
|
||||
homeassistant/components/*/comfoconnect.py
|
||||
|
||||
homeassistant/components/daikin/__init__.py
|
||||
homeassistant/components/daikin/const.py
|
||||
homeassistant/components/*/daikin.py
|
||||
homeassistant/components/daikin/*
|
||||
|
||||
homeassistant/components/digital_ocean.py
|
||||
homeassistant/components/*/digital_ocean.py
|
||||
|
@ -181,9 +177,7 @@ omit =
|
|||
homeassistant/components/homematic/__init__.py
|
||||
homeassistant/components/*/homematic.py
|
||||
|
||||
homeassistant/components/homematicip_cloud/hap.py
|
||||
homeassistant/components/homematicip_cloud/device.py
|
||||
homeassistant/components/*/homematicip_cloud.py
|
||||
homeassistant/components/homematicip_cloud/*
|
||||
|
||||
homeassistant/components/homeworks.py
|
||||
homeassistant/components/*/homeworks.py
|
||||
|
@ -194,6 +188,8 @@ omit =
|
|||
homeassistant/components/hydrawise.py
|
||||
homeassistant/components/*/hydrawise.py
|
||||
|
||||
homeassistant/components/ifttt/*
|
||||
|
||||
homeassistant/components/ihc/*
|
||||
homeassistant/components/*/ihc.py
|
||||
|
||||
|
@ -204,8 +200,7 @@ omit =
|
|||
|
||||
homeassistant/components/insteon_plm.py
|
||||
|
||||
homeassistant/components/ios.py
|
||||
homeassistant/components/*/ios.py
|
||||
homeassistant/components/ios/*
|
||||
|
||||
homeassistant/components/iota.py
|
||||
homeassistant/components/*/iota.py
|
||||
|
@ -234,15 +229,19 @@ omit =
|
|||
homeassistant/components/lcn.py
|
||||
homeassistant/components/*/lcn.py
|
||||
|
||||
homeassistant/components/linode.py
|
||||
homeassistant/components/*/linode.py
|
||||
homeassistant/components/lifx/*
|
||||
|
||||
homeassistant/components/lightwave.py
|
||||
homeassistant/components/*/lightwave.py
|
||||
|
||||
homeassistant/components/linode.py
|
||||
homeassistant/components/*/linode.py
|
||||
|
||||
homeassistant/components/logi_circle.py
|
||||
homeassistant/components/*/logi_circle.py
|
||||
|
||||
homeassistant/components/luftdaten/*
|
||||
|
||||
homeassistant/components/lupusec.py
|
||||
homeassistant/components/*/lupusec.py
|
||||
|
||||
|
@ -275,8 +274,7 @@ omit =
|
|||
homeassistant/components/neato.py
|
||||
homeassistant/components/*/neato.py
|
||||
|
||||
homeassistant/components/nest/__init__.py
|
||||
homeassistant/components/*/nest.py
|
||||
homeassistant/components/nest/*
|
||||
|
||||
homeassistant/components/netatmo.py
|
||||
homeassistant/components/*/netatmo.py
|
||||
|
@ -303,9 +301,7 @@ omit =
|
|||
homeassistant/components/pilight.py
|
||||
homeassistant/components/*/pilight.py
|
||||
|
||||
homeassistant/components/point/__init__.py
|
||||
homeassistant/components/point/const.py
|
||||
homeassistant/components/*/point.py
|
||||
homeassistant/components/point/*
|
||||
|
||||
homeassistant/components/switch/qwikswitch.py
|
||||
homeassistant/components/light/qwikswitch.py
|
||||
|
@ -362,8 +358,7 @@ omit =
|
|||
homeassistant/components/smappee.py
|
||||
homeassistant/components/*/smappee.py
|
||||
|
||||
homeassistant/components/sonos/__init__.py
|
||||
homeassistant/components/*/sonos.py
|
||||
homeassistant/components/sonos/*
|
||||
|
||||
homeassistant/components/tado.py
|
||||
homeassistant/components/*/tado.py
|
||||
|
@ -371,9 +366,7 @@ omit =
|
|||
homeassistant/components/tahoma.py
|
||||
homeassistant/components/*/tahoma.py
|
||||
|
||||
homeassistant/components/tellduslive/__init__.py
|
||||
homeassistant/components/tellduslive/entry.py
|
||||
homeassistant/components/*/tellduslive.py
|
||||
homeassistant/components/tellduslive/*
|
||||
|
||||
homeassistant/components/tellstick.py
|
||||
homeassistant/components/*/tellstick.py
|
||||
|
@ -395,15 +388,16 @@ omit =
|
|||
homeassistant/components/tplink_lte.py
|
||||
homeassistant/components/*/tplink_lte.py
|
||||
|
||||
homeassistant/components/tradfri.py
|
||||
homeassistant/components/*/tradfri.py
|
||||
|
||||
homeassistant/components/tradfri/*
|
||||
|
||||
homeassistant/components/transmission.py
|
||||
homeassistant/components/*/transmission.py
|
||||
|
||||
homeassistant/components/notify/twilio_sms.py
|
||||
homeassistant/components/notify/twilio_call.py
|
||||
|
||||
homeassistant/components/upnp.py
|
||||
|
||||
homeassistant/components/upcloud.py
|
||||
homeassistant/components/*/upcloud.py
|
||||
|
||||
|
@ -466,7 +460,6 @@ omit =
|
|||
homeassistant/components/zha/core/device.py
|
||||
homeassistant/components/zha/core/listeners.py
|
||||
homeassistant/components/zha/core/gateway.py
|
||||
homeassistant/components/*/zha.py
|
||||
|
||||
homeassistant/components/zigbee.py
|
||||
homeassistant/components/*/zigbee.py
|
||||
|
@ -485,7 +478,6 @@ omit =
|
|||
homeassistant/components/alarm_control_panel/canary.py
|
||||
homeassistant/components/alarm_control_panel/concord232.py
|
||||
homeassistant/components/alarm_control_panel/ialarm.py
|
||||
homeassistant/components/alarm_control_panel/ifttt.py
|
||||
homeassistant/components/alarm_control_panel/manual_mqtt.py
|
||||
homeassistant/components/alarm_control_panel/nx584.py
|
||||
homeassistant/components/alarm_control_panel/totalconnect.py
|
||||
|
@ -584,13 +576,11 @@ omit =
|
|||
homeassistant/components/downloader.py
|
||||
homeassistant/components/emoncms_history.py
|
||||
homeassistant/components/emulated_hue/upnp.py
|
||||
homeassistant/components/fan/mqtt.py
|
||||
homeassistant/components/fan/wemo.py
|
||||
homeassistant/components/folder_watcher.py
|
||||
homeassistant/components/foursquare.py
|
||||
homeassistant/components/goalfeed.py
|
||||
homeassistant/components/idteck_prox.py
|
||||
homeassistant/components/ifttt.py
|
||||
homeassistant/components/image_processing/dlib_face_detect.py
|
||||
homeassistant/components/image_processing/dlib_face_identify.py
|
||||
homeassistant/components/image_processing/seven_segments.py
|
||||
|
@ -611,7 +601,6 @@ omit =
|
|||
homeassistant/components/light/hyperion.py
|
||||
homeassistant/components/light/iglo.py
|
||||
homeassistant/components/light/lifx_legacy.py
|
||||
homeassistant/components/light/lifx.py
|
||||
homeassistant/components/light/limitlessled.py
|
||||
homeassistant/components/light/lw12wifi.py
|
||||
homeassistant/components/light/mystrom.py
|
||||
|
@ -801,7 +790,6 @@ omit =
|
|||
homeassistant/components/sensor/haveibeenpwned.py
|
||||
homeassistant/components/sensor/hp_ilo.py
|
||||
homeassistant/components/sensor/htu21d.py
|
||||
homeassistant/components/sensor/upnp.py
|
||||
homeassistant/components/sensor/iliad_italy.py
|
||||
homeassistant/components/sensor/imap_email_content.py
|
||||
homeassistant/components/sensor/imap.py
|
||||
|
@ -816,7 +804,6 @@ omit =
|
|||
homeassistant/components/sensor/linux_battery.py
|
||||
homeassistant/components/sensor/london_underground.py
|
||||
homeassistant/components/sensor/loopenergy.py
|
||||
homeassistant/components/sensor/luftdaten.py
|
||||
homeassistant/components/sensor/lyft.py
|
||||
homeassistant/components/sensor/magicseaweed.py
|
||||
homeassistant/components/sensor/meteo_france.py
|
||||
|
@ -949,7 +936,6 @@ omit =
|
|||
homeassistant/components/tts/baidu.py
|
||||
homeassistant/components/tts/microsoft.py
|
||||
homeassistant/components/tts/picotts.py
|
||||
homeassistant/components/vacuum/mqtt.py
|
||||
homeassistant/components/vacuum/roomba.py
|
||||
homeassistant/components/water_heater/econet.py
|
||||
homeassistant/components/watson_iot.py
|
||||
|
|
|
@ -8,7 +8,7 @@ import logging
|
|||
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light, DOMAIN)
|
||||
from homeassistant.components.light.lutron import (
|
||||
from homeassistant.components.lutron.light import (
|
||||
to_hass_level, to_lutron_level)
|
||||
from homeassistant.components.lutron_caseta import (
|
||||
LUTRON_CASETA_SMARTBRIDGE, LutronCasetaDevice)
|
||||
|
|
|
@ -126,7 +126,7 @@ aioimaplib==0.7.13
|
|||
# homeassistant.components.lifx
|
||||
aiolifx==0.6.7
|
||||
|
||||
# homeassistant.components.light.lifx
|
||||
# homeassistant.components.lifx.light
|
||||
aiolifx_effects==0.2.1
|
||||
|
||||
# homeassistant.components.scene.hunterdouglas_powerview
|
||||
|
|
|
@ -10,7 +10,7 @@ from tests.common import MockDependency, mock_coro
|
|||
|
||||
async def test_creating_entry_sets_up_media_player(hass):
|
||||
"""Test setting up Cast loads the media player."""
|
||||
with patch('homeassistant.components.media_player.cast.async_setup_entry',
|
||||
with patch('homeassistant.components.cast.media_player.async_setup_entry',
|
||||
return_value=mock_coro(True)) as mock_setup, \
|
||||
MockDependency('pychromecast', 'discovery'), \
|
||||
patch('pychromecast.discovery.discover_chromecasts',
|
||||
|
|
|
@ -10,11 +10,11 @@ import pytest
|
|||
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.components.media_player.cast import ChromecastInfo
|
||||
from homeassistant.components.cast.media_player import ChromecastInfo
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect, \
|
||||
async_dispatcher_send
|
||||
from homeassistant.components.media_player import cast
|
||||
from homeassistant.components.cast import media_player as cast
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import MockConfigEntry, mock_coro
|
||||
|
@ -212,7 +212,7 @@ async def test_create_cast_device_with_uuid(hass):
|
|||
async def test_normal_chromecast_not_starting_discovery(hass):
|
||||
"""Test cast platform not starting discovery when not required."""
|
||||
# pylint: disable=no-member
|
||||
with patch('homeassistant.components.media_player.cast.'
|
||||
with patch('homeassistant.components.cast.media_player.'
|
||||
'_setup_internal_discovery') as setup_discovery:
|
||||
# normal (non-group) chromecast shouldn't start discovery.
|
||||
add_entities = await async_setup_cast(hass, {'host': 'host1'})
|
||||
|
@ -369,7 +369,7 @@ async def test_entry_setup_no_config(hass: HomeAssistantType):
|
|||
await async_setup_component(hass, 'cast', {})
|
||||
|
||||
with patch(
|
||||
'homeassistant.components.media_player.cast._async_setup_platform',
|
||||
'homeassistant.components.cast.media_player._async_setup_platform',
|
||||
return_value=mock_coro()) as mock_setup:
|
||||
await cast.async_setup_entry(hass, MockConfigEntry(), None)
|
||||
|
||||
|
@ -388,7 +388,7 @@ async def test_entry_setup_single_config(hass: HomeAssistantType):
|
|||
})
|
||||
|
||||
with patch(
|
||||
'homeassistant.components.media_player.cast._async_setup_platform',
|
||||
'homeassistant.components.cast.media_player._async_setup_platform',
|
||||
return_value=mock_coro()) as mock_setup:
|
||||
await cast.async_setup_entry(hass, MockConfigEntry(), None)
|
||||
|
||||
|
@ -408,7 +408,7 @@ async def test_entry_setup_list_config(hass: HomeAssistantType):
|
|||
})
|
||||
|
||||
with patch(
|
||||
'homeassistant.components.media_player.cast._async_setup_platform',
|
||||
'homeassistant.components.cast.media_player._async_setup_platform',
|
||||
return_value=mock_coro()) as mock_setup:
|
||||
await cast.async_setup_entry(hass, MockConfigEntry(), None)
|
||||
|
||||
|
@ -428,7 +428,7 @@ async def test_entry_setup_platform_not_ready(hass: HomeAssistantType):
|
|||
})
|
||||
|
||||
with patch(
|
||||
'homeassistant.components.media_player.cast._async_setup_platform',
|
||||
'homeassistant.components.cast.media_player._async_setup_platform',
|
||||
return_value=mock_coro(exception=Exception)) as mock_setup:
|
||||
with pytest.raises(PlatformNotReady):
|
||||
await cast.async_setup_entry(hass, MockConfigEntry(), None)
|
|
@ -30,7 +30,7 @@ async def test_ensure_device_tracker_platform_validation(hass):
|
|||
"""Check that Qos was added by validation."""
|
||||
assert 'qos' in config
|
||||
|
||||
with patch('homeassistant.components.device_tracker.mqtt.'
|
||||
with patch('homeassistant.components.mqtt.device_tracker.'
|
||||
'async_setup_scanner', autospec=True,
|
||||
side_effect=mock_setup_scanner) as mock_sp:
|
||||
|
||||
|
|
|
@ -1273,8 +1273,8 @@ async def test_single_waypoint_import(hass, context):
|
|||
|
||||
async def test_not_implemented_message(hass, context):
|
||||
"""Handle not implemented message type."""
|
||||
patch_handler = patch('homeassistant.components.device_tracker.'
|
||||
'owntracks.async_handle_not_impl_msg',
|
||||
patch_handler = patch('homeassistant.components.owntracks.'
|
||||
'device_tracker.async_handle_not_impl_msg',
|
||||
return_value=mock_coro(False))
|
||||
patch_handler.start()
|
||||
assert not await send_message(hass, LWT_TOPIC, LWT_MESSAGE)
|
||||
|
@ -1283,8 +1283,8 @@ async def test_not_implemented_message(hass, context):
|
|||
|
||||
async def test_unsupported_message(hass, context):
|
||||
"""Handle not implemented message type."""
|
||||
patch_handler = patch('homeassistant.components.device_tracker.'
|
||||
'owntracks.async_handle_unsupported_msg',
|
||||
patch_handler = patch('homeassistant.components.owntracks.'
|
||||
'device_tracker.async_handle_unsupported_msg',
|
||||
return_value=mock_coro(False))
|
||||
patch_handler.start()
|
||||
assert not await send_message(hass, BAD_TOPIC, BAD_MESSAGE)
|
||||
|
@ -1366,7 +1366,7 @@ def config_context(hass, setup_comp):
|
|||
patch_save.stop()
|
||||
|
||||
|
||||
@patch('homeassistant.components.device_tracker.owntracks.get_cipher',
|
||||
@patch('homeassistant.components.owntracks.device_tracker.get_cipher',
|
||||
mock_cipher)
|
||||
async def test_encrypted_payload(hass, config_context):
|
||||
"""Test encrypted payload."""
|
||||
|
@ -1377,7 +1377,7 @@ async def test_encrypted_payload(hass, config_context):
|
|||
assert_location_latitude(hass, LOCATION_MESSAGE['lat'])
|
||||
|
||||
|
||||
@patch('homeassistant.components.device_tracker.owntracks.get_cipher',
|
||||
@patch('homeassistant.components.owntracks.device_tracker.get_cipher',
|
||||
mock_cipher)
|
||||
async def test_encrypted_payload_topic_key(hass, config_context):
|
||||
"""Test encrypted payload with a topic key."""
|
||||
|
@ -1390,7 +1390,7 @@ async def test_encrypted_payload_topic_key(hass, config_context):
|
|||
assert_location_latitude(hass, LOCATION_MESSAGE['lat'])
|
||||
|
||||
|
||||
@patch('homeassistant.components.device_tracker.owntracks.get_cipher',
|
||||
@patch('homeassistant.components.owntracks.device_tracker.get_cipher',
|
||||
mock_cipher)
|
||||
async def test_encrypted_payload_no_key(hass, config_context):
|
||||
"""Test encrypted payload with no key, ."""
|
||||
|
@ -1403,7 +1403,7 @@ async def test_encrypted_payload_no_key(hass, config_context):
|
|||
assert hass.states.get(DEVICE_TRACKER_STATE) is None
|
||||
|
||||
|
||||
@patch('homeassistant.components.device_tracker.owntracks.get_cipher',
|
||||
@patch('homeassistant.components.owntracks.device_tracker.get_cipher',
|
||||
mock_cipher)
|
||||
async def test_encrypted_payload_wrong_key(hass, config_context):
|
||||
"""Test encrypted payload with wrong key."""
|
||||
|
@ -1414,7 +1414,7 @@ async def test_encrypted_payload_wrong_key(hass, config_context):
|
|||
assert hass.states.get(DEVICE_TRACKER_STATE) is None
|
||||
|
||||
|
||||
@patch('homeassistant.components.device_tracker.owntracks.get_cipher',
|
||||
@patch('homeassistant.components.owntracks.device_tracker.get_cipher',
|
||||
mock_cipher)
|
||||
async def test_encrypted_payload_wrong_topic_key(hass, config_context):
|
||||
"""Test encrypted payload with wrong topic key."""
|
||||
|
@ -1427,7 +1427,7 @@ async def test_encrypted_payload_wrong_topic_key(hass, config_context):
|
|||
assert hass.states.get(DEVICE_TRACKER_STATE) is None
|
||||
|
||||
|
||||
@patch('homeassistant.components.device_tracker.owntracks.get_cipher',
|
||||
@patch('homeassistant.components.owntracks.device_tracker.get_cipher',
|
||||
mock_cipher)
|
||||
async def test_encrypted_payload_no_topic_key(hass, config_context):
|
||||
"""Test encrypted payload with no topic key."""
|
||||
|
|
|
@ -25,8 +25,8 @@ def mock_ctrl():
|
|||
@pytest.fixture
|
||||
def mock_scanner():
|
||||
"""Mock UnifyScanner."""
|
||||
with mock.patch('homeassistant.components.device_tracker'
|
||||
'.unifi.UnifiScanner') as scanner:
|
||||
with mock.patch('homeassistant.components.device_tracker.unifi'
|
||||
'.UnifiScanner') as scanner:
|
||||
yield scanner
|
||||
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ def mock_dependencies(hass):
|
|||
|
||||
async def test_creating_entry_sets_up_sensor(hass):
|
||||
"""Test setting up iOS loads the sensor component."""
|
||||
with patch('homeassistant.components.sensor.ios.async_setup_entry',
|
||||
with patch('homeassistant.components.ios.sensor.async_setup_entry',
|
||||
return_value=mock_coro(True)) as mock_setup:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
ios.DOMAIN, context={'source': config_entries.SOURCE_USER})
|
||||
|
|
|
@ -9,8 +9,8 @@ from homeassistant.components.weather import (
|
|||
ATTR_WEATHER_TEMPERATURE, ATTR_WEATHER_HUMIDITY, ATTR_WEATHER_PRESSURE,
|
||||
ATTR_FORECAST_TEMP_LOW, ATTR_WEATHER_VISIBILITY, ATTR_WEATHER_ATTRIBUTION,
|
||||
ATTR_WEATHER_WIND_BEARING, ATTR_WEATHER_WIND_SPEED,
|
||||
ATTR_FORECAST_PRECIPITATION, smhi as weather_smhi,
|
||||
DOMAIN as WEATHER_DOMAIN)
|
||||
ATTR_FORECAST_PRECIPITATION, DOMAIN as WEATHER_DOMAIN)
|
||||
from homeassistant.components.smhi import weather as weather_smhi
|
||||
from homeassistant.const import TEMP_CELSIUS
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
|
@ -10,7 +10,7 @@ from tests.common import mock_coro
|
|||
|
||||
async def test_creating_entry_sets_up_media_player(hass):
|
||||
"""Test setting up Sonos loads the media player."""
|
||||
with patch('homeassistant.components.media_player.sonos.async_setup_entry',
|
||||
with patch('homeassistant.components.sonos.media_player.async_setup_entry',
|
||||
return_value=mock_coro(True)) as mock_setup, \
|
||||
patch('pysonos.discover', return_value=True):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
|
|
|
@ -8,8 +8,9 @@ import pysonos
|
|||
from pysonos import alarms
|
||||
|
||||
from homeassistant.setup import setup_component
|
||||
from homeassistant.components.media_player import sonos, DOMAIN
|
||||
from homeassistant.components.media_player.sonos import CONF_INTERFACE_ADDR
|
||||
from homeassistant.components.sonos import media_player as sonos
|
||||
from homeassistant.components.media_player import DOMAIN
|
||||
from homeassistant.components.sonos.media_player import CONF_INTERFACE_ADDR
|
||||
from homeassistant.const import CONF_HOSTS, CONF_PLATFORM
|
||||
|
||||
from tests.common import get_test_home_assistant
|
Loading…
Add table
Reference in a new issue