diff --git a/homeassistant/components/intellifire/__init__.py b/homeassistant/components/intellifire/__init__.py index 406a6fea9fda..8bc8f9921aef 100644 --- a/homeassistant/components/intellifire/__init__.py +++ b/homeassistant/components/intellifire/__init__.py @@ -17,11 +17,7 @@ from homeassistant.const import ( Platform, ) from homeassistant.core import HomeAssistant -from homeassistant.exceptions import ( - ConfigEntryAuthFailed, - ConfigEntryNotReady, - HomeAssistantError, -) +from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady from .const import ( API_MODE_LOCAL, @@ -93,9 +89,7 @@ async def async_migrate_entry( new_data = cloud_interface.user_data.get_data_for_ip(new[CONF_HOST]) if not new_data: - raise HomeAssistantError( - "Could not retrieve data for IP address from cloud interface" - ) + raise ConfigEntryAuthFailed new[CONF_API_KEY] = new_data.api_key new[CONF_WEB_CLIENT_ID] = new_data.web_client_id new[CONF_AUTH_COOKIE] = new_data.auth_cookie diff --git a/tests/components/trafikverket_train/test_init.py b/tests/components/trafikverket_train/test_init.py index 829fccf442a4..01df70bcd787 100644 --- a/tests/components/trafikverket_train/test_init.py +++ b/tests/components/trafikverket_train/test_init.py @@ -233,17 +233,15 @@ async def test_migrate_entry_from_future_version_fails( @pytest.mark.parametrize( - ("side_effect", "state"), + ("side_effect"), [ - (InvalidAuthentication, ConfigEntryState.MIGRATION_ERROR), - (NoTrainStationFound, ConfigEntryState.MIGRATION_ERROR), - (UnknownError, ConfigEntryState.MIGRATION_ERROR), - (Exception, ConfigEntryState.MIGRATION_ERROR), + (InvalidAuthentication), + (NoTrainStationFound), + (UnknownError), + (Exception), ], ) -async def test_migrate_entry_fails( - hass: HomeAssistant, side_effect: type[Exception], state: ConfigEntryState -) -> None: +async def test_migrate_entry_fails(hass: HomeAssistant, side_effect: Exception) -> None: """Test migrate entry fails.""" entry = MockConfigEntry( domain=DOMAIN, @@ -265,7 +263,7 @@ async def test_migrate_entry_fails( await hass.config_entries.async_setup(entry.entry_id) await hass.async_block_till_done() - assert entry.state is state + assert entry.state is ConfigEntryState.MIGRATION_ERROR async def test_migrate_entry_fails_multiple_stations(