Embed all platforms into components (#20677)
* Consolidate all components with platforms * Organize tests * Fix more tests * Fix Verisure tests * one final test fix * Add change * Fix coverage
This commit is contained in:
1 parent
a24da611c5
commit
e2d3c27e85
490 files changed
+255
-517
No files matched your search
@@ -0,0 +1 @@
|
||||
"""Tests for the Arlo integration."""
|
||||
@@ -4,7 +4,7 @@ from unittest.mock import patch, MagicMock
|
||||
import pytest
|
||||
from homeassistant.const import (
|
||||
DEVICE_CLASS_TEMPERATURE, DEVICE_CLASS_HUMIDITY, ATTR_ATTRIBUTION)
|
||||
from homeassistant.components.sensor import arlo
|
||||
from homeassistant.components.arlo import sensor as arlo
|
||||
from homeassistant.components.arlo import DATA_ARLO
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ def sensor_with_hass_data(default_sensor, hass):
|
||||
@pytest.fixture()
|
||||
def mock_dispatch():
|
||||
"""Mock the dispatcher connect method."""
|
||||
target = 'homeassistant.components.sensor.arlo.async_dispatcher_connect'
|
||||
target = 'homeassistant.components.arlo.sensor.async_dispatcher_connect'
|
||||
with patch(target, MagicMock()) as _mock:
|
||||
yield _mock
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
"""Tests for Ecobee integration."""
|
||||
@@ -2,7 +2,7 @@
|
||||
import unittest
|
||||
from unittest import mock
|
||||
import homeassistant.const as const
|
||||
import homeassistant.components.climate.ecobee as ecobee
|
||||
from homeassistant.components.ecobee import climate as ecobee
|
||||
from homeassistant.components.climate import STATE_OFF
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
"""Tests for the FritzBox! integration."""
|
||||
+1
-1
@@ -4,7 +4,7 @@ from unittest.mock import Mock, patch
|
||||
|
||||
import requests
|
||||
|
||||
from homeassistant.components.climate.fritzbox import FritzboxThermostat
|
||||
from homeassistant.components.fritzbox.climate import FritzboxThermostat
|
||||
|
||||
|
||||
class TestFritzboxClimate(unittest.TestCase):
|
||||
@@ -0,0 +1 @@
|
||||
"""Tests for the Google integration."""
|
||||
@@ -7,7 +7,7 @@ from unittest.mock import patch, Mock
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.calendar as calendar_base
|
||||
import homeassistant.components.calendar.google as calendar
|
||||
from homeassistant.components.google import calendar
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.const import CONF_PLATFORM, STATE_OFF, STATE_ON
|
||||
from homeassistant.helpers.template import DATE_STR_FORMAT
|
||||
@@ -40,7 +40,7 @@ class TestComponentsGoogleCalendar(unittest.TestCase):
|
||||
|
||||
self.hass.stop()
|
||||
|
||||
@patch('homeassistant.components.calendar.google.GoogleCalendarData')
|
||||
@patch('homeassistant.components.google.calendar.GoogleCalendarData')
|
||||
def test_all_day_event(self, mock_next_event):
|
||||
"""Test that we can create an event trigger on device."""
|
||||
week_from_today = dt_util.dt.date.today() \
|
||||
@@ -103,7 +103,7 @@ class TestComponentsGoogleCalendar(unittest.TestCase):
|
||||
'description': event['description'],
|
||||
}
|
||||
|
||||
@patch('homeassistant.components.calendar.google.GoogleCalendarData')
|
||||
@patch('homeassistant.components.google.calendar.GoogleCalendarData')
|
||||
def test_future_event(self, mock_next_event):
|
||||
"""Test that we can create an event trigger on device."""
|
||||
one_hour_from_now = dt_util.now() \
|
||||
@@ -164,7 +164,7 @@ class TestComponentsGoogleCalendar(unittest.TestCase):
|
||||
'description': '',
|
||||
}
|
||||
|
||||
@patch('homeassistant.components.calendar.google.GoogleCalendarData')
|
||||
@patch('homeassistant.components.google.calendar.GoogleCalendarData')
|
||||
def test_in_progress_event(self, mock_next_event):
|
||||
"""Test that we can create an event trigger on device."""
|
||||
middle_of_event = dt_util.now() \
|
||||
@@ -226,7 +226,7 @@ class TestComponentsGoogleCalendar(unittest.TestCase):
|
||||
'description': '',
|
||||
}
|
||||
|
||||
@patch('homeassistant.components.calendar.google.GoogleCalendarData')
|
||||
@patch('homeassistant.components.google.calendar.GoogleCalendarData')
|
||||
def test_offset_in_progress_event(self, mock_next_event):
|
||||
"""Test that we can create an event trigger on device."""
|
||||
middle_of_event = dt_util.now() \
|
||||
@@ -290,7 +290,7 @@ class TestComponentsGoogleCalendar(unittest.TestCase):
|
||||
}
|
||||
|
||||
@pytest.mark.skip
|
||||
@patch('homeassistant.components.calendar.google.GoogleCalendarData')
|
||||
@patch('homeassistant.components.google.calendar.GoogleCalendarData')
|
||||
def test_all_day_offset_in_progress_event(self, mock_next_event):
|
||||
"""Test that we can create an event trigger on device."""
|
||||
tomorrow = dt_util.dt.date.today() \
|
||||
@@ -356,7 +356,7 @@ class TestComponentsGoogleCalendar(unittest.TestCase):
|
||||
'description': event['description'],
|
||||
}
|
||||
|
||||
@patch('homeassistant.components.calendar.google.GoogleCalendarData')
|
||||
@patch('homeassistant.components.google.calendar.GoogleCalendarData')
|
||||
def test_all_day_offset_event(self, mock_next_event):
|
||||
"""Test that we can create an event trigger on device."""
|
||||
tomorrow = dt_util.dt.date.today() \
|
||||
@@ -12,7 +12,7 @@ from homeassistant.setup import setup_component
|
||||
from tests.common import (
|
||||
get_test_home_assistant, assert_setup_component, mock_service)
|
||||
|
||||
from .test_init import mutagen_mock # noqa
|
||||
from tests.components.tts.test_init import mutagen_mock # noqa
|
||||
|
||||
|
||||
class TestTTSGooglePlatform:
|
||||
@@ -0,0 +1 @@
|
||||
"""Tests for the Kira integration."""
|
||||
@@ -2,7 +2,7 @@
|
||||
import unittest
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from homeassistant.components.remote import kira as kira
|
||||
from homeassistant.components.kira import remote as kira
|
||||
|
||||
from tests.common import get_test_home_assistant
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import unittest
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from homeassistant.components.sensor import kira as kira
|
||||
from homeassistant.components.kira import sensor as kira
|
||||
|
||||
from tests.common import get_test_home_assistant
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
"""Tests for the Mochad integration."""
|
||||
@@ -5,7 +5,7 @@ import unittest.mock as mock
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import light
|
||||
from homeassistant.components.light import mochad
|
||||
from homeassistant.components.mochad import light as mochad
|
||||
from homeassistant.setup import setup_component
|
||||
|
||||
from tests.common import get_test_home_assistant
|
||||
@@ -35,7 +35,7 @@ class TestMochadSwitchSetup(unittest.TestCase):
|
||||
"""Stop everything that was started."""
|
||||
self.hass.stop()
|
||||
|
||||
@mock.patch('homeassistant.components.light.mochad.MochadLight')
|
||||
@mock.patch('homeassistant.components.mochad.light.MochadLight')
|
||||
def test_setup_adds_proper_devices(self, mock_light):
|
||||
"""Test if setup adds devices."""
|
||||
good_config = {
|
||||
@@ -6,7 +6,7 @@ import pytest
|
||||
|
||||
from homeassistant.setup import setup_component
|
||||
from homeassistant.components import switch
|
||||
from homeassistant.components.switch import mochad
|
||||
from homeassistant.components.mochad import switch as mochad
|
||||
|
||||
from tests.common import get_test_home_assistant
|
||||
|
||||
@@ -36,7 +36,7 @@ class TestMochadSwitchSetup(unittest.TestCase):
|
||||
"""Stop everything that was started."""
|
||||
self.hass.stop()
|
||||
|
||||
@mock.patch('homeassistant.components.switch.mochad.MochadSwitch')
|
||||
@mock.patch('homeassistant.components.mochad.switch.MochadSwitch')
|
||||
def test_setup_adds_proper_devices(self, mock_switch):
|
||||
"""Test if setup adds devices."""
|
||||
good_config = {
|
||||
@@ -0,0 +1 @@
|
||||
"""Tests for Verisure integration."""
|
||||
@@ -46,7 +46,7 @@ LOCKS = ['door_lock']
|
||||
@contextmanager
|
||||
def mock_hub(config, get_response=LOCKS[0]):
|
||||
"""Extensively mock out a verisure hub."""
|
||||
hub_prefix = 'homeassistant.components.lock.verisure.hub'
|
||||
hub_prefix = 'homeassistant.components.verisure.lock.hub'
|
||||
verisure_prefix = 'verisure.Session'
|
||||
with patch(verisure_prefix) as session, \
|
||||
patch(hub_prefix) as hub:
|
||||
@@ -0,0 +1 @@
|
||||
"""Tests for the WebOS TV integration."""
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
from homeassistant.components.media_player import webostv
|
||||
from homeassistant.components.webostv import media_player as webostv
|
||||
|
||||
|
||||
class FakeLgWebOSDevice(webostv.LgWebOSDevice):
|
||||
@@ -0,0 +1 @@
|
||||
"""Tests for the Xiaomi Miio integration."""
|
||||
+1
-1
@@ -11,7 +11,7 @@ from homeassistant.components.vacuum import (
|
||||
SERVICE_CLEAN_SPOT, SERVICE_LOCATE, SERVICE_RETURN_TO_BASE,
|
||||
SERVICE_SEND_COMMAND, SERVICE_SET_FAN_SPEED, SERVICE_START_PAUSE,
|
||||
SERVICE_STOP, SERVICE_TOGGLE, SERVICE_TURN_OFF, SERVICE_TURN_ON)
|
||||
from homeassistant.components.vacuum.xiaomi_miio import (
|
||||
from homeassistant.components.xiaomi_miio.vacuum import (
|
||||
ATTR_CLEANED_AREA, ATTR_CLEANING_TIME, ATTR_DO_NOT_DISTURB,
|
||||
ATTR_DO_NOT_DISTURB_START, ATTR_DO_NOT_DISTURB_END, ATTR_ERROR,
|
||||
ATTR_MAIN_BRUSH_LEFT, ATTR_SIDE_BRUSH_LEFT, ATTR_FILTER_LEFT,
|
||||
Reference in new issue
Block a user