Use MockConfigEntry flow helpers in OpenEVSE tests (#186454)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Joost Lekkerkerker
2026-10-14 16:52:33 +02:00
committed by GitHub
co-authored by Claude
parent a61a491972
commit 7fe7b111cb
+7 -29
View File
@@ -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"