Migrate smartthings to use async_update_entry to alter config entries (#110403)

This commit is contained in:
J. Nick Koston 2024-02-12 14:24:45 -06:00 committed by GitHub
parent db9c08b2e0
commit c3d9192384
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -32,8 +32,8 @@ async def test_migration_creates_new_flow(
) -> None:
"""Test migration deletes app and creates new flow."""
config_entry.version = 1
config_entry.add_to_hass(hass)
hass.config_entries.async_update_entry(config_entry, version=1)
await smartthings.async_migrate_entry(hass, config_entry)
await hass.async_block_till_done()
@ -409,6 +409,7 @@ async def test_broker_regenerates_token(hass: HomeAssistant, config_entry) -> No
token = Mock(OAuthToken)
token.refresh_token = str(uuid4())
stored_action = None
config_entry.add_to_hass(hass)
def async_track_time_interval(hass, action, interval):
nonlocal stored_action
@ -455,10 +456,14 @@ async def test_event_handler_dispatches_updated_devices(
data={"codeId": "1"},
)
request = event_request_factory(device_ids=device_ids, events=[event])
config_entry.data = {
**config_entry.data,
CONF_INSTALLED_APP_ID: request.installed_app_id,
}
config_entry.add_to_hass(hass)
hass.config_entries.async_update_entry(
config_entry,
data={
**config_entry.data,
CONF_INSTALLED_APP_ID: request.installed_app_id,
},
)
called = False
def signal(ids):
@ -520,10 +525,14 @@ async def test_event_handler_fires_button_events(
device.device_id, capability="button", attribute="button", value="pushed"
)
request = event_request_factory(events=[event])
config_entry.data = {
**config_entry.data,
CONF_INSTALLED_APP_ID: request.installed_app_id,
}
config_entry.add_to_hass(hass)
hass.config_entries.async_update_entry(
config_entry,
data={
**config_entry.data,
CONF_INSTALLED_APP_ID: request.installed_app_id,
},
)
called = False
def handler(evt):