Remove loader.get_component (#23111)

* Remove get_component

* Lint
This commit is contained in:
Paulus Schoutsen authored and Jason Hu committed 2019-04-14 22:31:01 -07:00
1 parent 23cb579f9f
commit b0d893afc9
11 files changed
+69 -84

No files matched your search

+16 -17
View File
@@ -6,7 +6,6 @@ from homeassistant.setup import setup_component
from homeassistant.components import switch, light
from homeassistant.const import (
CONF_PLATFORM, STATE_ON, SERVICE_TURN_ON, SUN_EVENT_SUNRISE)
import homeassistant.loader as loader
import homeassistant.util.dt as dt_util
from tests.common import (
@@ -74,7 +73,7 @@ class TestSwitchFlux(unittest.TestCase):
def test_flux_when_switch_is_off(self):
"""Test the flux switch when it is off."""
platform = loader.get_component(self.hass, 'test.light')
platform = getattr(self.hass.components, 'test.light')
platform.init()
assert setup_component(self.hass, light.DOMAIN,
{light.DOMAIN: {CONF_PLATFORM: 'test'}})
@@ -114,7 +113,7 @@ class TestSwitchFlux(unittest.TestCase):
def test_flux_before_sunrise(self):
"""Test the flux switch before sunrise."""
platform = loader.get_component(self.hass, 'test.light')
platform = getattr(self.hass.components, 'test.light')
platform.init()
assert setup_component(self.hass, light.DOMAIN,
{light.DOMAIN: {CONF_PLATFORM: 'test'}})
@@ -159,7 +158,7 @@ class TestSwitchFlux(unittest.TestCase):
# pylint: disable=invalid-name
def test_flux_after_sunrise_before_sunset(self):
"""Test the flux switch after sunrise and before sunset."""
platform = loader.get_component(self.hass, 'test.light')
platform = getattr(self.hass.components, 'test.light')
platform.init()
assert setup_component(self.hass, light.DOMAIN,
{light.DOMAIN: {CONF_PLATFORM: 'test'}})
@@ -205,7 +204,7 @@ class TestSwitchFlux(unittest.TestCase):
# pylint: disable=invalid-name
def test_flux_after_sunset_before_stop(self):
"""Test the flux switch after sunset and before stop."""
platform = loader.get_component(self.hass, 'test.light')
platform = getattr(self.hass.components, 'test.light')
platform.init()
assert setup_component(self.hass, light.DOMAIN,
{light.DOMAIN: {CONF_PLATFORM: 'test'}})
@@ -252,7 +251,7 @@ class TestSwitchFlux(unittest.TestCase):
# pylint: disable=invalid-name
def test_flux_after_stop_before_sunrise(self):
"""Test the flux switch after stop and before sunrise."""
platform = loader.get_component(self.hass, 'test.light')
platform = getattr(self.hass.components, 'test.light')
platform.init()
assert setup_component(self.hass, light.DOMAIN,
{light.DOMAIN: {CONF_PLATFORM: 'test'}})
@@ -297,7 +296,7 @@ class TestSwitchFlux(unittest.TestCase):
# pylint: disable=invalid-name
def test_flux_with_custom_start_stop_times(self):
"""Test the flux with custom start and stop times."""
platform = loader.get_component(self.hass, 'test.light')
platform = getattr(self.hass.components, 'test.light')
platform.init()
assert setup_component(self.hass, light.DOMAIN,
{light.DOMAIN: {CONF_PLATFORM: 'test'}})
@@ -347,7 +346,7 @@ class TestSwitchFlux(unittest.TestCase):
This test has the stop_time on the next day (after midnight).
"""
platform = loader.get_component(self.hass, 'test.light')
platform = getattr(self.hass.components, 'test.light')
platform.init()
assert setup_component(self.hass, light.DOMAIN,
{light.DOMAIN: {CONF_PLATFORM: 'test'}})
@@ -398,7 +397,7 @@ class TestSwitchFlux(unittest.TestCase):
This test has the stop_time on the next day (after midnight).
"""
platform = loader.get_component(self.hass, 'test.light')
platform = getattr(self.hass.components, 'test.light')
platform.init()
assert setup_component(self.hass, light.DOMAIN,
{light.DOMAIN: {CONF_PLATFORM: 'test'}})
@@ -448,7 +447,7 @@ class TestSwitchFlux(unittest.TestCase):
This test has the stop_time on the next day (after midnight).
"""
platform = loader.get_component(self.hass, 'test.light')
platform = getattr(self.hass.components, 'test.light')
platform.init()
assert setup_component(self.hass, light.DOMAIN,
{light.DOMAIN: {CONF_PLATFORM: 'test'}})
@@ -497,7 +496,7 @@ class TestSwitchFlux(unittest.TestCase):
This test has the stop_time on the next day (after midnight).
"""
platform = loader.get_component(self.hass, 'test.light')
platform = getattr(self.hass.components, 'test.light')
platform.init()
assert setup_component(self.hass, light.DOMAIN,
{light.DOMAIN: {CONF_PLATFORM: 'test'}})
@@ -547,7 +546,7 @@ class TestSwitchFlux(unittest.TestCase):
This test has the stop_time on the next day (after midnight).
"""
platform = loader.get_component(self.hass, 'test.light')
platform = getattr(self.hass.components, 'test.light')
platform.init()
assert setup_component(self.hass, light.DOMAIN,
{light.DOMAIN: {CONF_PLATFORM: 'test'}})
@@ -594,7 +593,7 @@ class TestSwitchFlux(unittest.TestCase):
# pylint: disable=invalid-name
def test_flux_with_custom_colortemps(self):
"""Test the flux with custom start and stop colortemps."""
platform = loader.get_component(self.hass, 'test.light')
platform = getattr(self.hass.components, 'test.light')
platform.init()
assert setup_component(self.hass, light.DOMAIN,
{light.DOMAIN: {CONF_PLATFORM: 'test'}})
@@ -643,7 +642,7 @@ class TestSwitchFlux(unittest.TestCase):
# pylint: disable=invalid-name
def test_flux_with_custom_brightness(self):
"""Test the flux with custom start and stop colortemps."""
platform = loader.get_component(self.hass, 'test.light')
platform = getattr(self.hass.components, 'test.light')
platform.init()
assert setup_component(self.hass, light.DOMAIN,
{light.DOMAIN: {CONF_PLATFORM: 'test'}})
@@ -690,7 +689,7 @@ class TestSwitchFlux(unittest.TestCase):
def test_flux_with_multiple_lights(self):
"""Test the flux switch with multiple light entities."""
platform = loader.get_component(self.hass, 'test.light')
platform = getattr(self.hass.components, 'test.light')
platform.init()
assert setup_component(self.hass, light.DOMAIN,
{light.DOMAIN: {CONF_PLATFORM: 'test'}})
@@ -758,7 +757,7 @@ class TestSwitchFlux(unittest.TestCase):
def test_flux_with_mired(self):
"""Test the flux switch´s mode mired."""
platform = loader.get_component(self.hass, 'test.light')
platform = getattr(self.hass.components, 'test.light')
platform.init()
assert setup_component(self.hass, light.DOMAIN,
{light.DOMAIN: {CONF_PLATFORM: 'test'}})
@@ -802,7 +801,7 @@ class TestSwitchFlux(unittest.TestCase):
def test_flux_with_rgb(self):
"""Test the flux switch´s mode rgb."""
platform = loader.get_component(self.hass, 'test.light')
platform = getattr(self.hass.components, 'test.light')
platform.init()
assert setup_component(self.hass, light.DOMAIN,
{light.DOMAIN: {CONF_PLATFORM: 'test'}})