mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Small improvement of config tests (#104243)
* Small improvement of config tests * Update snapshots
This commit is contained in:
parent
a573f60947
commit
124e1cebac
@ -133,14 +133,6 @@
|
|||||||
Invalid config for 'iot_domain.non_adr_0007' at iot_domain/iot_domain_5.yaml, line 7: expected str for dictionary value 'option2', got 123
|
Invalid config for 'iot_domain.non_adr_0007' at iot_domain/iot_domain_5.yaml, line 7: expected str for dictionary value 'option2', got 123
|
||||||
''',
|
''',
|
||||||
}),
|
}),
|
||||||
dict({
|
|
||||||
'has_exc_info': True,
|
|
||||||
'message': "Invalid config for 'custom_validator_bad_1' at configuration.yaml, line 1: broken",
|
|
||||||
}),
|
|
||||||
dict({
|
|
||||||
'has_exc_info': True,
|
|
||||||
'message': 'Unknown error calling custom_validator_bad_2 config validator',
|
|
||||||
}),
|
|
||||||
])
|
])
|
||||||
# ---
|
# ---
|
||||||
# name: test_component_config_validation_error[include_dir_merge_list]
|
# name: test_component_config_validation_error[include_dir_merge_list]
|
||||||
@ -165,14 +157,6 @@
|
|||||||
Invalid config for 'iot_domain.non_adr_0007' at iot_domain/iot_domain_2.yaml, line 14: expected str for dictionary value 'option2', got 123
|
Invalid config for 'iot_domain.non_adr_0007' at iot_domain/iot_domain_2.yaml, line 14: expected str for dictionary value 'option2', got 123
|
||||||
''',
|
''',
|
||||||
}),
|
}),
|
||||||
dict({
|
|
||||||
'has_exc_info': True,
|
|
||||||
'message': "Invalid config for 'custom_validator_bad_1' at configuration.yaml, line 1: broken",
|
|
||||||
}),
|
|
||||||
dict({
|
|
||||||
'has_exc_info': True,
|
|
||||||
'message': 'Unknown error calling custom_validator_bad_2 config validator',
|
|
||||||
}),
|
|
||||||
])
|
])
|
||||||
# ---
|
# ---
|
||||||
# name: test_component_config_validation_error[packages]
|
# name: test_component_config_validation_error[packages]
|
||||||
@ -233,26 +217,6 @@
|
|||||||
# ---
|
# ---
|
||||||
# name: test_component_config_validation_error[packages_include_dir_named]
|
# name: test_component_config_validation_error[packages_include_dir_named]
|
||||||
list([
|
list([
|
||||||
dict({
|
|
||||||
'has_exc_info': False,
|
|
||||||
'message': "Invalid config for 'iot_domain' at integrations/iot_domain.yaml, line 6: required key 'platform' not provided",
|
|
||||||
}),
|
|
||||||
dict({
|
|
||||||
'has_exc_info': False,
|
|
||||||
'message': "Invalid config for 'iot_domain.non_adr_0007' at integrations/iot_domain.yaml, line 9: expected str for dictionary value 'option1', got 123",
|
|
||||||
}),
|
|
||||||
dict({
|
|
||||||
'has_exc_info': False,
|
|
||||||
'message': "Invalid config for 'iot_domain.non_adr_0007' at integrations/iot_domain.yaml, line 12: 'no_such_option' is an invalid option for 'iot_domain.non_adr_0007', check: no_such_option",
|
|
||||||
}),
|
|
||||||
dict({
|
|
||||||
'has_exc_info': False,
|
|
||||||
'message': '''
|
|
||||||
Invalid config for 'iot_domain.non_adr_0007' at integrations/iot_domain.yaml, line 18: required key 'option1' not provided
|
|
||||||
Invalid config for 'iot_domain.non_adr_0007' at integrations/iot_domain.yaml, line 19: 'no_such_option' is an invalid option for 'iot_domain.non_adr_0007', check: no_such_option
|
|
||||||
Invalid config for 'iot_domain.non_adr_0007' at integrations/iot_domain.yaml, line 20: expected str for dictionary value 'option2', got 123
|
|
||||||
''',
|
|
||||||
}),
|
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': False,
|
'has_exc_info': False,
|
||||||
'message': "Invalid config for 'adr_0007_2' at integrations/adr_0007_2.yaml, line 2: required key 'host' not provided",
|
'message': "Invalid config for 'adr_0007_2' at integrations/adr_0007_2.yaml, line 2: required key 'host' not provided",
|
||||||
@ -273,10 +237,6 @@
|
|||||||
Invalid config for 'adr_0007_5' at integrations/adr_0007_5.yaml, line 7: expected int for dictionary value 'adr_0007_5->port', got 'foo'
|
Invalid config for 'adr_0007_5' at integrations/adr_0007_5.yaml, line 7: expected int for dictionary value 'adr_0007_5->port', got 'foo'
|
||||||
''',
|
''',
|
||||||
}),
|
}),
|
||||||
dict({
|
|
||||||
'has_exc_info': False,
|
|
||||||
'message': "Invalid config for 'custom_validator_ok_2' at integrations/custom_validator_ok_2.yaml, line 2: required key 'host' not provided",
|
|
||||||
}),
|
|
||||||
dict({
|
dict({
|
||||||
'has_exc_info': True,
|
'has_exc_info': True,
|
||||||
'message': "Invalid config for 'custom_validator_bad_1' at integrations/custom_validator_bad_1.yaml, line 2: broken",
|
'message': "Invalid config for 'custom_validator_bad_1' at integrations/custom_validator_bad_1.yaml, line 2: broken",
|
||||||
@ -285,6 +245,30 @@
|
|||||||
'has_exc_info': True,
|
'has_exc_info': True,
|
||||||
'message': 'Unknown error calling custom_validator_bad_2 config validator',
|
'message': 'Unknown error calling custom_validator_bad_2 config validator',
|
||||||
}),
|
}),
|
||||||
|
dict({
|
||||||
|
'has_exc_info': False,
|
||||||
|
'message': "Invalid config for 'custom_validator_ok_2' at integrations/custom_validator_ok_2.yaml, line 2: required key 'host' not provided",
|
||||||
|
}),
|
||||||
|
dict({
|
||||||
|
'has_exc_info': False,
|
||||||
|
'message': "Invalid config for 'iot_domain' at integrations/iot_domain.yaml, line 6: required key 'platform' not provided",
|
||||||
|
}),
|
||||||
|
dict({
|
||||||
|
'has_exc_info': False,
|
||||||
|
'message': "Invalid config for 'iot_domain.non_adr_0007' at integrations/iot_domain.yaml, line 9: expected str for dictionary value 'option1', got 123",
|
||||||
|
}),
|
||||||
|
dict({
|
||||||
|
'has_exc_info': False,
|
||||||
|
'message': "Invalid config for 'iot_domain.non_adr_0007' at integrations/iot_domain.yaml, line 12: 'no_such_option' is an invalid option for 'iot_domain.non_adr_0007', check: no_such_option",
|
||||||
|
}),
|
||||||
|
dict({
|
||||||
|
'has_exc_info': False,
|
||||||
|
'message': '''
|
||||||
|
Invalid config for 'iot_domain.non_adr_0007' at integrations/iot_domain.yaml, line 18: required key 'option1' not provided
|
||||||
|
Invalid config for 'iot_domain.non_adr_0007' at integrations/iot_domain.yaml, line 19: 'no_such_option' is an invalid option for 'iot_domain.non_adr_0007', check: no_such_option
|
||||||
|
Invalid config for 'iot_domain.non_adr_0007' at integrations/iot_domain.yaml, line 20: expected str for dictionary value 'option2', got 123
|
||||||
|
''',
|
||||||
|
}),
|
||||||
])
|
])
|
||||||
# ---
|
# ---
|
||||||
# name: test_component_config_validation_error_with_docs[basic]
|
# name: test_component_config_validation_error_with_docs[basic]
|
||||||
|
@ -1709,19 +1709,10 @@ async def test_component_config_validation_error(
|
|||||||
)
|
)
|
||||||
config = await config_util.async_hass_config_yaml(hass)
|
config = await config_util.async_hass_config_yaml(hass)
|
||||||
|
|
||||||
for domain in [
|
for domain_with_label in config:
|
||||||
"iot_domain",
|
integration = await async_get_integration(
|
||||||
"adr_0007_1",
|
hass, domain_with_label.partition(" ")[0]
|
||||||
"adr_0007_2",
|
)
|
||||||
"adr_0007_3",
|
|
||||||
"adr_0007_4",
|
|
||||||
"adr_0007_5",
|
|
||||||
"custom_validator_ok_1",
|
|
||||||
"custom_validator_ok_2",
|
|
||||||
"custom_validator_bad_1",
|
|
||||||
"custom_validator_bad_2",
|
|
||||||
]:
|
|
||||||
integration = await async_get_integration(hass, domain)
|
|
||||||
await config_util.async_process_component_config(
|
await config_util.async_process_component_config(
|
||||||
hass,
|
hass,
|
||||||
config,
|
config,
|
||||||
@ -1763,19 +1754,10 @@ async def test_component_config_validation_error_with_docs(
|
|||||||
)
|
)
|
||||||
config = await config_util.async_hass_config_yaml(hass)
|
config = await config_util.async_hass_config_yaml(hass)
|
||||||
|
|
||||||
for domain in [
|
for domain_with_label in config:
|
||||||
"iot_domain",
|
integration = await async_get_integration(
|
||||||
"adr_0007_1",
|
hass, domain_with_label.partition(" ")[0]
|
||||||
"adr_0007_2",
|
)
|
||||||
"adr_0007_3",
|
|
||||||
"adr_0007_4",
|
|
||||||
"adr_0007_5",
|
|
||||||
"custom_validator_ok_1",
|
|
||||||
"custom_validator_ok_2",
|
|
||||||
"custom_validator_bad_1",
|
|
||||||
"custom_validator_bad_2",
|
|
||||||
]:
|
|
||||||
integration = await async_get_integration(hass, domain)
|
|
||||||
await config_util.async_process_component_config(
|
await config_util.async_process_component_config(
|
||||||
hass,
|
hass,
|
||||||
config,
|
config,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user