Split bootstrap into bs + setup (#6416)

* Split bootstrap into bs + setup

* Lint
This commit is contained in:
Paulus Schoutsen 2017-03-05 01:41:54 -08:00 committed by Pascal Vizeli
parent bdf948d866
commit 2650c73a89
171 changed files with 972 additions and 959 deletions

View file

@ -3,7 +3,7 @@ import unittest
from homeassistant.const import (STATE_ON, STATE_OFF)
from homeassistant.components.binary_sensor import command_line
from homeassistant import bootstrap
from homeassistant import setup
from homeassistant.helpers import template
from tests.common import get_test_home_assistant
@ -47,7 +47,7 @@ class TestCommandSensorBinarySensor(unittest.TestCase):
'platform': 'not_command_line',
}
self.assertFalse(bootstrap.setup_component(self.hass, 'test', {
self.assertFalse(setup.setup_component(self.hass, 'test', {
'command_line': config,
}))

View file

@ -1,7 +1,7 @@
"""The tests for Home Assistant ffmpeg binary sensor."""
from unittest.mock import patch
from homeassistant.bootstrap import setup_component
from homeassistant.setup import setup_component
from tests.common import (
get_test_home_assistant, assert_setup_component, mock_coro)

View file

@ -1,7 +1,7 @@
"""The tests for the MQTT binary sensor platform."""
import unittest
from homeassistant.bootstrap import setup_component
from homeassistant.setup import setup_component
import homeassistant.components.binary_sensor as binary_sensor
from homeassistant.const import (STATE_OFF, STATE_ON)

View file

@ -6,7 +6,7 @@ from unittest import mock
from nx584 import client as nx584_client
from homeassistant.components.binary_sensor import nx584
from homeassistant.bootstrap import setup_component
from homeassistant.setup import setup_component
from tests.common import get_test_home_assistant

View file

@ -4,7 +4,7 @@ from unittest.mock import MagicMock
import requests_mock
from homeassistant.bootstrap import setup_component
from homeassistant.setup import setup_component
from homeassistant.components.binary_sensor import sleepiq
from tests.components.test_sleepiq import mock_responses

View file

@ -2,7 +2,7 @@
import unittest
from unittest.mock import patch, Mock
from homeassistant.bootstrap import setup_component
from homeassistant.setup import setup_component
from homeassistant.components.binary_sensor import tcp as bin_tcp
from homeassistant.components.sensor import tcp
from tests.common import (get_test_home_assistant, assert_setup_component)

View file

@ -5,7 +5,7 @@ from unittest import mock
from homeassistant.core import CoreState, State
from homeassistant.const import MATCH_ALL
import homeassistant.bootstrap as bootstrap
from homeassistant import setup
from homeassistant.components.binary_sensor import template
from homeassistant.exceptions import TemplateError
from homeassistant.helpers import template as template_hlpr
@ -45,13 +45,13 @@ class TestBinarySensorTemplate(unittest.TestCase):
},
}
with assert_setup_component(1):
assert bootstrap.setup_component(
assert setup.setup_component(
self.hass, 'binary_sensor', config)
def test_setup_no_sensors(self):
""""Test setup with no sensors."""
with assert_setup_component(0):
assert bootstrap.setup_component(self.hass, 'binary_sensor', {
assert setup.setup_component(self.hass, 'binary_sensor', {
'binary_sensor': {
'platform': 'template'
}
@ -60,7 +60,7 @@ class TestBinarySensorTemplate(unittest.TestCase):
def test_setup_invalid_device(self):
""""Test the setup with invalid devices."""
with assert_setup_component(0):
assert bootstrap.setup_component(self.hass, 'binary_sensor', {
assert setup.setup_component(self.hass, 'binary_sensor', {
'binary_sensor': {
'platform': 'template',
'sensors': {
@ -72,7 +72,7 @@ class TestBinarySensorTemplate(unittest.TestCase):
def test_setup_invalid_device_class(self):
""""Test setup with invalid sensor class."""
with assert_setup_component(0):
assert bootstrap.setup_component(self.hass, 'binary_sensor', {
assert setup.setup_component(self.hass, 'binary_sensor', {
'binary_sensor': {
'platform': 'template',
'sensors': {
@ -87,7 +87,7 @@ class TestBinarySensorTemplate(unittest.TestCase):
def test_setup_invalid_missing_template(self):
""""Test setup with invalid and missing template."""
with assert_setup_component(0):
assert bootstrap.setup_component(self.hass, 'binary_sensor', {
assert setup.setup_component(self.hass, 'binary_sensor', {
'binary_sensor': {
'platform': 'template',
'sensors': {
@ -134,7 +134,7 @@ class TestBinarySensorTemplate(unittest.TestCase):
},
}
with assert_setup_component(1):
assert bootstrap.setup_component(
assert setup.setup_component(
self.hass, 'binary_sensor', config)
self.hass.start()
@ -187,7 +187,7 @@ def test_restore_state(hass):
},
},
}
yield from bootstrap.async_setup_component(hass, 'binary_sensor', config)
yield from setup.async_setup_component(hass, 'binary_sensor', config)
state = hass.states.get('binary_sensor.test')
assert state.state == 'on'

View file

@ -1,7 +1,7 @@
"""The test for the threshold sensor platform."""
import unittest
from homeassistant.bootstrap import setup_component
from homeassistant.setup import setup_component
from homeassistant.const import (ATTR_UNIT_OF_MEASUREMENT, TEMP_CELSIUS)
from tests.common import get_test_home_assistant

View file

@ -1,5 +1,5 @@
"""The test for the Trend sensor platform."""
import homeassistant.bootstrap as bootstrap
from homeassistant import setup
from tests.common import get_test_home_assistant, assert_setup_component
@ -19,7 +19,7 @@ class TestTrendBinarySensor:
def test_up(self):
"""Test up trend."""
assert bootstrap.setup_component(self.hass, 'binary_sensor', {
assert setup.setup_component(self.hass, 'binary_sensor', {
'binary_sensor': {
'platform': 'trend',
'sensors': {
@ -40,7 +40,7 @@ class TestTrendBinarySensor:
def test_down(self):
"""Test down trend."""
assert bootstrap.setup_component(self.hass, 'binary_sensor', {
assert setup.setup_component(self.hass, 'binary_sensor', {
'binary_sensor': {
'platform': 'trend',
'sensors': {
@ -61,7 +61,7 @@ class TestTrendBinarySensor:
def test__invert_up(self):
"""Test up trend with custom message."""
assert bootstrap.setup_component(self.hass, 'binary_sensor', {
assert setup.setup_component(self.hass, 'binary_sensor', {
'binary_sensor': {
'platform': 'trend',
'sensors': {
@ -83,7 +83,7 @@ class TestTrendBinarySensor:
def test_invert_down(self):
"""Test down trend with custom message."""
assert bootstrap.setup_component(self.hass, 'binary_sensor', {
assert setup.setup_component(self.hass, 'binary_sensor', {
'binary_sensor': {
'platform': 'trend',
'sensors': {
@ -105,7 +105,7 @@ class TestTrendBinarySensor:
def test_attribute_up(self):
"""Test attribute up trend."""
assert bootstrap.setup_component(self.hass, 'binary_sensor', {
assert setup.setup_component(self.hass, 'binary_sensor', {
'binary_sensor': {
'platform': 'trend',
'sensors': {
@ -126,7 +126,7 @@ class TestTrendBinarySensor:
def test_attribute_down(self):
"""Test attribute down trend."""
assert bootstrap.setup_component(self.hass, 'binary_sensor', {
assert setup.setup_component(self.hass, 'binary_sensor', {
'binary_sensor': {
'platform': 'trend',
'sensors': {
@ -149,7 +149,7 @@ class TestTrendBinarySensor:
def test_non_numeric(self):
"""Test up trend."""
assert bootstrap.setup_component(self.hass, 'binary_sensor', {
assert setup.setup_component(self.hass, 'binary_sensor', {
'binary_sensor': {
'platform': 'trend',
'sensors': {
@ -170,7 +170,7 @@ class TestTrendBinarySensor:
def test_missing_attribute(self):
"""Test attribute down trend."""
assert bootstrap.setup_component(self.hass, 'binary_sensor', {
assert setup.setup_component(self.hass, 'binary_sensor', {
'binary_sensor': {
'platform': 'trend',
'sensors': {
@ -195,7 +195,7 @@ class TestTrendBinarySensor:
# pylint: disable=invalid-name
"""Test invalid name."""
with assert_setup_component(0):
assert bootstrap.setup_component(self.hass, 'binary_sensor', {
assert setup.setup_component(self.hass, 'binary_sensor', {
'binary_sensor': {
'platform': 'template',
'sensors': {
@ -212,7 +212,7 @@ class TestTrendBinarySensor:
# pylint: disable=invalid-name
"""Test invalid sensor."""
with assert_setup_component(0):
assert bootstrap.setup_component(self.hass, 'binary_sensor', {
assert setup.setup_component(self.hass, 'binary_sensor', {
'binary_sensor': {
'platform': 'template',
'sensors': {
@ -228,7 +228,7 @@ class TestTrendBinarySensor:
def test_no_sensors_does_not_create(self):
"""Test no sensors."""
with assert_setup_component(0):
assert bootstrap.setup_component(self.hass, 'binary_sensor', {
assert setup.setup_component(self.hass, 'binary_sensor', {
'binary_sensor': {
'platform': 'trend'
}