diff --git a/tests/components/conftest.py b/tests/components/conftest.py index d5ab6364951..763dbb1d002 100644 --- a/tests/components/conftest.py +++ b/tests/components/conftest.py @@ -15,6 +15,7 @@ from homeassistant.config_entries import ( DISCOVERY_SOURCES, ConfigEntriesFlowManager, FlowResult, + OptionsFlowManager, ) from homeassistant.const import STATE_OFF, STATE_ON from homeassistant.core import HomeAssistant @@ -529,6 +530,9 @@ def check_config_translations(ignore_translations: str | list[str]) -> Generator if isinstance(self, ConfigEntriesFlowManager): category = "config" component = flow.handler + elif isinstance(self, OptionsFlowManager): + category = "options" + component = flow.hass.config_entries.async_get_entry(flow.handler).domain else: return result diff --git a/tests/components/homeassistant_hardware/test_config_flow_failures.py b/tests/components/homeassistant_hardware/test_config_flow_failures.py index ca40d46a437..5a6f765c44c 100644 --- a/tests/components/homeassistant_hardware/test_config_flow_failures.py +++ b/tests/components/homeassistant_hardware/test_config_flow_failures.py @@ -526,6 +526,10 @@ async def test_config_flow_thread_flasher_uninstall_fails(hass: HomeAssistant) - assert result["step_id"] == "confirm_otbr" +@pytest.mark.parametrize( + "ignore_translations", + ["component.test_firmware_domain.options.abort.zha_still_using_stick"], +) async def test_options_flow_zigbee_to_thread_zha_configured( hass: HomeAssistant, ) -> None: @@ -563,6 +567,10 @@ async def test_options_flow_zigbee_to_thread_zha_configured( assert result["reason"] == "zha_still_using_stick" +@pytest.mark.parametrize( + "ignore_translations", + ["component.test_firmware_domain.options.abort.otbr_still_using_stick"], +) async def test_options_flow_thread_to_zigbee_otbr_configured( hass: HomeAssistant, ) -> None: diff --git a/tests/components/homeassistant_hardware/test_silabs_multiprotocol_addon.py b/tests/components/homeassistant_hardware/test_silabs_multiprotocol_addon.py index e06110bb780..b91403c74c2 100644 --- a/tests/components/homeassistant_hardware/test_silabs_multiprotocol_addon.py +++ b/tests/components/homeassistant_hardware/test_silabs_multiprotocol_addon.py @@ -453,6 +453,10 @@ async def test_option_flow_install_multi_pan_addon_zha_other_radio( } +@pytest.mark.parametrize( + "ignore_translations", + ["component.test.options.abort.not_hassio"], +) async def test_option_flow_non_hassio( hass: HomeAssistant, ) -> None: @@ -765,6 +769,10 @@ async def test_option_flow_addon_installed_same_device_do_not_uninstall_multi_pa assert result["type"] is FlowResultType.CREATE_ENTRY +@pytest.mark.parametrize( + "ignore_translations", + ["component.test.options.abort.addon_already_running"], +) async def test_option_flow_flasher_already_running_failure( hass: HomeAssistant, addon_info, @@ -876,6 +884,10 @@ async def test_option_flow_addon_installed_same_device_flasher_already_installed assert result["type"] is FlowResultType.CREATE_ENTRY +@pytest.mark.parametrize( + "ignore_translations", + ["component.test.options.abort.addon_install_failed"], +) async def test_option_flow_flasher_install_failure( hass: HomeAssistant, addon_info, @@ -942,6 +954,10 @@ async def test_option_flow_flasher_install_failure( assert result["reason"] == "addon_install_failed" +@pytest.mark.parametrize( + "ignore_translations", + ["component.test.options.abort.addon_start_failed"], +) async def test_option_flow_flasher_addon_flash_failure( hass: HomeAssistant, addon_info, @@ -1004,6 +1020,10 @@ async def test_option_flow_flasher_addon_flash_failure( assert result["description_placeholders"]["addon_name"] == "Silicon Labs Flasher" +@pytest.mark.parametrize( + "ignore_translations", + ["component.test.options.abort.zha_migration_failed"], +) @patch( "homeassistant.components.zha.radio_manager.ZhaMultiPANMigrationHelper.async_initiate_migration", side_effect=Exception("Boom!"), @@ -1065,6 +1085,10 @@ async def test_option_flow_uninstall_migration_initiate_failure( mock_initiate_migration.assert_called_once() +@pytest.mark.parametrize( + "ignore_translations", + ["component.test.options.abort.zha_migration_failed"], +) @patch( "homeassistant.components.zha.radio_manager.ZhaMultiPANMigrationHelper.async_finish_migration", side_effect=Exception("Boom!"), @@ -1166,6 +1190,10 @@ async def test_option_flow_do_not_install_multi_pan_addon( assert result["type"] is FlowResultType.CREATE_ENTRY +@pytest.mark.parametrize( + "ignore_translations", + ["component.test.options.abort.addon_install_failed"], +) async def test_option_flow_install_multi_pan_addon_install_fails( hass: HomeAssistant, addon_store_info, @@ -1209,6 +1237,10 @@ async def test_option_flow_install_multi_pan_addon_install_fails( assert result["reason"] == "addon_install_failed" +@pytest.mark.parametrize( + "ignore_translations", + ["component.test.options.abort.addon_start_failed"], +) async def test_option_flow_install_multi_pan_addon_start_fails( hass: HomeAssistant, addon_store_info, @@ -1271,6 +1303,10 @@ async def test_option_flow_install_multi_pan_addon_start_fails( assert result["reason"] == "addon_start_failed" +@pytest.mark.parametrize( + "ignore_translations", + ["component.test.options.abort.addon_set_config_failed"], +) async def test_option_flow_install_multi_pan_addon_set_options_fails( hass: HomeAssistant, addon_store_info, @@ -1314,6 +1350,10 @@ async def test_option_flow_install_multi_pan_addon_set_options_fails( assert result["reason"] == "addon_set_config_failed" +@pytest.mark.parametrize( + "ignore_translations", + ["component.test.options.abort.addon_info_failed"], +) async def test_option_flow_addon_info_fails( hass: HomeAssistant, addon_store_info, @@ -1337,6 +1377,10 @@ async def test_option_flow_addon_info_fails( assert result["reason"] == "addon_info_failed" +@pytest.mark.parametrize( + "ignore_translations", + ["component.test.options.abort.zha_migration_failed"], +) @patch( "homeassistant.components.zha.radio_manager.ZhaMultiPANMigrationHelper.async_initiate_migration", side_effect=Exception("Boom!"), @@ -1392,6 +1436,10 @@ async def test_option_flow_install_multi_pan_addon_zha_migration_fails_step_1( set_addon_options.assert_not_called() +@pytest.mark.parametrize( + "ignore_translations", + ["component.test.options.abort.zha_migration_failed"], +) @patch( "homeassistant.components.zha.radio_manager.ZhaMultiPANMigrationHelper.async_finish_migration", side_effect=Exception("Boom!"), diff --git a/tests/components/hyperion/test_config_flow.py b/tests/components/hyperion/test_config_flow.py index 4109fe0f653..d4436079df1 100644 --- a/tests/components/hyperion/test_config_flow.py +++ b/tests/components/hyperion/test_config_flow.py @@ -9,6 +9,7 @@ from typing import Any from unittest.mock import AsyncMock, Mock, patch from hyperion import const +import pytest from homeassistant.components import ssdp from homeassistant.components.hyperion.const import ( @@ -823,6 +824,10 @@ async def test_options_effect_show_list(hass: HomeAssistant) -> None: assert result["data"][CONF_EFFECT_HIDE_LIST] == ["effect2"] +@pytest.mark.parametrize( # Remove when translations fixed + "ignore_translations", + ["component.hyperion.options.abort.cannot_connect"], +) async def test_options_effect_hide_list_cannot_connect(hass: HomeAssistant) -> None: """Check an options flow effect hide list with a failed connection.""" diff --git a/tests/components/onewire/test_config_flow.py b/tests/components/onewire/test_config_flow.py index c147a522a59..c554624267d 100644 --- a/tests/components/onewire/test_config_flow.py +++ b/tests/components/onewire/test_config_flow.py @@ -253,6 +253,10 @@ async def test_user_options_set_multiple( ) +@pytest.mark.parametrize( # Remove when translations fixed + "ignore_translations", + ["component.onewire.options.abort.No configurable devices found."], +) async def test_user_options_no_devices( hass: HomeAssistant, config_entry: ConfigEntry ) -> None: