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
@@ -379,21 +379,22 @@ class TestAutomation(unittest.TestCase):
|
||||
self.hass.block_till_done()
|
||||
assert automation.is_on(self.hass, entity_id)
|
||||
|
||||
@patch('homeassistant.config.load_yaml_config_file', return_value={
|
||||
automation.DOMAIN: {
|
||||
'alias': 'bye',
|
||||
'trigger': {
|
||||
'platform': 'event',
|
||||
'event_type': 'test_event2',
|
||||
},
|
||||
'action': {
|
||||
'service': 'test.automation',
|
||||
'data_template': {
|
||||
'event': '{{ trigger.event.event_type }}'
|
||||
@patch('homeassistant.config.load_yaml_config_file', autospec=True,
|
||||
return_value={
|
||||
automation.DOMAIN: {
|
||||
'alias': 'bye',
|
||||
'trigger': {
|
||||
'platform': 'event',
|
||||
'event_type': 'test_event2',
|
||||
},
|
||||
'action': {
|
||||
'service': 'test.automation',
|
||||
'data_template': {
|
||||
'event': '{{ trigger.event.event_type }}'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
def test_reload_config_service(self, mock_load_yaml):
|
||||
"""Test the reload config service."""
|
||||
assert setup_component(self.hass, automation.DOMAIN, {
|
||||
@@ -443,9 +444,8 @@ class TestAutomation(unittest.TestCase):
|
||||
assert len(self.calls) == 2
|
||||
assert self.calls[1].data.get('event') == 'test_event2'
|
||||
|
||||
@patch('homeassistant.config.load_yaml_config_file', return_value={
|
||||
automation.DOMAIN: 'not valid',
|
||||
})
|
||||
@patch('homeassistant.config.load_yaml_config_file', autospec=True,
|
||||
return_value={automation.DOMAIN: 'not valid'})
|
||||
def test_reload_config_when_invalid_config(self, mock_load_yaml):
|
||||
"""Test the reload config service handling invalid config."""
|
||||
with assert_setup_component(1):
|
||||
|
||||
Reference in new issue
Block a user