Move signal handling out of core to bootstrap (#5815)

* Move signal handling out of core to bootstrap

* Fix tests
This commit is contained in:
Pascal Vizeli 2017-02-09 06:58:45 +01:00 committed by Paulus Schoutsen
parent 7eb4bdc37b
commit 2cbed9cd96
7 changed files with 44 additions and 26 deletions

View file

@ -58,7 +58,8 @@ class TestBootstrap:
autospec=True)
@mock.patch('homeassistant.util.location.detect_location_info',
autospec=True, return_value=None)
def test_from_config_file(self, mock_upgrade, mock_detect):
@mock.patch('homeassistant.helpers.signal.async_register_signal_handling')
def test_from_config_file(self, mock_upgrade, mock_detect, mock_signal):
"""Test with configuration file."""
components = ['browser', 'conversation', 'script']
files = {
@ -289,7 +290,8 @@ class TestBootstrap:
assert 'comp' not in self.hass.config.components
@mock.patch('homeassistant.bootstrap.enable_logging')
def test_home_assistant_core_config_validation(self, log_mock):
@mock.patch('homeassistant.helpers.signal.async_register_signal_handling')
def test_home_assistant_core_config_validation(self, log_mock, sig_mock):
"""Test if we pass in wrong information for HA conf."""
# Extensive HA conf validation testing is done in test_config.py
assert None is bootstrap.from_config_dict({
@ -393,7 +395,8 @@ class TestBootstrap:
assert loader.get_component('disabled_component') is not None
assert 'disabled_component' in self.hass.config.components
def test_all_work_done_before_start(self):
@mock.patch('homeassistant.bootstrap.async_register_signal_handling')
def test_all_work_done_before_start(self, signal_mock):
"""Test all init work done till start."""
call_order = []