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
@@ -1,7 +1,6 @@
|
||||
"""The tests for the InfluxDB component."""
|
||||
import unittest
|
||||
from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
||||
import influxdb as influx_client
|
||||
|
||||
@@ -9,6 +8,8 @@ from homeassistant.bootstrap import setup_component
|
||||
import homeassistant.components.influxdb as influxdb
|
||||
from homeassistant.const import EVENT_STATE_CHANGED, STATE_OFF, STATE_ON
|
||||
|
||||
from tests.common import get_test_home_assistant
|
||||
|
||||
|
||||
@mock.patch('influxdb.InfluxDBClient')
|
||||
class TestInfluxDB(unittest.TestCase):
|
||||
@@ -16,9 +17,13 @@ class TestInfluxDB(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
"""Setup things to be run when tests are started."""
|
||||
self.hass = mock.MagicMock()
|
||||
self.hass.pool.worker_count = 2
|
||||
self.hass = get_test_home_assistant(2)
|
||||
self.handler_method = None
|
||||
self.hass.bus.listen = mock.Mock()
|
||||
|
||||
def tearDown(self):
|
||||
"""Clear data."""
|
||||
self.hass.stop()
|
||||
|
||||
def test_setup_config_full(self, mock_client):
|
||||
"""Test the setup with full configuration."""
|
||||
@@ -61,8 +66,6 @@ class TestInfluxDB(unittest.TestCase):
|
||||
|
||||
assert setup_component(self.hass, influxdb.DOMAIN, config)
|
||||
|
||||
@patch('homeassistant.components.persistent_notification.create',
|
||||
mock.MagicMock())
|
||||
def test_setup_missing_password(self, mock_client):
|
||||
"""Test the setup with existing username and missing password."""
|
||||
config = {
|
||||
|
||||
Reference in new issue
Block a user