diff --git a/tests/snapshots/test_config.ambr b/tests/snapshots/test_config.ambr index 599964d0f4a..7438bda5cde 100644 --- a/tests/snapshots/test_config.ambr +++ b/tests/snapshots/test_config.ambr @@ -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 ''', }), - 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] @@ -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 ''', }), - 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] @@ -233,26 +217,6 @@ # --- # name: test_component_config_validation_error[packages_include_dir_named] 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({ 'has_exc_info': False, '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' ''', }), - 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': True, '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, '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] diff --git a/tests/test_config.py b/tests/test_config.py index 8d74d53c162..448990429a1 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1709,19 +1709,10 @@ async def test_component_config_validation_error( ) config = await config_util.async_hass_config_yaml(hass) - for domain in [ - "iot_domain", - "adr_0007_1", - "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) + for domain_with_label in config: + integration = await async_get_integration( + hass, domain_with_label.partition(" ")[0] + ) await config_util.async_process_component_config( hass, config, @@ -1763,19 +1754,10 @@ async def test_component_config_validation_error_with_docs( ) config = await config_util.async_hass_config_yaml(hass) - for domain in [ - "iot_domain", - "adr_0007_1", - "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) + for domain_with_label in config: + integration = await async_get_integration( + hass, domain_with_label.partition(" ")[0] + ) await config_util.async_process_component_config( hass, config,