Async bootstrap / component init (#3991)
* Async bootstrap * Adress comments * Fix tests * More fixes * Tests fixes
This commit is contained in:
1 parent
d9999f36e8
commit
d5368f6f78
54 files changed
+1431
-1131
No files matched your search
@@ -3,7 +3,7 @@ import unittest
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.bootstrap import _setup_component
|
||||
from homeassistant.bootstrap import setup_component
|
||||
from homeassistant.components import rfxtrx as rfxtrx_core
|
||||
|
||||
from tests.common import get_test_home_assistant
|
||||
@@ -28,7 +28,7 @@ class TestLightRfxtrx(unittest.TestCase):
|
||||
|
||||
def test_valid_config(self):
|
||||
"""Test configuration."""
|
||||
self.assertTrue(_setup_component(self.hass, 'light', {
|
||||
self.assertTrue(setup_component(self.hass, 'light', {
|
||||
'light': {'platform': 'rfxtrx',
|
||||
'automatic_add': True,
|
||||
'devices':
|
||||
@@ -36,7 +36,7 @@ class TestLightRfxtrx(unittest.TestCase):
|
||||
'name': 'Test',
|
||||
rfxtrx_core.ATTR_FIREEVENT: True}}}}))
|
||||
|
||||
self.assertTrue(_setup_component(self.hass, 'light', {
|
||||
self.assertTrue(setup_component(self.hass, 'light', {
|
||||
'light': {'platform': 'rfxtrx',
|
||||
'automatic_add': True,
|
||||
'devices':
|
||||
@@ -47,7 +47,7 @@ class TestLightRfxtrx(unittest.TestCase):
|
||||
|
||||
def test_invalid_config(self):
|
||||
"""Test configuration."""
|
||||
self.assertFalse(_setup_component(self.hass, 'light', {
|
||||
self.assertFalse(setup_component(self.hass, 'light', {
|
||||
'light': {'platform': 'rfxtrx',
|
||||
'automatic_add': True,
|
||||
'invalid_key': 'afda',
|
||||
@@ -59,14 +59,14 @@ class TestLightRfxtrx(unittest.TestCase):
|
||||
|
||||
def test_default_config(self):
|
||||
"""Test with 0 switches."""
|
||||
self.assertTrue(_setup_component(self.hass, 'light', {
|
||||
self.assertTrue(setup_component(self.hass, 'light', {
|
||||
'light': {'platform': 'rfxtrx',
|
||||
'devices': {}}}))
|
||||
self.assertEqual(0, len(rfxtrx_core.RFX_DEVICES))
|
||||
|
||||
def test_old_config(self):
|
||||
"""Test with 1 light."""
|
||||
self.assertTrue(_setup_component(self.hass, 'light', {
|
||||
self.assertTrue(setup_component(self.hass, 'light', {
|
||||
'light': {'platform': 'rfxtrx',
|
||||
'devices':
|
||||
{'123efab1': {
|
||||
@@ -110,7 +110,7 @@ class TestLightRfxtrx(unittest.TestCase):
|
||||
|
||||
def test_one_light(self):
|
||||
"""Test with 1 light."""
|
||||
self.assertTrue(_setup_component(self.hass, 'light', {
|
||||
self.assertTrue(setup_component(self.hass, 'light', {
|
||||
'light': {'platform': 'rfxtrx',
|
||||
'devices':
|
||||
{'0b1100cd0213c7f210010f51': {
|
||||
@@ -179,7 +179,7 @@ class TestLightRfxtrx(unittest.TestCase):
|
||||
|
||||
def test_several_lights(self):
|
||||
"""Test with 3 lights."""
|
||||
self.assertTrue(_setup_component(self.hass, 'light', {
|
||||
self.assertTrue(setup_component(self.hass, 'light', {
|
||||
'light': {'platform': 'rfxtrx',
|
||||
'signal_repetitions': 3,
|
||||
'devices':
|
||||
@@ -212,7 +212,7 @@ class TestLightRfxtrx(unittest.TestCase):
|
||||
|
||||
def test_discover_light(self):
|
||||
"""Test with discovery of lights."""
|
||||
self.assertTrue(_setup_component(self.hass, 'light', {
|
||||
self.assertTrue(setup_component(self.hass, 'light', {
|
||||
'light': {'platform': 'rfxtrx',
|
||||
'automatic_add': True,
|
||||
'devices': {}}}))
|
||||
@@ -265,7 +265,7 @@ class TestLightRfxtrx(unittest.TestCase):
|
||||
|
||||
def test_discover_light_noautoadd(self):
|
||||
"""Test with discover of light when auto add is False."""
|
||||
self.assertTrue(_setup_component(self.hass, 'light', {
|
||||
self.assertTrue(setup_component(self.hass, 'light', {
|
||||
'light': {'platform': 'rfxtrx',
|
||||
'automatic_add': False,
|
||||
'devices': {}}}))
|
||||
|
||||
Reference in new issue
Block a user