mirror of
https://github.com/home-assistant/core.git
synced 2026-09-04 20:42:21 +01:00
reset integrations
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user