mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 09:47:13 +00:00
Make sure Ollama integration migration is clean (#147630)
This commit is contained in:
parent
bc607dd013
commit
85343a9f53
@ -133,6 +133,12 @@ async def async_migrate_integration(hass: HomeAssistant) -> None:
|
||||
device.id,
|
||||
remove_config_entry_id=entry.entry_id,
|
||||
)
|
||||
else:
|
||||
device_registry.async_update_device(
|
||||
device.id,
|
||||
remove_config_entry_id=entry.entry_id,
|
||||
remove_config_subentry_id=None,
|
||||
)
|
||||
|
||||
if not use_existing:
|
||||
await hass.config_entries.async_remove(entry.entry_id)
|
||||
|
@ -109,6 +109,10 @@ async def test_migration_from_v1_to_v2(
|
||||
)
|
||||
assert migrated_device.identifiers == {(DOMAIN, subentry.subentry_id)}
|
||||
assert migrated_device.id == device.id
|
||||
assert migrated_device.config_entries == {mock_config_entry.entry_id}
|
||||
assert migrated_device.config_entries_subentries == {
|
||||
mock_config_entry.entry_id: {subentry.subentry_id}
|
||||
}
|
||||
|
||||
|
||||
async def test_migration_from_v1_to_v2_with_multiple_urls(
|
||||
@ -193,6 +197,8 @@ async def test_migration_from_v1_to_v2_with_multiple_urls(
|
||||
identifiers={(DOMAIN, list(entry.subentries.values())[0].subentry_id)}
|
||||
)
|
||||
assert dev is not None
|
||||
assert dev.config_entries == {entry.entry_id}
|
||||
assert dev.config_entries_subentries == {entry.entry_id: {subentry.subentry_id}}
|
||||
|
||||
|
||||
async def test_migration_from_v1_to_v2_with_same_urls(
|
||||
@ -285,3 +291,7 @@ async def test_migration_from_v1_to_v2_with_same_urls(
|
||||
identifiers={(DOMAIN, subentry.subentry_id)}
|
||||
)
|
||||
assert dev is not None
|
||||
assert dev.config_entries == {mock_config_entry.entry_id}
|
||||
assert dev.config_entries_subentries == {
|
||||
mock_config_entry.entry_id: {subentry.subentry_id}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user