Update enphase_envoy test_init to use str for unique_id and test for loaded config entry (#133810)

This commit is contained in:
Arie Catsman 2025-01-08 20:06:51 +01:00 committed by GitHub
parent d2a188ad3c
commit f05cffea17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 8 deletions

View File

@ -60,11 +60,7 @@ rules:
status: done
comment: pending https://github.com/home-assistant/core/pull/132373
reauthentication-flow: done
test-coverage:
status: todo
comment: |
- test_config_different_unique_id -> unique_id set to the mock config entry is an int, not a str
- Apart from the coverage, test_option_change_reload does not verify that the config entry is reloaded
test-coverage: done
# Gold
devices: done

View File

@ -263,7 +263,7 @@ async def test_config_different_unique_id(
domain=DOMAIN,
entry_id="45a36e55aaddb2007c5f6602e0c38e72",
title="Envoy 1234",
unique_id=4321,
unique_id="4321",
data={
CONF_HOST: "1.1.1.1",
CONF_NAME: "Envoy 1234",
@ -346,8 +346,10 @@ async def test_option_change_reload(
await setup_integration(hass, config_entry)
await hass.async_block_till_done(wait_background_tasks=True)
assert config_entry.state is ConfigEntryState.LOADED
# By default neither option is available
assert config_entry.options == {}
# option change will take care of COV of init::async_reload_entry
# option change will also take care of COV of init::async_reload_entry
hass.config_entries.async_update_entry(
config_entry,
options={
@ -355,8 +357,23 @@ async def test_option_change_reload(
OPTION_DISABLE_KEEP_ALIVE: True,
},
)
await hass.async_block_till_done()
await hass.async_block_till_done(wait_background_tasks=True)
assert config_entry.state is ConfigEntryState.LOADED
assert config_entry.options == {
OPTION_DIAGNOSTICS_INCLUDE_FIXTURES: False,
OPTION_DISABLE_KEEP_ALIVE: True,
}
# flip em
hass.config_entries.async_update_entry(
config_entry,
options={
OPTION_DIAGNOSTICS_INCLUDE_FIXTURES: True,
OPTION_DISABLE_KEEP_ALIVE: False,
},
)
await hass.async_block_till_done(wait_background_tasks=True)
assert config_entry.state is ConfigEntryState.LOADED
assert config_entry.options == {
OPTION_DIAGNOSTICS_INCLUDE_FIXTURES: True,
OPTION_DISABLE_KEEP_ALIVE: False,
}