diff --git a/tests/components/advantage_air/test_config_flow.py b/tests/components/advantage_air/test_config_flow.py index 4783e9cb635..fc74df5538b 100644 --- a/tests/components/advantage_air/test_config_flow.py +++ b/tests/components/advantage_air/test_config_flow.py @@ -33,12 +33,12 @@ async def test_form(hass: HomeAssistant, aioclient_mock: AiohttpClientMocker) -> result1["flow_id"], USER_INPUT, ) + await hass.async_block_till_done() assert len(aioclient_mock.mock_calls) == 1 assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY assert result2["title"] == "testname" assert result2["data"] == USER_INPUT - await hass.async_block_till_done() assert len(mock_setup_entry.mock_calls) == 1 # Test Duplicate Config Flow diff --git a/tests/components/bond/test_config_flow.py b/tests/components/bond/test_config_flow.py index a060def1cb6..fab579a81a3 100644 --- a/tests/components/bond/test_config_flow.py +++ b/tests/components/bond/test_config_flow.py @@ -187,11 +187,11 @@ async def test_user_form_one_entry_per_device_allowed(hass: HomeAssistant) -> No result["flow_id"], {CONF_HOST: "some host", CONF_ACCESS_TOKEN: "test-token"}, ) + await hass.async_block_till_done() assert result2["type"] == "abort" assert result2["reason"] == "already_configured" - await hass.async_block_till_done() assert len(mock_setup_entry.mock_calls) == 0 diff --git a/tests/components/epson/test_config_flow.py b/tests/components/epson/test_config_flow.py index fadfb2085b1..be0267a4af8 100644 --- a/tests/components/epson/test_config_flow.py +++ b/tests/components/epson/test_config_flow.py @@ -33,11 +33,11 @@ async def test_form(hass: HomeAssistant) -> None: result["flow_id"], {CONF_HOST: "1.1.1.1", CONF_NAME: "test-epson"}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "test-epson" assert result2["data"] == {CONF_HOST: "1.1.1.1"} - await hass.async_block_till_done() assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/faa_delays/test_config_flow.py b/tests/components/faa_delays/test_config_flow.py index ce7f86e6060..9eb166d5f69 100644 --- a/tests/components/faa_delays/test_config_flow.py +++ b/tests/components/faa_delays/test_config_flow.py @@ -37,13 +37,13 @@ async def test_form(hass: HomeAssistant) -> None: "id": "test", }, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "Test airport" assert result2["data"] == { "id": "test", } - await hass.async_block_till_done() assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/kmtronic/test_config_flow.py b/tests/components/kmtronic/test_config_flow.py index 76d11b8451e..ba8f2f5b87e 100644 --- a/tests/components/kmtronic/test_config_flow.py +++ b/tests/components/kmtronic/test_config_flow.py @@ -37,6 +37,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: "password": "test-password", }, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "1.1.1.1" @@ -45,7 +46,6 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: "username": "test-username", "password": "test-password", } - await hass.async_block_till_done() assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/kostal_plenticore/test_config_flow.py b/tests/components/kostal_plenticore/test_config_flow.py index 5d67ca3ae66..3c64a48c218 100644 --- a/tests/components/kostal_plenticore/test_config_flow.py +++ b/tests/components/kostal_plenticore/test_config_flow.py @@ -47,6 +47,7 @@ async def test_formx(hass: HomeAssistant) -> None: "password": "test-password", }, ) + await hass.async_block_till_done() mock_api_class.assert_called_once_with(ANY, "1.1.1.1") mock_api.__aenter__.assert_called_once() @@ -60,7 +61,6 @@ async def test_formx(hass: HomeAssistant) -> None: "host": "1.1.1.1", "password": "test-password", } - await hass.async_block_till_done() assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/kulersky/test_config_flow.py b/tests/components/kulersky/test_config_flow.py index 3a26f16f3a0..a09fc78797b 100644 --- a/tests/components/kulersky/test_config_flow.py +++ b/tests/components/kulersky/test_config_flow.py @@ -60,10 +60,10 @@ async def test_flow_no_devices_found(hass: HomeAssistant) -> None: result["flow_id"], {}, ) + await hass.async_block_till_done() assert result2["type"] == "abort" assert result2["reason"] == "no_devices_found" - await hass.async_block_till_done() assert len(mock_setup_entry.mock_calls) == 0 @@ -87,8 +87,8 @@ async def test_flow_exceptions_caught(hass: HomeAssistant) -> None: result["flow_id"], {}, ) + await hass.async_block_till_done() assert result2["type"] == "abort" assert result2["reason"] == "no_devices_found" - await hass.async_block_till_done() assert len(mock_setup_entry.mock_calls) == 0 diff --git a/tests/components/lutron_caseta/test_config_flow.py b/tests/components/lutron_caseta/test_config_flow.py index 72a0d4b71ac..cc71eb5910f 100644 --- a/tests/components/lutron_caseta/test_config_flow.py +++ b/tests/components/lutron_caseta/test_config_flow.py @@ -67,13 +67,13 @@ async def test_bridge_import_flow(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_IMPORT}, data=entry_mock_data, ) + await hass.async_block_till_done() assert result["type"] == "create_entry" assert result["title"] == CasetaConfigFlow.ENTRY_DEFAULT_TITLE assert result["data"] == entry_mock_data assert result["result"].unique_id == "000004d2" - await hass.async_block_till_done() assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/nanoleaf/test_config_flow.py b/tests/components/nanoleaf/test_config_flow.py index 200e2c21547..9a7f4a2bc50 100644 --- a/tests/components/nanoleaf/test_config_flow.py +++ b/tests/components/nanoleaf/test_config_flow.py @@ -381,6 +381,8 @@ async def test_import_discovery_integration( type=type_in_discovery, ), ) + await hass.async_block_till_done() + assert result["type"] == "create_entry" assert result["title"] == TEST_NAME assert result["data"] == { @@ -395,7 +397,6 @@ async def test_import_discovery_integration( mock_save_json.assert_called_once() mock_remove.assert_not_called() - await hass.async_block_till_done() assert len(mock_setup_entry.mock_calls) == 1 @@ -431,6 +432,7 @@ async def test_ssdp_discovery(hass: HomeAssistant) -> None: assert result["step_id"] == "link" result2 = await hass.config_entries.flow.async_configure(result["flow_id"], {}) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == TEST_NAME @@ -439,5 +441,4 @@ async def test_ssdp_discovery(hass: HomeAssistant) -> None: CONF_TOKEN: TEST_TOKEN, } - await hass.async_block_till_done() assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/nws/test_config_flow.py b/tests/components/nws/test_config_flow.py index 28e9db25363..9c02139d67c 100644 --- a/tests/components/nws/test_config_flow.py +++ b/tests/components/nws/test_config_flow.py @@ -108,7 +108,8 @@ async def test_form_already_configured( result["flow_id"], {"api_key": "test"}, ) + await hass.async_block_till_done() + assert result2["type"] == "abort" assert result2["reason"] == "already_configured" - await hass.async_block_till_done() assert len(mock_setup_entry.mock_calls) == 0 diff --git a/tests/components/onewire/test_config_flow.py b/tests/components/onewire/test_config_flow.py index 63e53627e0e..d69f9a93200 100644 --- a/tests/components/onewire/test_config_flow.py +++ b/tests/components/onewire/test_config_flow.py @@ -76,7 +76,8 @@ async def test_user_flow(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> No CONF_HOST: "1.2.3.4", CONF_PORT: 1234, } - await hass.async_block_till_done() + await hass.async_block_till_done() + assert len(mock_setup_entry.mock_calls) == 1 @@ -102,8 +103,6 @@ async def test_user_duplicate( ) assert result["type"] == FlowResultType.ABORT assert result["reason"] == "already_configured" - await hass.async_block_till_done() - assert len(mock_setup_entry.mock_calls) == 1 @pytest.mark.usefixtures("filled_device_registry") diff --git a/tests/components/syncthru/test_config_flow.py b/tests/components/syncthru/test_config_flow.py index e1e7b01ac09..ae6172af6d8 100644 --- a/tests/components/syncthru/test_config_flow.py +++ b/tests/components/syncthru/test_config_flow.py @@ -119,10 +119,10 @@ async def test_success( context={"source": config_entries.SOURCE_USER}, data=FIXTURE_USER_INPUT, ) + await hass.async_block_till_done() assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY assert result["data"][CONF_URL] == FIXTURE_USER_INPUT[CONF_URL] - await hass.async_block_till_done() assert len(mock_setup_entry.mock_calls) == 1