From a573f6094755bc9b991f07c96bd33e6a2e2eb320 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Mon, 20 Nov 2023 13:02:44 +0100 Subject: [PATCH] Rename some check_config test cases (#104244) --- tests/helpers/test_check_config.py | 44 +++++++++++++++--------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/helpers/test_check_config.py b/tests/helpers/test_check_config.py index b83f423e312..5e5343fd43e 100644 --- a/tests/helpers/test_check_config.py +++ b/tests/helpers/test_check_config.py @@ -103,8 +103,8 @@ async def test_config_platform_valid(hass: HomeAssistant) -> None: _assert_warnings_errors(res, [], []) -async def test_component_platform_not_found(hass: HomeAssistant) -> None: - """Test errors if component or platform not found.""" +async def test_integration_not_found(hass: HomeAssistant) -> None: + """Test errors if integration not found.""" # Make sure they don't exist files = {YAML_CONFIG_FILE: BASE_CONFIG + "beer:"} with patch("os.path.isfile", return_value=True), patch_yaml_files(files): @@ -118,8 +118,8 @@ async def test_component_platform_not_found(hass: HomeAssistant) -> None: _assert_warnings_errors(res, [warning], []) -async def test_component_requirement_not_found(hass: HomeAssistant) -> None: - """Test errors if component with a requirement not found not found.""" +async def test_integrationt_requirement_not_found(hass: HomeAssistant) -> None: + """Test errors if integration with a requirement not found not found.""" # Make sure they don't exist files = {YAML_CONFIG_FILE: BASE_CONFIG + "test_custom_component:"} with patch( @@ -141,8 +141,8 @@ async def test_component_requirement_not_found(hass: HomeAssistant) -> None: _assert_warnings_errors(res, [warning], []) -async def test_component_not_found_recovery_mode(hass: HomeAssistant) -> None: - """Test no errors if component not found in recovery mode.""" +async def test_integration_not_found_recovery_mode(hass: HomeAssistant) -> None: + """Test no errors if integration not found in recovery mode.""" # Make sure they don't exist files = {YAML_CONFIG_FILE: BASE_CONFIG + "beer:"} hass.config.recovery_mode = True @@ -154,8 +154,8 @@ async def test_component_not_found_recovery_mode(hass: HomeAssistant) -> None: _assert_warnings_errors(res, [], []) -async def test_component_not_found_safe_mode(hass: HomeAssistant) -> None: - """Test no errors if component not found in safe mode.""" +async def test_integration_not_found_safe_mode(hass: HomeAssistant) -> None: + """Test no errors if integration not found in safe mode.""" # Make sure they don't exist files = {YAML_CONFIG_FILE: BASE_CONFIG + "beer:"} hass.config.safe_mode = True @@ -167,8 +167,8 @@ async def test_component_not_found_safe_mode(hass: HomeAssistant) -> None: _assert_warnings_errors(res, [], []) -async def test_component_import_error(hass: HomeAssistant) -> None: - """Test errors if component with a requirement not found not found.""" +async def test_integration_import_error(hass: HomeAssistant) -> None: + """Test errors if integration with a requirement not found not found.""" # Make sure they don't exist files = {YAML_CONFIG_FILE: BASE_CONFIG + "light:"} with patch( @@ -188,19 +188,19 @@ async def test_component_import_error(hass: HomeAssistant) -> None: @pytest.mark.parametrize( - ("component", "errors", "warnings", "message"), + ("integration", "errors", "warnings", "message"), [ ("frontend", 1, 0, "'blah' is an invalid option for 'frontend'"), ("http", 1, 0, "'blah' is an invalid option for 'http'"), ("logger", 0, 1, "'blah' is an invalid option for 'logger'"), ], ) -async def test_component_schema_error( - hass: HomeAssistant, component: str, errors: int, warnings: int, message: str +async def test_integration_schema_error( + hass: HomeAssistant, integration: str, errors: int, warnings: int, message: str ) -> None: - """Test schema error in component.""" + """Test schema error in integration.""" # Make sure they don't exist - files = {YAML_CONFIG_FILE: BASE_CONFIG + f"frontend:\n{component}:\n blah:"} + files = {YAML_CONFIG_FILE: BASE_CONFIG + f"frontend:\n{integration}:\n blah:"} hass.config.safe_mode = True with patch("os.path.isfile", return_value=True), patch_yaml_files(files): res = await async_check_ha_config_file(hass) @@ -215,8 +215,8 @@ async def test_component_schema_error( assert message in warn.message -async def test_component_platform_not_found_2(hass: HomeAssistant) -> None: - """Test errors if component or platform not found.""" +async def test_platform_not_found(hass: HomeAssistant) -> None: + """Test errors if platform not found.""" # Make sure they don't exist files = {YAML_CONFIG_FILE: BASE_CONFIG + "light:\n platform: beer"} with patch("os.path.isfile", return_value=True), patch_yaml_files(files): @@ -293,14 +293,14 @@ async def test_platform_not_found_safe_mode(hass: HomeAssistant) -> None: ), ], ) -async def test_component_platform_schema_error( +async def test_platform_schema_error( hass: HomeAssistant, extra_config: str, warnings: int, message: str | None, config: dict | None, ) -> None: - """Test schema error in component.""" + """Test schema error in platform.""" comp_platform_schema = cv.PLATFORM_SCHEMA.extend({vol.Remove("old"): str}) comp_platform_schema_base = comp_platform_schema.extend({}, extra=vol.ALLOW_EXTRA) mock_integration( @@ -328,7 +328,7 @@ async def test_component_platform_schema_error( assert warn.config == config -async def test_component_config_platform_import_error(hass: HomeAssistant) -> None: +async def test_config_platform_import_error(hass: HomeAssistant) -> None: """Test errors if config platform fails to import.""" # Make sure they don't exist files = {YAML_CONFIG_FILE: BASE_CONFIG + "light:\n platform: beer"} @@ -348,8 +348,8 @@ async def test_component_config_platform_import_error(hass: HomeAssistant) -> No _assert_warnings_errors(res, [], [error]) -async def test_component_platform_import_error(hass: HomeAssistant) -> None: - """Test errors if component or platform not found.""" +async def test_platform_import_error(hass: HomeAssistant) -> None: + """Test errors if platform not found.""" # Make sure they don't exist files = {YAML_CONFIG_FILE: BASE_CONFIG + "light:\n platform: demo"} with patch(