From ec1400d39280c499dcab642508fa4ccc11917e57 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 3 Mar 2024 10:29:45 -1000 Subject: [PATCH] Fix flakey tplink test (#112135) The test here was assuming the first slow was the one it wanted, but sometimes the other flow wins the race --- tests/components/tplink/test_config_flow.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/components/tplink/test_config_flow.py b/tests/components/tplink/test_config_flow.py index 2834625292c..54a8893ad98 100644 --- a/tests/components/tplink/test_config_flow.py +++ b/tests/components/tplink/test_config_flow.py @@ -1113,7 +1113,6 @@ async def test_reauth_update_other_flows( mock_config_entry: MockConfigEntry, mock_discovery: AsyncMock, mock_connect: AsyncMock, - # mock_init, ) -> None: """Test reauth updates other reauth flows.""" mock_config_entry2 = MockConfigEntry( @@ -1138,10 +1137,10 @@ async def test_reauth_update_other_flows( flows = hass.config_entries.flow.async_progress() assert len(flows) == 2 - result = flows[0] + flows_by_entry_id = {flow["context"]["entry_id"]: flow for flow in flows} + result = flows_by_entry_id[mock_config_entry.entry_id] assert result["step_id"] == "reauth_confirm" assert mock_config_entry.data[CONF_DEVICE_CONFIG] == DEVICE_CONFIG_DICT_LEGACY - result2 = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={