mirror of
https://github.com/home-assistant/core.git
synced 2025-09-09 14:51:34 +02:00
Followup async_migrate_entry fix for Alexa Devices (#151231)
This commit is contained in:
@@ -5,7 +5,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import aiohttp_client, config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .const import _LOGGER, COUNTRY_DOMAINS, DOMAIN
|
||||
from .const import _LOGGER, CONF_LOGIN_DATA, COUNTRY_DOMAINS, DOMAIN
|
||||
from .coordinator import AmazonConfigEntry, AmazonDevicesCoordinator
|
||||
from .services import async_setup_services
|
||||
|
||||
@@ -51,9 +51,9 @@ async def async_migrate_entry(hass: HomeAssistant, entry: AmazonConfigEntry) ->
|
||||
country = entry.data[CONF_COUNTRY]
|
||||
domain = COUNTRY_DOMAINS.get(country, country)
|
||||
|
||||
# Save domain and remove country
|
||||
# Add site to login data
|
||||
new_data = entry.data.copy()
|
||||
new_data.update({"site": f"https://www.amazon.{domain}"})
|
||||
new_data[CONF_LOGIN_DATA]["site"] = f"https://www.amazon.{domain}"
|
||||
|
||||
hass.config_entries.async_update_entry(
|
||||
entry, data=new_data, version=1, minor_version=2
|
||||
|
@@ -58,4 +58,7 @@ async def test_migrate_entry(
|
||||
assert len(hass.config_entries.async_entries(DOMAIN)) == 1
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
assert config_entry.minor_version == 2
|
||||
assert config_entry.data["site"] == f"https://www.amazon.{TEST_COUNTRY}"
|
||||
assert (
|
||||
config_entry.data[CONF_LOGIN_DATA]["site"]
|
||||
== f"https://www.amazon.{TEST_COUNTRY}"
|
||||
)
|
||||
|
Reference in New Issue
Block a user