parent
23cb579f9f
commit
b0d893afc9
11 changed files with 69 additions and 84 deletions
|
@ -3,7 +3,7 @@
|
|||
import unittest
|
||||
|
||||
from homeassistant.setup import setup_component, async_setup_component
|
||||
from homeassistant import core, loader
|
||||
from homeassistant import core
|
||||
from homeassistant.components import switch
|
||||
from homeassistant.const import STATE_ON, STATE_OFF, CONF_PLATFORM
|
||||
|
||||
|
@ -18,7 +18,7 @@ class TestSwitch(unittest.TestCase):
|
|||
def setUp(self):
|
||||
"""Set up things to be run when tests are started."""
|
||||
self.hass = get_test_home_assistant()
|
||||
platform = loader.get_component(self.hass, 'test.switch')
|
||||
platform = getattr(self.hass.components, 'test.switch')
|
||||
platform.init()
|
||||
# Switch 1 is ON, switch 2 is OFF
|
||||
self.switch_1, self.switch_2, self.switch_3 = \
|
||||
|
@ -77,7 +77,7 @@ class TestSwitch(unittest.TestCase):
|
|||
def test_setup_two_platforms(self):
|
||||
"""Test with bad configuration."""
|
||||
# Test if switch component returns 0 switches
|
||||
test_platform = loader.get_component(self.hass, 'test.switch')
|
||||
test_platform = getattr(self.hass.components, 'test.switch')
|
||||
test_platform.init(True)
|
||||
|
||||
mock_entity_platform(self.hass, 'switch.test2', test_platform)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue