From f1ac33c2465009ff9757afefa8ae674825d0eb79 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 13 Apr 2024 10:36:33 -1000 Subject: [PATCH] Fix unmocked remote socket calls in sunweg tests (#115546) Fix unmocked calls in sunweg tests --- tests/components/sunweg/test_config_flow.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/components/sunweg/test_config_flow.py b/tests/components/sunweg/test_config_flow.py index 427e540f21b..80b6a946749 100644 --- a/tests/components/sunweg/test_config_flow.py +++ b/tests/components/sunweg/test_config_flow.py @@ -59,7 +59,7 @@ async def test_server_unavailable(hass: HomeAssistant) -> None: assert result["errors"] == {"base": "timeout_connect"} -async def test_reauth(hass: HomeAssistant) -> None: +async def test_reauth(hass: HomeAssistant, plant_fixture, inverter_fixture) -> None: """Test reauth flow.""" mock_entry = SUNWEG_MOCK_ENTRY mock_entry.add_to_hass(hass) @@ -103,11 +103,18 @@ async def test_reauth(hass: HomeAssistant) -> None: assert result["step_id"] == "reauth_confirm" assert result["errors"] == {"base": "timeout_connect"} - with patch.object(APIHelper, "authenticate", return_value=True): + with ( + patch.object(APIHelper, "authenticate", return_value=True), + patch.object(APIHelper, "listPlants", return_value=[plant_fixture]), + patch.object(APIHelper, "plant", return_value=plant_fixture), + patch.object(APIHelper, "inverter", return_value=inverter_fixture), + patch.object(APIHelper, "complete_inverter"), + ): result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=SUNWEG_USER_INPUT, ) + await hass.async_block_till_done() assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful"