mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 22:37:11 +00:00
Make sure Google Generative AI integration migration is clean (#147625)
This commit is contained in:
parent
4bdf3d6f30
commit
1b2be083c2
@ -284,6 +284,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)
|
||||
|
@ -512,6 +512,10 @@ async def test_migration_from_v1_to_v2(
|
||||
)
|
||||
assert device.identifiers == {(DOMAIN, subentry.subentry_id)}
|
||||
assert device.id == device_1.id
|
||||
assert device.config_entries == {mock_config_entry.entry_id}
|
||||
assert device.config_entries_subentries == {
|
||||
mock_config_entry.entry_id: {subentry.subentry_id}
|
||||
}
|
||||
|
||||
subentry = conversation_subentries[1]
|
||||
|
||||
@ -531,6 +535,10 @@ async def test_migration_from_v1_to_v2(
|
||||
)
|
||||
assert device.identifiers == {(DOMAIN, subentry.subentry_id)}
|
||||
assert device.id == device_2.id
|
||||
assert device.config_entries == {mock_config_entry.entry_id}
|
||||
assert device.config_entries_subentries == {
|
||||
mock_config_entry.entry_id: {subentry.subentry_id}
|
||||
}
|
||||
|
||||
|
||||
async def test_migration_from_v1_to_v2_with_multiple_keys(
|
||||
@ -626,6 +634,10 @@ async def test_migration_from_v1_to_v2_with_multiple_keys(
|
||||
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: {list(entry.subentries.values())[0].subentry_id}
|
||||
}
|
||||
|
||||
|
||||
async def test_migration_from_v1_to_v2_with_same_keys(
|
||||
@ -743,6 +755,10 @@ async def test_migration_from_v1_to_v2_with_same_keys(
|
||||
)
|
||||
assert device.identifiers == {(DOMAIN, subentry.subentry_id)}
|
||||
assert device.id == device_1.id
|
||||
assert device.config_entries == {mock_config_entry.entry_id}
|
||||
assert device.config_entries_subentries == {
|
||||
mock_config_entry.entry_id: {subentry.subentry_id}
|
||||
}
|
||||
|
||||
subentry = conversation_subentries[1]
|
||||
|
||||
@ -762,6 +778,10 @@ async def test_migration_from_v1_to_v2_with_same_keys(
|
||||
)
|
||||
assert device.identifiers == {(DOMAIN, subentry.subentry_id)}
|
||||
assert device.id == device_2.id
|
||||
assert device.config_entries == {mock_config_entry.entry_id}
|
||||
assert device.config_entries_subentries == {
|
||||
mock_config_entry.entry_id: {subentry.subentry_id}
|
||||
}
|
||||
|
||||
|
||||
async def test_devices(
|
||||
|
Loading…
x
Reference in New Issue
Block a user