From 7fe7b111cbdcc83cd6e6b6b2741cb6ec7972d448 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Wed, 14 Oct 2026 16:52:33 +0200 Subject: [PATCH] Use MockConfigEntry flow helpers in OpenEVSE tests (#186454) Co-authored-by: Claude --- tests/components/openevse/test_config_flow.py | 36 ++++--------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/tests/components/openevse/test_config_flow.py b/tests/components/openevse/test_config_flow.py index 7d3ef419686d..22edbd55821d 100644 --- a/tests/components/openevse/test_config_flow.py +++ b/tests/components/openevse/test_config_flow.py @@ -7,11 +7,7 @@ from openevsehttp.exceptions import AuthenticationError, MissingSerial import pytest from homeassistant.components.openevse.const import DOMAIN -from homeassistant.config_entries import ( - SOURCE_RECONFIGURE, - SOURCE_USER, - SOURCE_ZEROCONF, -) +from homeassistant.config_entries import SOURCE_USER, SOURCE_ZEROCONF from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME from homeassistant.core import HomeAssistant from homeassistant.data_entry_flow import FlowResultType @@ -504,10 +500,7 @@ async def test_reconfigure_flow_host_only( ) config_entry.add_to_hass(hass) - result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_RECONFIGURE, "entry_id": config_entry.entry_id}, - ) + result = await config_entry.start_reconfigure_flow(hass) assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reconfigure" @@ -543,10 +536,7 @@ async def test_reconfigure_flow_with_auth( ) config_entry.add_to_hass(hass) - result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_RECONFIGURE, "entry_id": config_entry.entry_id}, - ) + result = await config_entry.start_reconfigure_flow(hass) assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reconfigure" @@ -592,10 +582,7 @@ async def test_reconfigure_flow_duplicate_host( ) config_entry.add_to_hass(hass) - result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_RECONFIGURE, "entry_id": config_entry.entry_id}, - ) + result = await config_entry.start_reconfigure_flow(hass) assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reconfigure" @@ -633,10 +620,7 @@ async def test_reconfigure_flow_errors( ) config_entry.add_to_hass(hass) - result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_RECONFIGURE, "entry_id": config_entry.entry_id}, - ) + result = await config_entry.start_reconfigure_flow(hass) assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reconfigure" @@ -678,10 +662,7 @@ async def test_reconfigure_flow_changed_serial( ) config_entry.add_to_hass(hass) - result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_RECONFIGURE, "entry_id": config_entry.entry_id}, - ) + result = await config_entry.start_reconfigure_flow(hass) assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reconfigure" @@ -715,10 +696,7 @@ async def test_reconfigure_flow_no_serial( mock_charger.test_and_get.return_value = {"model": "openevse_wifi_v1"} - result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_RECONFIGURE, "entry_id": config_entry.entry_id}, - ) + result = await config_entry.start_reconfigure_flow(hass) assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reconfigure"