Skip to content

Commit f1ac33c

Browse files
authored
Fix unmocked remote socket calls in sunweg tests (#115546)
Fix unmocked calls in sunweg tests
1 parent edd75a9 commit f1ac33c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/components/sunweg/test_config_flow.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ async def test_server_unavailable(hass: HomeAssistant) -> None:
5959
assert result["errors"] == {"base": "timeout_connect"}
6060

6161

62-
async def test_reauth(hass: HomeAssistant) -> None:
62+
async def test_reauth(hass: HomeAssistant, plant_fixture, inverter_fixture) -> None:
6363
"""Test reauth flow."""
6464
mock_entry = SUNWEG_MOCK_ENTRY
6565
mock_entry.add_to_hass(hass)
@@ -103,11 +103,18 @@ async def test_reauth(hass: HomeAssistant) -> None:
103103
assert result["step_id"] == "reauth_confirm"
104104
assert result["errors"] == {"base": "timeout_connect"}
105105

106-
with patch.object(APIHelper, "authenticate", return_value=True):
106+
with (
107+
patch.object(APIHelper, "authenticate", return_value=True),
108+
patch.object(APIHelper, "listPlants", return_value=[plant_fixture]),
109+
patch.object(APIHelper, "plant", return_value=plant_fixture),
110+
patch.object(APIHelper, "inverter", return_value=inverter_fixture),
111+
patch.object(APIHelper, "complete_inverter"),
112+
):
107113
result = await hass.config_entries.flow.async_configure(
108114
result["flow_id"],
109115
user_input=SUNWEG_USER_INPUT,
110116
)
117+
await hass.async_block_till_done()
111118

112119
assert result["type"] is FlowResultType.ABORT
113120
assert result["reason"] == "reauth_successful"

0 commit comments

Comments
 (0)