Skip to content

Commit

Permalink
Consolidate config flow components (home-assistant#20635)
Browse files Browse the repository at this point in the history
* Consolidate config flow components

* Fix tests

* Fix tests

* Put unifi back

* Fix reqs

* Update coveragerc
  • Loading branch information
balloob authored Feb 1, 2019
1 parent 57ef8c2 commit ec57db7
Show file tree
Hide file tree
Showing 53 changed files with 50 additions and 63 deletions.
54 changes: 20 additions & 34 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -194,6 +188,8 @@ omit =
homeassistant/components/hydrawise.py
homeassistant/components/*/hydrawise.py

homeassistant/components/ifttt/*

homeassistant/components/ihc/*
homeassistant/components/*/ihc.py

Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -362,18 +358,15 @@ 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

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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion homeassistant/components/light/lutron_caseta.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

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)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/components/cast/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

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
Expand Down Expand Up @@ -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'})
Expand Down Expand Up @@ -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)

Expand All @@ -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)

Expand All @@ -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)

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/components/device_tracker/test_mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async def mock_setup_scanner(hass, config, see, discovery_info=None):
"""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:

Expand Down
20 changes: 10 additions & 10 deletions tests/components/device_tracker/test_owntracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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."""
Expand All @@ -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."""
Expand All @@ -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, ."""
Expand All @@ -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."""
Expand All @@ -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."""
Expand All @@ -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."""
Expand Down
4 changes: 2 additions & 2 deletions tests/components/device_tracker/test_unifi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion tests/components/ios/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
Loading

0 comments on commit ec57db7

Please sign in to comment.