Fix custom account config flow setup (#127750)

This commit is contained in:
Ricardo Marques 2024-10-08 16:44:59 +01:00 committed by Franck Nijhof
parent 5da3ca4bb1
commit 46d9ac8380
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
3 changed files with 4 additions and 3 deletions

View File

@ -32,7 +32,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
client_session=async_get_clientsession(hass),
)
if custom_account := entry.data.get(CONF_ACCOUNT) is not None:
if (custom_account := entry.data.get(CONF_ACCOUNT)) is not None:
client.custom_account_id = custom_account
try:
@ -49,7 +49,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def async_update_data() -> OVODailyUsage:
"""Fetch data from OVO Energy."""
if custom_account := entry.data.get(CONF_ACCOUNT) is not None:
if (custom_account := entry.data.get(CONF_ACCOUNT)) is not None:
client.custom_account_id = custom_account
async with asyncio.timeout(10):

View File

@ -46,7 +46,7 @@ class OVOEnergyFlowHandler(ConfigFlow, domain=DOMAIN):
client_session=async_get_clientsession(self.hass),
)
if custom_account := user_input.get(CONF_ACCOUNT) is not None:
if (custom_account := user_input.get(CONF_ACCOUNT)) is not None:
client.custom_account_id = custom_account
try:

View File

@ -117,6 +117,7 @@ async def test_full_flow_implementation(hass: HomeAssistant) -> None:
assert result2["type"] is FlowResultType.CREATE_ENTRY
assert result2["data"][CONF_USERNAME] == FIXTURE_USER_INPUT[CONF_USERNAME]
assert result2["data"][CONF_PASSWORD] == FIXTURE_USER_INPUT[CONF_PASSWORD]
assert result2["data"][CONF_ACCOUNT] == FIXTURE_USER_INPUT[CONF_ACCOUNT]
async def test_reauth_authorization_error(hass: HomeAssistant) -> None: