Continue on invalid platforms and new setup_component unit tests (#3736)
This commit is contained in:
parent
1b26b5ad14
commit
7b40a641ec
23 changed files with 842 additions and 672 deletions
|
@ -89,14 +89,18 @@ class TestCheckConfig(unittest.TestCase):
|
|||
with patch_yaml_files(files):
|
||||
res = check_config.check(get_test_config_dir('platform.yaml'))
|
||||
change_yaml_files(res)
|
||||
self.assertDictEqual({
|
||||
'components': {'mqtt': {'keepalive': 60, 'port': 1883,
|
||||
'protocol': '3.1.1'}},
|
||||
'except': {'light.mqtt_json': {'platform': 'mqtt_json'}},
|
||||
'secret_cache': {},
|
||||
'secrets': {},
|
||||
'yaml_files': ['.../platform.yaml']
|
||||
}, res)
|
||||
self.assertDictEqual(
|
||||
{'mqtt': {'keepalive': 60, 'port': 1883, 'protocol': '3.1.1'},
|
||||
'light': []},
|
||||
res['components']
|
||||
)
|
||||
self.assertDictEqual(
|
||||
{'light.mqtt_json': {'platform': 'mqtt_json'}},
|
||||
res['except']
|
||||
)
|
||||
self.assertDictEqual({}, res['secret_cache'])
|
||||
self.assertDictEqual({}, res['secrets'])
|
||||
self.assertListEqual(['.../platform.yaml'], res['yaml_files'])
|
||||
|
||||
def test_component_platform_not_found(self, mock_get_loop):
|
||||
"""Test errors if component or platform not found."""
|
||||
|
@ -107,25 +111,23 @@ class TestCheckConfig(unittest.TestCase):
|
|||
with patch_yaml_files(files):
|
||||
res = check_config.check(get_test_config_dir('badcomponent.yaml'))
|
||||
change_yaml_files(res)
|
||||
self.assertDictEqual({
|
||||
'components': {},
|
||||
'except': {check_config.ERROR_STR:
|
||||
['Component not found: beer']},
|
||||
'secret_cache': {},
|
||||
'secrets': {},
|
||||
'yaml_files': ['.../badcomponent.yaml']
|
||||
}, res)
|
||||
self.assertDictEqual({}, res['components'])
|
||||
self.assertDictEqual({check_config.ERROR_STR:
|
||||
['Component not found: beer']},
|
||||
res['except'])
|
||||
self.assertDictEqual({}, res['secret_cache'])
|
||||
self.assertDictEqual({}, res['secrets'])
|
||||
self.assertListEqual(['.../badcomponent.yaml'], res['yaml_files'])
|
||||
|
||||
res = check_config.check(get_test_config_dir('badplatform.yaml'))
|
||||
change_yaml_files(res)
|
||||
self.assertDictEqual({
|
||||
'components': {},
|
||||
'except': {check_config.ERROR_STR:
|
||||
['Platform not found: light.beer']},
|
||||
'secret_cache': {},
|
||||
'secrets': {},
|
||||
'yaml_files': ['.../badplatform.yaml']
|
||||
}, res)
|
||||
self.assertDictEqual({'light': []}, res['components'])
|
||||
self.assertDictEqual({check_config.ERROR_STR:
|
||||
['Platform not found: light.beer']},
|
||||
res['except'])
|
||||
self.assertDictEqual({}, res['secret_cache'])
|
||||
self.assertDictEqual({}, res['secrets'])
|
||||
self.assertListEqual(['.../badplatform.yaml'], res['yaml_files'])
|
||||
|
||||
def test_secrets(self, mock_get_loop):
|
||||
"""Test secrets config checking method."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue