Ensure hue tests add config entry before updating it (#110428)
This commit is contained in:
parent
a51ecd0614
commit
704ad67917
2 changed files with 3 additions and 1 deletions
|
@ -178,10 +178,10 @@ async def setup_bridge(hass: HomeAssistant, mock_bridge_v1):
|
|||
"""Load the Hue light platform with the provided bridge."""
|
||||
hass.config.components.add(hue.DOMAIN)
|
||||
config_entry = create_config_entry()
|
||||
config_entry.add_to_hass(hass)
|
||||
hass.config_entries.async_update_entry(
|
||||
config_entry, options={CONF_ALLOW_HUE_GROUPS: True}
|
||||
)
|
||||
config_entry.add_to_hass(hass)
|
||||
config_entry.mock_state(hass, ConfigEntryState.LOADED)
|
||||
mock_bridge_v1.config_entry = config_entry
|
||||
hass.data[hue.DOMAIN] = {config_entry.entry_id: mock_bridge_v1}
|
||||
|
|
|
@ -14,6 +14,7 @@ async def test_migrate_api_key(hass: HomeAssistant) -> None:
|
|||
domain=hue.DOMAIN,
|
||||
data={"host": "0.0.0.0", "api_version": 2, "username": "abcdefgh"},
|
||||
)
|
||||
config_entry.add_to_hass(hass)
|
||||
await hue.migration.check_migration(hass, config_entry)
|
||||
# the username property should have been migrated to api_key
|
||||
assert config_entry.data == {
|
||||
|
@ -29,6 +30,7 @@ async def test_auto_switchover(hass: HomeAssistant) -> None:
|
|||
domain=hue.DOMAIN,
|
||||
data={"host": "0.0.0.0", "api_version": 1, "username": "abcdefgh"},
|
||||
)
|
||||
config_entry.add_to_hass(hass)
|
||||
|
||||
with patch.object(hue.migration, "is_v2_bridge", retun_value=True), patch.object(
|
||||
hue.migration, "handle_v2_migration"
|
||||
|
|
Loading…
Add table
Reference in a new issue