From 1c36bf5e19596d389d10e3547187617a39cd8f69 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 24 Oct 2020 16:20:56 +0200 Subject: [PATCH] Fix block till done in create entry config flow tests (#42290) --- .../templates/config_flow/tests/test_config_flow.py | 2 +- tests/components/alarmdecoder/test_config_flow.py | 2 +- tests/components/august/test_config_flow.py | 6 +++--- tests/components/blink/test_config_flow.py | 4 ++-- tests/components/bond/test_config_flow.py | 4 ++-- tests/components/control4/test_config_flow.py | 2 +- tests/components/coolmaster/test_config_flow.py | 2 +- .../devolo_home_control/test_config_flow.py | 4 ++-- tests/components/dexcom/test_config_flow.py | 2 +- tests/components/doorbird/test_config_flow.py | 8 ++++---- tests/components/elkm1/test_config_flow.py | 8 ++++---- tests/components/flick_electric/test_config_flow.py | 2 +- tests/components/flume/test_config_flow.py | 4 ++-- tests/components/griddy/test_config_flow.py | 2 +- tests/components/harmony/test_config_flow.py | 6 +++--- tests/components/hlk_sw16/test_config_flow.py | 4 ++-- tests/components/homekit/test_config_flow.py | 4 ++-- .../hunterdouglas_powerview/test_config_flow.py | 6 +++--- tests/components/insteon/test_config_flow.py | 4 +--- tests/components/isy994/test_config_flow.py | 4 ++-- tests/components/juicenet/test_config_flow.py | 4 ++-- tests/components/kodi/test_config_flow.py | 12 ++++++------ tests/components/melcloud/test_config_flow.py | 4 ++-- tests/components/metoffice/test_config_flow.py | 2 +- tests/components/monoprice/test_config_flow.py | 2 +- tests/components/myq/test_config_flow.py | 4 ++-- tests/components/nexia/test_config_flow.py | 4 ++-- tests/components/nuheat/test_config_flow.py | 4 ++-- tests/components/nut/test_config_flow.py | 8 ++++---- tests/components/nws/test_config_flow.py | 4 ++-- tests/components/omnilogic/test_config_flow.py | 2 +- tests/components/opentherm_gw/test_config_flow.py | 2 +- tests/components/ozw/test_config_flow.py | 2 +- tests/components/plum_lightpad/test_config_flow.py | 2 +- tests/components/poolsense/test_config_flow.py | 2 +- tests/components/powerwall/test_config_flow.py | 4 ++-- tests/components/profiler/test_config_flow.py | 2 +- tests/components/rachio/test_config_flow.py | 2 +- tests/components/ring/test_config_flow.py | 2 +- tests/components/risco/test_config_flow.py | 2 +- tests/components/roku/test_config_flow.py | 6 +++--- tests/components/roomba/test_config_flow.py | 4 ++-- tests/components/roon/test_config_flow.py | 4 ++-- .../components/ruckus_unleashed/test_config_flow.py | 2 +- tests/components/sense/test_config_flow.py | 2 +- tests/components/shelly/test_config_flow.py | 10 +++++----- .../components/smart_meter_texas/test_config_flow.py | 2 +- tests/components/smarthab/test_config_flow.py | 4 ++-- tests/components/solarlog/test_config_flow.py | 2 +- tests/components/spider/test_config_flow.py | 4 ++-- tests/components/tado/test_config_flow.py | 4 ++-- tests/components/tesla/test_config_flow.py | 2 +- tests/components/tuya/test_config_flow.py | 4 ++-- tests/components/upb/test_config_flow.py | 4 ++-- tests/components/vilfo/test_config_flow.py | 1 - tests/components/volumio/test_config_flow.py | 6 +++--- tests/components/zerproc/test_config_flow.py | 2 +- 57 files changed, 105 insertions(+), 108 deletions(-) diff --git a/script/scaffold/templates/config_flow/tests/test_config_flow.py b/script/scaffold/templates/config_flow/tests/test_config_flow.py index 7cd09ad1f42..a69bea2abd8 100644 --- a/script/scaffold/templates/config_flow/tests/test_config_flow.py +++ b/script/scaffold/templates/config_flow/tests/test_config_flow.py @@ -32,6 +32,7 @@ async def test_form(hass): "password": "test-password", }, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "Name of the device" @@ -40,7 +41,6 @@ async def test_form(hass): "username": "test-username", "password": "test-password", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/alarmdecoder/test_config_flow.py b/tests/components/alarmdecoder/test_config_flow.py index 4af8b783b07..b858671fb54 100644 --- a/tests/components/alarmdecoder/test_config_flow.py +++ b/tests/components/alarmdecoder/test_config_flow.py @@ -89,8 +89,8 @@ async def test_setups(hass: HomeAssistant, protocol, connection, title): **connection, CONF_PROTOCOL: protocol, } + await hass.async_block_till_done() - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/august/test_config_flow.py b/tests/components/august/test_config_flow.py index 1c23976a6f9..0f9a8ebbd2f 100644 --- a/tests/components/august/test_config_flow.py +++ b/tests/components/august/test_config_flow.py @@ -46,6 +46,7 @@ async def test_form(hass): CONF_PASSWORD: "test-password", }, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "my@email.tld" @@ -57,7 +58,6 @@ async def test_form(hass): CONF_TIMEOUT: 10, CONF_ACCESS_TOKEN_CACHE_FILE: ".my@email.tld.august.conf", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -205,6 +205,7 @@ async def test_form_needs_validate(hass): result["flow_id"], {VERIFICATION_CODE_KEY: "correct"}, ) + await hass.async_block_till_done() assert len(mock_send_verification_code.mock_calls) == 0 assert len(mock_validate_verification_code.mock_calls) == 1 @@ -218,7 +219,6 @@ async def test_form_needs_validate(hass): CONF_TIMEOUT: 10, CONF_ACCESS_TOKEN_CACHE_FILE: ".my@email.tld.august.conf", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -261,9 +261,9 @@ async def test_form_reauth(hass): CONF_PASSWORD: "new-test-password", }, ) + await hass.async_block_till_done() assert result2["type"] == "abort" assert result2["reason"] == "reauth_successful" - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/blink/test_config_flow.py b/tests/components/blink/test_config_flow.py index 72a4a5272ed..36e3fbd95ea 100644 --- a/tests/components/blink/test_config_flow.py +++ b/tests/components/blink/test_config_flow.py @@ -31,6 +31,7 @@ async def test_form(hass): result["flow_id"], {"username": "blink@example.com", "password": "example"}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "blink" @@ -45,7 +46,6 @@ async def test_form(hass): "client_id": None, "region_id": None, } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -88,11 +88,11 @@ async def test_form_2fa(hass): result3 = await hass.config_entries.flow.async_configure( result2["flow_id"], {"pin": "1234"} ) + await hass.async_block_till_done() assert result3["type"] == "create_entry" assert result3["title"] == "blink" assert result3["result"].unique_id == "blink@example.com" - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/bond/test_config_flow.py b/tests/components/bond/test_config_flow.py index cd98dd8090a..b87891a1896 100644 --- a/tests/components/bond/test_config_flow.py +++ b/tests/components/bond/test_config_flow.py @@ -29,6 +29,7 @@ async def test_user_form(hass: core.HomeAssistant): result["flow_id"], {CONF_HOST: "some host", CONF_ACCESS_TOKEN: "test-token"}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "test-bond-id" @@ -36,7 +37,6 @@ async def test_user_form(hass: core.HomeAssistant): CONF_HOST: "some host", CONF_ACCESS_TOKEN: "test-token", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -165,6 +165,7 @@ async def test_zeroconf_form(hass: core.HomeAssistant): result["flow_id"], {CONF_ACCESS_TOKEN: "test-token"}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "test-bond-id" @@ -172,7 +173,6 @@ async def test_zeroconf_form(hass: core.HomeAssistant): CONF_HOST: "test-host", CONF_ACCESS_TOKEN: "test-token", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/control4/test_config_flow.py b/tests/components/control4/test_config_flow.py index f87c5af3484..8c68039920d 100644 --- a/tests/components/control4/test_config_flow.py +++ b/tests/components/control4/test_config_flow.py @@ -75,6 +75,7 @@ async def test_form(hass): CONF_PASSWORD: "test-password", }, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "control4_model_00AA00AA00AA" @@ -84,7 +85,6 @@ async def test_form(hass): CONF_PASSWORD: "test-password", "controller_unique_id": "control4_model_00AA00AA00AA", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/coolmaster/test_config_flow.py b/tests/components/coolmaster/test_config_flow.py index b758a37db1d..27e44949585 100644 --- a/tests/components/coolmaster/test_config_flow.py +++ b/tests/components/coolmaster/test_config_flow.py @@ -32,6 +32,7 @@ async def test_form(hass): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], _flow_data() ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "1.1.1.1" @@ -40,7 +41,6 @@ async def test_form(hass): "port": 10102, "supported_modes": AVAILABLE_MODES, } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/devolo_home_control/test_config_flow.py b/tests/components/devolo_home_control/test_config_flow.py index 89e87c78c64..25d42a266dc 100644 --- a/tests/components/devolo_home_control/test_config_flow.py +++ b/tests/components/devolo_home_control/test_config_flow.py @@ -33,6 +33,7 @@ async def test_form(hass): result["flow_id"], {"username": "test-username", "password": "test-password"}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "devolo Home Control" @@ -43,7 +44,6 @@ async def test_form(hass): "mydevolo_url": "https://www.mydevolo.com", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -118,6 +118,7 @@ async def test_form_advanced_options(hass): "mydevolo_url": "https://test_mydevolo_url.test", }, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "devolo Home Control" @@ -128,6 +129,5 @@ async def test_form_advanced_options(hass): "mydevolo_url": "https://test_mydevolo_url.test", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/dexcom/test_config_flow.py b/tests/components/dexcom/test_config_flow.py index 6f6d8abe8f9..c79e7ca0075 100644 --- a/tests/components/dexcom/test_config_flow.py +++ b/tests/components/dexcom/test_config_flow.py @@ -32,11 +32,11 @@ async def test_form(hass): result["flow_id"], CONFIG, ) + await hass.async_block_till_done() assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result2["title"] == CONFIG[CONF_USERNAME] assert result2["data"] == CONFIG - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/doorbird/test_config_flow.py b/tests/components/doorbird/test_config_flow.py index f8a01899bd5..c52388b886c 100644 --- a/tests/components/doorbird/test_config_flow.py +++ b/tests/components/doorbird/test_config_flow.py @@ -62,6 +62,7 @@ async def test_user_form(hass): result["flow_id"], VALID_CONFIG, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "1.2.3.4" @@ -71,7 +72,6 @@ async def test_user_form(hass): "password": "password", "username": "friend", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -108,6 +108,7 @@ async def test_form_import(hass): context={"source": config_entries.SOURCE_IMPORT}, data=import_config, ) + await hass.async_block_till_done() assert result["type"] == "create_entry" assert result["title"] == "1.2.3.4" @@ -124,7 +125,6 @@ async def test_form_import(hass): # It is not possible to import options at this time # so they end up in the config entry data and are # used a fallback when they are not in options - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -176,6 +176,7 @@ async def test_form_import_with_zeroconf_already_discovered(hass): context={"source": config_entries.SOURCE_IMPORT}, data=import_config, ) + await hass.async_block_till_done() assert result["type"] == "create_entry" assert result["title"] == "1.2.3.4" @@ -192,7 +193,6 @@ async def test_form_import_with_zeroconf_already_discovered(hass): # It is not possible to import options at this time # so they end up in the config entry data and are # used a fallback when they are not in options - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -274,6 +274,7 @@ async def test_form_zeroconf_correct_oui(hass): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], VALID_CONFIG ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "1.2.3.4" @@ -283,7 +284,6 @@ async def test_form_zeroconf_correct_oui(hass): "password": "password", "username": "friend", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/elkm1/test_config_flow.py b/tests/components/elkm1/test_config_flow.py index 0a959cf1b97..ba58d8cb68c 100644 --- a/tests/components/elkm1/test_config_flow.py +++ b/tests/components/elkm1/test_config_flow.py @@ -45,6 +45,7 @@ async def test_form_user_with_secure_elk(hass): "prefix": "", }, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "ElkM1" @@ -56,7 +57,6 @@ async def test_form_user_with_secure_elk(hass): "temperature_unit": "°F", "username": "test-username", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -90,6 +90,7 @@ async def test_form_user_with_non_secure_elk(hass): "prefix": "guest_house", }, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "guest_house" @@ -101,7 +102,6 @@ async def test_form_user_with_non_secure_elk(hass): "password": "", "temperature_unit": "°F", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -135,6 +135,7 @@ async def test_form_user_with_serial_elk(hass): "prefix": "", }, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "ElkM1" @@ -146,7 +147,6 @@ async def test_form_user_with_serial_elk(hass): "password": "", "temperature_unit": "°C", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -253,6 +253,7 @@ async def test_form_import(hass): }, }, ) + await hass.async_block_till_done() assert result["type"] == "create_entry" assert result["title"] == "ohana" @@ -274,6 +275,5 @@ async def test_form_import(hass): "username": "friend", "zone": {"enabled": True, "exclude": [[15, 15], [28, 208]], "include": []}, } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/flick_electric/test_config_flow.py b/tests/components/flick_electric/test_config_flow.py index c8fe6298764..f18daed875f 100644 --- a/tests/components/flick_electric/test_config_flow.py +++ b/tests/components/flick_electric/test_config_flow.py @@ -43,11 +43,11 @@ async def test_form(hass): result["flow_id"], CONF, ) + await hass.async_block_till_done() assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result2["title"] == "Flick Electric: test-username" assert result2["data"] == CONF - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/flume/test_config_flow.py b/tests/components/flume/test_config_flow.py index bf95700c2de..0afea0a9742 100644 --- a/tests/components/flume/test_config_flow.py +++ b/tests/components/flume/test_config_flow.py @@ -51,6 +51,7 @@ async def test_form(hass): CONF_CLIENT_SECRET: "client_secret", }, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "test-username" @@ -60,7 +61,6 @@ async def test_form(hass): CONF_CLIENT_ID: "client_id", CONF_CLIENT_SECRET: "client_secret", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -92,6 +92,7 @@ async def test_form_import(hass): CONF_CLIENT_SECRET: "client_secret", }, ) + await hass.async_block_till_done() assert result["type"] == "create_entry" assert result["title"] == "test-username" @@ -101,7 +102,6 @@ async def test_form_import(hass): CONF_CLIENT_ID: "client_id", CONF_CLIENT_SECRET: "client_secret", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/griddy/test_config_flow.py b/tests/components/griddy/test_config_flow.py index 309864dbc11..0b2656dcf09 100644 --- a/tests/components/griddy/test_config_flow.py +++ b/tests/components/griddy/test_config_flow.py @@ -29,11 +29,11 @@ async def test_form(hass): result["flow_id"], {"loadzone": "LZ_HOUSTON"}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "Load Zone LZ_HOUSTON" assert result2["data"] == {"loadzone": "LZ_HOUSTON"} - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/harmony/test_config_flow.py b/tests/components/harmony/test_config_flow.py index d6bd4022d9e..994188eb62a 100644 --- a/tests/components/harmony/test_config_flow.py +++ b/tests/components/harmony/test_config_flow.py @@ -56,11 +56,11 @@ async def test_user_form(hass): result["flow_id"], {"host": "1.2.3.4", "name": "friend"}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "friend" assert result2["data"] == {"host": "1.2.3.4", "name": "friend"} - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -90,6 +90,7 @@ async def test_form_import(hass): "unique_id": "555234534543", }, ) + await hass.async_block_till_done() assert result["result"].unique_id == "555234534543" assert result["type"] == "create_entry" @@ -103,7 +104,6 @@ async def test_form_import(hass): # It is not possible to import options at this time # so they end up in the config entry data and are # used a fallback when they are not in options - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -147,11 +147,11 @@ async def test_form_ssdp(hass): result["flow_id"], {}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "Harmony Hub" assert result2["data"] == {"host": "192.168.1.12", "name": "Harmony Hub"} - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/hlk_sw16/test_config_flow.py b/tests/components/hlk_sw16/test_config_flow.py index 7b7468047be..ea637c805cd 100644 --- a/tests/components/hlk_sw16/test_config_flow.py +++ b/tests/components/hlk_sw16/test_config_flow.py @@ -77,6 +77,7 @@ async def test_form(hass): result["flow_id"], conf, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "127.0.0.1:8080" @@ -84,7 +85,6 @@ async def test_form(hass): "host": "127.0.0.1", "port": 8080, } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -139,6 +139,7 @@ async def test_import(hass): result["flow_id"], conf, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "127.0.0.1:8080" @@ -146,7 +147,6 @@ async def test_import(hass): "host": "127.0.0.1", "port": 8080, } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/homekit/test_config_flow.py b/tests/components/homekit/test_config_flow.py index e161d746c3c..60dc293c4fd 100644 --- a/tests/components/homekit/test_config_flow.py +++ b/tests/components/homekit/test_config_flow.py @@ -62,6 +62,7 @@ async def test_user_form(hass): result["flow_id"], {}, ) + await hass.async_block_till_done() assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result3["title"][:11] == "HASS Bridge" @@ -77,7 +78,6 @@ async def test_user_form(hass): "name": bridge_name, "port": 12345, } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -111,6 +111,7 @@ async def test_import(hass): context={"source": config_entries.SOURCE_IMPORT}, data={CONF_NAME: "othername", CONF_PORT: 56789}, ) + await hass.async_block_till_done() assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result2["title"] == "othername:56789" @@ -118,7 +119,6 @@ async def test_import(hass): "name": "othername", "port": 56789, } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 2 diff --git a/tests/components/hunterdouglas_powerview/test_config_flow.py b/tests/components/hunterdouglas_powerview/test_config_flow.py index 37fb150ddf7..84457a14a5e 100644 --- a/tests/components/hunterdouglas_powerview/test_config_flow.py +++ b/tests/components/hunterdouglas_powerview/test_config_flow.py @@ -46,13 +46,13 @@ async def test_user_form(hass): result["flow_id"], {"host": "1.2.3.4"}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "AlexanderHD" assert result2["data"] == { "host": "1.2.3.4", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -89,13 +89,13 @@ async def test_form_import(hass): context={"source": config_entries.SOURCE_IMPORT}, data={"host": "1.2.3.4"}, ) + await hass.async_block_till_done() assert result["type"] == "create_entry" assert result["title"] == "AlexanderHD" assert result["data"] == { "host": "1.2.3.4", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -141,13 +141,13 @@ async def test_form_homekit(hass): return_value=True, ) as mock_setup_entry: 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"] == "PowerViewHub" assert result2["data"] == {"host": "1.2.3.4"} assert result2["result"].unique_id == "ABC123" - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/insteon/test_config_flow.py b/tests/components/insteon/test_config_flow.py index f4a3806a891..4e060b0d840 100644 --- a/tests/components/insteon/test_config_flow.py +++ b/tests/components/insteon/test_config_flow.py @@ -88,6 +88,7 @@ async def _device_form(hass, flow_id, connection, user_input): return_value=True, ) as mock_setup_entry: result = await hass.config_entries.flow.async_configure(flow_id, user_input) + await hass.async_block_till_done() return result, mock_setup, mock_setup_entry @@ -130,7 +131,6 @@ async def test_form_select_plm(hass: HomeAssistantType): assert result2["type"] == "create_entry" assert result2["data"] == MOCK_USER_INPUT_PLM - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -149,7 +149,6 @@ async def test_form_select_hub_v1(hass: HomeAssistantType): CONF_HUB_VERSION: 1, } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -168,7 +167,6 @@ async def test_form_select_hub_v2(hass: HomeAssistantType): CONF_HUB_VERSION: 2, } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/isy994/test_config_flow.py b/tests/components/isy994/test_config_flow.py index cbbc7427f9f..2fe19a0a9fd 100644 --- a/tests/components/isy994/test_config_flow.py +++ b/tests/components/isy994/test_config_flow.py @@ -93,11 +93,11 @@ async def test_form(hass: HomeAssistantType): result["flow_id"], MOCK_USER_INPUT, ) + await hass.async_block_till_done() assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result2["title"] == f"{MOCK_DEVICE_NAME} ({MOCK_HOSTNAME})" assert result2["result"].unique_id == MOCK_UUID assert result2["data"] == MOCK_USER_INPUT - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -310,11 +310,11 @@ async def test_form_ssdp(hass: HomeAssistantType): result["flow_id"], MOCK_USER_INPUT, ) + await hass.async_block_till_done() assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result2["title"] == f"{MOCK_DEVICE_NAME} ({MOCK_HOSTNAME})" assert result2["result"].unique_id == MOCK_UUID assert result2["data"] == MOCK_USER_INPUT - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/juicenet/test_config_flow.py b/tests/components/juicenet/test_config_flow.py index 4f00e9a1a76..3a7d2f06c43 100644 --- a/tests/components/juicenet/test_config_flow.py +++ b/tests/components/juicenet/test_config_flow.py @@ -35,11 +35,11 @@ async def test_form(hass): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_ACCESS_TOKEN: "access_token"} ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "JuiceNet" assert result2["data"] == {CONF_ACCESS_TOKEN: "access_token"} - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -114,10 +114,10 @@ async def test_import(hass): context={"source": config_entries.SOURCE_IMPORT}, data={CONF_ACCESS_TOKEN: "access_token"}, ) + await hass.async_block_till_done() assert result["type"] == "create_entry" assert result["title"] == "JuiceNet" assert result["data"] == {CONF_ACCESS_TOKEN: "access_token"} - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/kodi/test_config_flow.py b/tests/components/kodi/test_config_flow.py index 71c2bce1307..9b010f3ed42 100644 --- a/tests/components/kodi/test_config_flow.py +++ b/tests/components/kodi/test_config_flow.py @@ -51,6 +51,7 @@ async def test_user_flow(hass, user_flow): return_value=True, ) as mock_setup_entry: result = await hass.config_entries.flow.async_configure(user_flow, TEST_HOST) + await hass.async_block_till_done() assert result["type"] == "create_entry" assert result["title"] == TEST_HOST["host"] @@ -63,7 +64,6 @@ async def test_user_flow(hass, user_flow): "timeout": DEFAULT_TIMEOUT, } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -98,6 +98,7 @@ async def test_form_valid_auth(hass, user_flow): result = await hass.config_entries.flow.async_configure( result["flow_id"], TEST_CREDENTIALS ) + await hass.async_block_till_done() assert result["type"] == "create_entry" assert result["title"] == TEST_HOST["host"] @@ -109,7 +110,6 @@ async def test_form_valid_auth(hass, user_flow): "timeout": DEFAULT_TIMEOUT, } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -148,6 +148,7 @@ async def test_form_valid_ws_port(hass, user_flow): result = await hass.config_entries.flow.async_configure( result["flow_id"], TEST_WS_PORT ) + await hass.async_block_till_done() assert result["type"] == "create_entry" assert result["title"] == TEST_HOST["host"] @@ -160,7 +161,6 @@ async def test_form_valid_ws_port(hass, user_flow): "timeout": DEFAULT_TIMEOUT, } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -193,6 +193,7 @@ async def test_form_empty_ws_port(hass, user_flow): result = await hass.config_entries.flow.async_configure( result["flow_id"], {"ws_port": 0} ) + await hass.async_block_till_done() assert result["type"] == "create_entry" assert result["title"] == TEST_HOST["host"] @@ -205,7 +206,6 @@ async def test_form_empty_ws_port(hass, user_flow): "timeout": DEFAULT_TIMEOUT, } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -436,6 +436,7 @@ async def test_discovery(hass): result = await hass.config_entries.flow.async_configure( flow_id=result["flow_id"], user_input={} ) + await hass.async_block_till_done() assert result["type"] == "create_entry" assert result["title"] == "hostname" @@ -448,7 +449,6 @@ async def test_discovery(hass): "timeout": DEFAULT_TIMEOUT, } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -592,12 +592,12 @@ async def test_form_import(hass): context={"source": config_entries.SOURCE_IMPORT}, data=TEST_IMPORT, ) + await hass.async_block_till_done() assert result["type"] == "create_entry" assert result["title"] == TEST_IMPORT["name"] assert result["data"] == TEST_IMPORT - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/melcloud/test_config_flow.py b/tests/components/melcloud/test_config_flow.py index ab3d16a0d6a..1fca3ac877e 100644 --- a/tests/components/melcloud/test_config_flow.py +++ b/tests/components/melcloud/test_config_flow.py @@ -61,6 +61,7 @@ async def test_form(hass, mock_login, mock_get_devices): result["flow_id"], {"username": "test-email@test-domain.com", "password": "test-password"}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "test-email@test-domain.com" @@ -68,7 +69,6 @@ async def test_form(hass, mock_login, mock_get_devices): "username": "test-email@test-domain.com", "token": "test-token", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -128,6 +128,7 @@ async def test_import_with_token(hass, mock_login, mock_get_devices): context={"source": config_entries.SOURCE_IMPORT}, data={"username": "test-email@test-domain.com", "token": "test-token"}, ) + await hass.async_block_till_done() assert result["type"] == "create_entry" assert result["title"] == "test-email@test-domain.com" @@ -135,7 +136,6 @@ async def test_import_with_token(hass, mock_login, mock_get_devices): "username": "test-email@test-domain.com", "token": "test-token", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/metoffice/test_config_flow.py b/tests/components/metoffice/test_config_flow.py index 5987d44ac27..3f248704fa1 100644 --- a/tests/components/metoffice/test_config_flow.py +++ b/tests/components/metoffice/test_config_flow.py @@ -42,6 +42,7 @@ async def test_form(hass, requests_mock): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], {"api_key": TEST_API_KEY} ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == TEST_SITE_NAME_WAVERTREE @@ -51,7 +52,6 @@ async def test_form(hass, requests_mock): "longitude": TEST_LONGITUDE_WAVERTREE, "name": TEST_SITE_NAME_WAVERTREE, } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/monoprice/test_config_flow.py b/tests/components/monoprice/test_config_flow.py index e2aae6eddaa..f3530bb2c75 100644 --- a/tests/components/monoprice/test_config_flow.py +++ b/tests/components/monoprice/test_config_flow.py @@ -43,6 +43,7 @@ async def test_form(hass): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], CONFIG ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == CONFIG[CONF_PORT] @@ -50,7 +51,6 @@ async def test_form(hass): CONF_PORT: CONFIG[CONF_PORT], CONF_SOURCES: {"1": CONFIG[CONF_SOURCE_1], "4": CONFIG[CONF_SOURCE_4]}, } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/myq/test_config_flow.py b/tests/components/myq/test_config_flow.py index 4d1bf7db683..e2c43e8ce5c 100644 --- a/tests/components/myq/test_config_flow.py +++ b/tests/components/myq/test_config_flow.py @@ -31,6 +31,7 @@ async def test_form_user(hass): result["flow_id"], {"username": "test-username", "password": "test-password"}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "test-username" @@ -38,7 +39,6 @@ async def test_form_user(hass): "username": "test-username", "password": "test-password", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -61,6 +61,7 @@ async def test_import(hass): context={"source": config_entries.SOURCE_IMPORT}, data={"username": "test-username", "password": "test-password"}, ) + await hass.async_block_till_done() assert result["type"] == "create_entry" assert result["title"] == "test-username" @@ -68,7 +69,6 @@ async def test_import(hass): "username": "test-username", "password": "test-password", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/nexia/test_config_flow.py b/tests/components/nexia/test_config_flow.py index 944eb612038..81536f5beea 100644 --- a/tests/components/nexia/test_config_flow.py +++ b/tests/components/nexia/test_config_flow.py @@ -33,6 +33,7 @@ async def test_form(hass): result["flow_id"], {CONF_USERNAME: "username", CONF_PASSWORD: "password"}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "myhouse" @@ -40,7 +41,6 @@ async def test_form(hass): CONF_USERNAME: "username", CONF_PASSWORD: "password", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -162,6 +162,7 @@ async def test_form_import(hass): context={"source": config_entries.SOURCE_IMPORT}, data={CONF_USERNAME: "username", CONF_PASSWORD: "password"}, ) + await hass.async_block_till_done() assert result["type"] == "create_entry" assert result["title"] == "myhouse" @@ -169,7 +170,6 @@ async def test_form_import(hass): CONF_USERNAME: "username", CONF_PASSWORD: "password", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/nuheat/test_config_flow.py b/tests/components/nuheat/test_config_flow.py index 4c392841142..5b2259faea8 100644 --- a/tests/components/nuheat/test_config_flow.py +++ b/tests/components/nuheat/test_config_flow.py @@ -40,6 +40,7 @@ async def test_form_user(hass): CONF_PASSWORD: "test-password", }, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "Master bathroom" @@ -48,7 +49,6 @@ async def test_form_user(hass): CONF_USERNAME: "test-username", CONF_PASSWORD: "test-password", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -79,6 +79,7 @@ async def test_form_import(hass): CONF_PASSWORD: "test-password", }, ) + await hass.async_block_till_done() assert result["type"] == "create_entry" assert result["title"] == "Master bathroom" @@ -87,7 +88,6 @@ async def test_form_import(hass): CONF_USERNAME: "test-username", CONF_PASSWORD: "test-password", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/nut/test_config_flow.py b/tests/components/nut/test_config_flow.py index 8d50d77c31d..e003ecd796b 100644 --- a/tests/components/nut/test_config_flow.py +++ b/tests/components/nut/test_config_flow.py @@ -57,6 +57,7 @@ async def test_form_zeroconf(hass): result2["flow_id"], {"resources": ["battery.voltage", "ups.status", "ups.status.display"]}, ) + await hass.async_block_till_done() assert result3["type"] == "create_entry" assert result3["title"] == "192.168.1.5:1234" @@ -68,7 +69,6 @@ async def test_form_zeroconf(hass): "username": "test-username", } assert result3["result"].unique_id is None - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -116,6 +116,7 @@ async def test_form_user_one_ups(hass): result2["flow_id"], {"resources": ["battery.voltage", "ups.status", "ups.status.display"]}, ) + await hass.async_block_till_done() assert result3["type"] == "create_entry" assert result3["title"] == "1.1.1.1:2222" @@ -126,7 +127,6 @@ async def test_form_user_one_ups(hass): "resources": ["battery.voltage", "ups.status", "ups.status.display"], "username": "test-username", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -195,6 +195,7 @@ async def test_form_user_multiple_ups(hass): result3["flow_id"], {"resources": ["battery.voltage"]}, ) + await hass.async_block_till_done() assert result4["type"] == "create_entry" assert result4["title"] == "ups2@1.1.1.1:2222" @@ -206,7 +207,6 @@ async def test_form_user_multiple_ups(hass): "resources": ["battery.voltage"], "username": "test-username", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 2 @@ -239,6 +239,7 @@ async def test_form_import(hass): "resources": ["battery.charge"], }, ) + await hass.async_block_till_done() assert result["type"] == "create_entry" assert result["title"] == "localhost:123" @@ -248,7 +249,6 @@ async def test_form_import(hass): "name": "name", "resources": ["battery.charge"], } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 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 72e02f32b9d..2ea5f36a379 100644 --- a/tests/components/nws/test_config_flow.py +++ b/tests/components/nws/test_config_flow.py @@ -28,6 +28,7 @@ async def test_form(hass, mock_simple_nws_config): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], {"api_key": "test"} ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "ABC" @@ -37,7 +38,6 @@ async def test_form(hass, mock_simple_nws_config): "longitude": -90, "station": "ABC", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -94,9 +94,9 @@ async def test_form_already_configured(hass, mock_simple_nws_config): result["flow_id"], {"api_key": "test"}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/omnilogic/test_config_flow.py b/tests/components/omnilogic/test_config_flow.py index ef29ff9f674..6243fe10efb 100644 --- a/tests/components/omnilogic/test_config_flow.py +++ b/tests/components/omnilogic/test_config_flow.py @@ -32,11 +32,11 @@ async def test_form(hass): result["flow_id"], DATA, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "Omnilogic" assert result2["data"] == DATA - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/opentherm_gw/test_config_flow.py b/tests/components/opentherm_gw/test_config_flow.py index a696bc47590..d2d31d97628 100644 --- a/tests/components/opentherm_gw/test_config_flow.py +++ b/tests/components/opentherm_gw/test_config_flow.py @@ -40,6 +40,7 @@ async def test_form_user(hass): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_NAME: "Test Entry 1", CONF_DEVICE: "/dev/ttyUSB0"} ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "Test Entry 1" @@ -48,7 +49,6 @@ async def test_form_user(hass): CONF_DEVICE: "/dev/ttyUSB0", CONF_ID: "test_entry_1", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_pyotgw_connect.mock_calls) == 1 diff --git a/tests/components/ozw/test_config_flow.py b/tests/components/ozw/test_config_flow.py index 1af6787a952..f6b9f388146 100644 --- a/tests/components/ozw/test_config_flow.py +++ b/tests/components/ozw/test_config_flow.py @@ -24,11 +24,11 @@ async def test_user_create_entry(hass): return_value=True, ) as mock_setup_entry: 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"] == TITLE assert result2["data"] == {} - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/plum_lightpad/test_config_flow.py b/tests/components/plum_lightpad/test_config_flow.py index 7f6196ef9b7..f2ac756c4a3 100644 --- a/tests/components/plum_lightpad/test_config_flow.py +++ b/tests/components/plum_lightpad/test_config_flow.py @@ -30,6 +30,7 @@ async def test_form(hass): result["flow_id"], {"username": "test-plum-username", "password": "test-plum-password"}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "test-plum-username" @@ -37,7 +38,6 @@ async def test_form(hass): "username": "test-plum-username", "password": "test-plum-password", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/poolsense/test_config_flow.py b/tests/components/poolsense/test_config_flow.py index c969ed9c416..8ea05339c84 100644 --- a/tests/components/poolsense/test_config_flow.py +++ b/tests/components/poolsense/test_config_flow.py @@ -47,10 +47,10 @@ async def test_valid_credentials(hass): context={"source": SOURCE_USER}, data={CONF_EMAIL: "test-email", CONF_PASSWORD: "test-password"}, ) + await hass.async_block_till_done() assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result["title"] == "test-email" - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/powerwall/test_config_flow.py b/tests/components/powerwall/test_config_flow.py index 5f9445debe0..4f1a587b31b 100644 --- a/tests/components/powerwall/test_config_flow.py +++ b/tests/components/powerwall/test_config_flow.py @@ -35,11 +35,11 @@ async def test_form_source_user(hass): result["flow_id"], {CONF_IP_ADDRESS: "1.2.3.4"}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "My site" assert result2["data"] == {CONF_IP_ADDRESS: "1.2.3.4"} - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -63,11 +63,11 @@ async def test_form_source_import(hass): context={"source": config_entries.SOURCE_IMPORT}, data={CONF_IP_ADDRESS: "1.2.3.4"}, ) + await hass.async_block_till_done() assert result["type"] == "create_entry" assert result["title"] == "Imported site" assert result["data"] == {CONF_IP_ADDRESS: "1.2.3.4"} - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/profiler/test_config_flow.py b/tests/components/profiler/test_config_flow.py index e6cb62421af..dc2ddff14d9 100644 --- a/tests/components/profiler/test_config_flow.py +++ b/tests/components/profiler/test_config_flow.py @@ -25,11 +25,11 @@ async def test_form_user(hass): result["flow_id"], {}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "Profiler" assert result2["data"] == {} - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/rachio/test_config_flow.py b/tests/components/rachio/test_config_flow.py index eb6b5ef4386..75d671262a1 100644 --- a/tests/components/rachio/test_config_flow.py +++ b/tests/components/rachio/test_config_flow.py @@ -50,6 +50,7 @@ async def test_form(hass): CONF_MANUAL_RUN_MINS: 5, }, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "myusername" @@ -58,7 +59,6 @@ async def test_form(hass): CONF_CUSTOM_URL: "http://custom.url", CONF_MANUAL_RUN_MINS: 5, } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/ring/test_config_flow.py b/tests/components/ring/test_config_flow.py index 1be0a05fc5e..fc2b490f560 100644 --- a/tests/components/ring/test_config_flow.py +++ b/tests/components/ring/test_config_flow.py @@ -30,6 +30,7 @@ async def test_form(hass): result["flow_id"], {"username": "hello@home-assistant.io", "password": "test-password"}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "hello@home-assistant.io" @@ -37,7 +38,6 @@ async def test_form(hass): "username": "hello@home-assistant.io", "token": {"access_token": "mock-token"}, } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/risco/test_config_flow.py b/tests/components/risco/test_config_flow.py index 47fd0927cb1..ba14a52553e 100644 --- a/tests/components/risco/test_config_flow.py +++ b/tests/components/risco/test_config_flow.py @@ -66,11 +66,11 @@ async def test_form(hass): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], TEST_DATA ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == TEST_SITE_NAME assert result2["data"] == TEST_DATA - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 mock_close.assert_awaited_once() diff --git a/tests/components/roku/test_config_flow.py b/tests/components/roku/test_config_flow.py index 58acc7a6bdf..0fb77e46139 100644 --- a/tests/components/roku/test_config_flow.py +++ b/tests/components/roku/test_config_flow.py @@ -76,6 +76,7 @@ async def test_form( result = await hass.config_entries.flow.async_configure( flow_id=result["flow_id"], user_input=user_input ) + await hass.async_block_till_done() assert result["type"] == RESULT_TYPE_CREATE_ENTRY assert result["title"] == UPNP_FRIENDLY_NAME @@ -83,7 +84,6 @@ async def test_form( assert result["data"] assert result["data"][CONF_HOST] == HOST - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -144,6 +144,7 @@ async def test_import( result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_IMPORT}, data=user_input ) + await hass.async_block_till_done() assert result["type"] == RESULT_TYPE_CREATE_ENTRY assert result["title"] == UPNP_FRIENDLY_NAME @@ -151,7 +152,6 @@ async def test_import( assert result["data"] assert result["data"][CONF_HOST] == HOST - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -216,6 +216,7 @@ async def test_ssdp_discovery( result = await hass.config_entries.flow.async_configure( flow_id=result["flow_id"], user_input={} ) + await hass.async_block_till_done() assert result["type"] == RESULT_TYPE_CREATE_ENTRY assert result["title"] == UPNP_FRIENDLY_NAME @@ -224,6 +225,5 @@ async def test_ssdp_discovery( assert result["data"][CONF_HOST] == HOST assert result["data"][CONF_NAME] == UPNP_FRIENDLY_NAME - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/roomba/test_config_flow.py b/tests/components/roomba/test_config_flow.py index b2ad3a74235..d2af07070bb 100644 --- a/tests/components/roomba/test_config_flow.py +++ b/tests/components/roomba/test_config_flow.py @@ -62,6 +62,7 @@ async def test_form(hass): result["flow_id"], VALID_CONFIG, ) + await hass.async_block_till_done() assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result2["title"] == "myroomba" @@ -74,7 +75,6 @@ async def test_form(hass): CONF_HOST: "1.2.3.4", CONF_PASSWORD: "password", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -126,6 +126,7 @@ async def test_form_import(hass): context={"source": config_entries.SOURCE_IMPORT}, data=VALID_YAML_CONFIG.copy(), ) + await hass.async_block_till_done() assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result["result"].unique_id == "blid" @@ -138,7 +139,6 @@ async def test_form_import(hass): CONF_PASSWORD: "password", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/roon/test_config_flow.py b/tests/components/roon/test_config_flow.py index aae655fb9c5..7ffac08d9f6 100644 --- a/tests/components/roon/test_config_flow.py +++ b/tests/components/roon/test_config_flow.py @@ -51,11 +51,11 @@ async def test_form_and_auth(hass): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "Roon Labs Music Player" assert result2["data"] == {"host": "1.1.1.1", "api_key": "good_token"} - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -136,11 +136,11 @@ async def test_form_host_already_exists(hass): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "Roon Labs Music Player" assert result2["data"] == {"host": "1.1.1.1", "api_key": "good_token"} - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 2 diff --git a/tests/components/ruckus_unleashed/test_config_flow.py b/tests/components/ruckus_unleashed/test_config_flow.py index 8348ec4f2a8..39112dd44aa 100644 --- a/tests/components/ruckus_unleashed/test_config_flow.py +++ b/tests/components/ruckus_unleashed/test_config_flow.py @@ -39,11 +39,11 @@ async def test_form(hass): result["flow_id"], CONFIG, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == DEFAULT_TITLE assert result2["data"] == CONFIG - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/sense/test_config_flow.py b/tests/components/sense/test_config_flow.py index 4cda15f7303..44bd9c7265c 100644 --- a/tests/components/sense/test_config_flow.py +++ b/tests/components/sense/test_config_flow.py @@ -26,6 +26,7 @@ async def test_form(hass): result["flow_id"], {"timeout": "6", "email": "test-email", "password": "test-password"}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "test-email" @@ -34,7 +35,6 @@ async def test_form(hass): "email": "test-email", "password": "test-password", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/shelly/test_config_flow.py b/tests/components/shelly/test_config_flow.py index 280688a0618..ce0c380dd95 100644 --- a/tests/components/shelly/test_config_flow.py +++ b/tests/components/shelly/test_config_flow.py @@ -57,13 +57,13 @@ async def test_form(hass): result["flow_id"], {"host": "1.1.1.1"}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "Test name" assert result2["data"] == { "host": "1.1.1.1", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -102,13 +102,13 @@ async def test_title_without_name_and_prefix(hass): result["flow_id"], {"host": "1.1.1.1"}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "shelly1pm-12345" assert result2["data"] == { "host": "1.1.1.1", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -151,6 +151,7 @@ async def test_form_auth(hass): result2["flow_id"], {"username": "test username", "password": "test password"}, ) + await hass.async_block_till_done() assert result3["type"] == "create_entry" assert result3["title"] == "Test name" @@ -159,7 +160,6 @@ async def test_form_auth(hass): "username": "test username", "password": "test password", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -323,13 +323,13 @@ async def test_zeroconf(hass): result["flow_id"], {}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "Test name" assert result2["data"] == { "host": "1.1.1.1", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -480,6 +480,7 @@ async def test_zeroconf_require_auth(hass): result2["flow_id"], {"username": "test username", "password": "test password"}, ) + await hass.async_block_till_done() assert result3["type"] == "create_entry" assert result3["title"] == "Test name" @@ -488,7 +489,6 @@ async def test_zeroconf_require_auth(hass): "username": "test username", "password": "test password", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/smart_meter_texas/test_config_flow.py b/tests/components/smart_meter_texas/test_config_flow.py index 729cb0a90b2..4908a50e57d 100644 --- a/tests/components/smart_meter_texas/test_config_flow.py +++ b/tests/components/smart_meter_texas/test_config_flow.py @@ -36,11 +36,11 @@ async def test_form(hass): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], TEST_LOGIN ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == TEST_LOGIN[CONF_USERNAME] assert result2["data"] == TEST_LOGIN - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/smarthab/test_config_flow.py b/tests/components/smarthab/test_config_flow.py index d15fe58999e..6b8c58b1f70 100644 --- a/tests/components/smarthab/test_config_flow.py +++ b/tests/components/smarthab/test_config_flow.py @@ -28,6 +28,7 @@ async def test_form(hass): result["flow_id"], {CONF_EMAIL: "mock@example.com", CONF_PASSWORD: "test-password"}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "mock@example.com" @@ -35,7 +36,6 @@ async def test_form(hass): CONF_EMAIL: "mock@example.com", CONF_PASSWORD: "test-password", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -115,6 +115,7 @@ async def test_import(hass): result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, data=imported_conf ) + await hass.async_block_till_done() assert result["type"] == "create_entry" assert result["title"] == "mock@example.com" @@ -122,6 +123,5 @@ async def test_import(hass): CONF_EMAIL: "mock@example.com", CONF_PASSWORD: "test-password", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/solarlog/test_config_flow.py b/tests/components/solarlog/test_config_flow.py index 9cf0e2932ec..8266adfd417 100644 --- a/tests/components/solarlog/test_config_flow.py +++ b/tests/components/solarlog/test_config_flow.py @@ -34,11 +34,11 @@ async def test_form(hass): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], {"host": HOST, "name": NAME} ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "solarlog_test_1_2_3" assert result2["data"] == {"host": "http://1.1.1.1"} - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/spider/test_config_flow.py b/tests/components/spider/test_config_flow.py index 3bf7dd790b2..ca1b37434d1 100644 --- a/tests/components/spider/test_config_flow.py +++ b/tests/components/spider/test_config_flow.py @@ -42,6 +42,7 @@ async def test_user(hass, spider): result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=SPIDER_USER_DATA ) + await hass.async_block_till_done() assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result["title"] == DOMAIN @@ -49,7 +50,6 @@ async def test_user(hass, spider): assert result["data"][CONF_PASSWORD] == PASSWORD assert not result["result"].unique_id - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -69,6 +69,7 @@ async def test_import(hass, spider): context={"source": config_entries.SOURCE_IMPORT}, data=SPIDER_USER_DATA, ) + await hass.async_block_till_done() assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result["title"] == DOMAIN @@ -76,7 +77,6 @@ async def test_import(hass, spider): assert result["data"][CONF_PASSWORD] == PASSWORD assert not result["result"].unique_id - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/tado/test_config_flow.py b/tests/components/tado/test_config_flow.py index 9bd3db5e46b..ce4af05b79c 100644 --- a/tests/components/tado/test_config_flow.py +++ b/tests/components/tado/test_config_flow.py @@ -42,6 +42,7 @@ async def test_form(hass): result["flow_id"], {"username": "test-username", "password": "test-password"}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "myhome" @@ -49,7 +50,6 @@ async def test_form(hass): "username": "test-username", "password": "test-password", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -74,6 +74,7 @@ async def test_import(hass): context={"source": config_entries.SOURCE_IMPORT}, data={"username": "test-username", "password": "test-password"}, ) + await hass.async_block_till_done() assert result["type"] == "create_entry" assert result["title"] == "myhome" @@ -81,7 +82,6 @@ async def test_import(hass): "username": "test-username", "password": "test-password", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/tesla/test_config_flow.py b/tests/components/tesla/test_config_flow.py index 8b75fd904b9..59cdf910bf4 100644 --- a/tests/components/tesla/test_config_flow.py +++ b/tests/components/tesla/test_config_flow.py @@ -42,6 +42,7 @@ async def test_form(hass): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_PASSWORD: "test", CONF_USERNAME: "test@email.com"} ) + await hass.async_block_till_done() assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result2["title"] == "test@email.com" @@ -49,7 +50,6 @@ async def test_form(hass): CONF_TOKEN: "test-refresh-token", CONF_ACCESS_TOKEN: "test-access-token", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/tuya/test_config_flow.py b/tests/components/tuya/test_config_flow.py index 81154a368ff..e1b9bd3466c 100644 --- a/tests/components/tuya/test_config_flow.py +++ b/tests/components/tuya/test_config_flow.py @@ -47,6 +47,7 @@ async def test_user(hass, tuya): result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=TUYA_USER_DATA ) + await hass.async_block_till_done() assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result["title"] == USERNAME @@ -56,7 +57,6 @@ async def test_user(hass, tuya): assert result["data"][CONF_PLATFORM] == TUYA_PLATFORM assert not result["result"].unique_id - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -76,6 +76,7 @@ async def test_import(hass, tuya): context={"source": config_entries.SOURCE_IMPORT}, data=TUYA_USER_DATA, ) + await hass.async_block_till_done() assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result["title"] == USERNAME @@ -85,7 +86,6 @@ async def test_import(hass, tuya): assert result["data"][CONF_PLATFORM] == TUYA_PLATFORM assert not result["result"].unique_id - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/upb/test_config_flow.py b/tests/components/upb/test_config_flow.py index f0b44a4bad8..0c874399f88 100644 --- a/tests/components/upb/test_config_flow.py +++ b/tests/components/upb/test_config_flow.py @@ -59,6 +59,7 @@ async def test_full_upb_flow_with_serial_port(hass): "file_path": "upb.upe", }, ) + await hass.async_block_till_done() assert flow["type"] == "form" assert flow["errors"] == {} @@ -68,7 +69,6 @@ async def test_full_upb_flow_with_serial_port(hass): "host": "serial:///dev/ttyS0:115200", "file_path": "upb.upe", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -125,12 +125,12 @@ async def test_form_import(hass): context={"source": config_entries.SOURCE_IMPORT}, data={"host": "tcp://42.4.2.42", "file_path": "upb.upe"}, ) + await hass.async_block_till_done() assert result["type"] == "create_entry" assert result["title"] == "UPB" assert result["data"] == {"host": "tcp://42.4.2.42", "file_path": "upb.upe"} - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/vilfo/test_config_flow.py b/tests/components/vilfo/test_config_flow.py index f14ec123ba5..ca77b199cfa 100644 --- a/tests/components/vilfo/test_config_flow.py +++ b/tests/components/vilfo/test_config_flow.py @@ -38,7 +38,6 @@ async def test_form(hass): "access_token": "test-token", } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/volumio/test_config_flow.py b/tests/components/volumio/test_config_flow.py index a80d527b3f8..477ef25cb87 100644 --- a/tests/components/volumio/test_config_flow.py +++ b/tests/components/volumio/test_config_flow.py @@ -50,12 +50,12 @@ async def test_form(hass): result["flow_id"], TEST_CONNECTION, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "TestVolumio" assert result2["data"] == {**TEST_SYSTEM_INFO, **TEST_CONNECTION} - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -118,6 +118,7 @@ async def test_empty_system_info(hass): result["flow_id"], TEST_CONNECTION, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == TEST_CONNECTION["host"] @@ -128,7 +129,6 @@ async def test_empty_system_info(hass): "id": None, } - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -191,6 +191,7 @@ async def test_discovery(hass): result["flow_id"], user_input={}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == TEST_DISCOVERY_RESULT["name"] @@ -199,7 +200,6 @@ async def test_discovery(hass): assert result2["result"] assert result2["result"].unique_id == TEST_DISCOVERY_RESULT["id"] - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/zerproc/test_config_flow.py b/tests/components/zerproc/test_config_flow.py index 9ffafca76db..1a607bb8c9c 100644 --- a/tests/components/zerproc/test_config_flow.py +++ b/tests/components/zerproc/test_config_flow.py @@ -29,12 +29,12 @@ async def test_flow_success(hass): result["flow_id"], {}, ) + await hass.async_block_till_done() assert result2["type"] == "create_entry" assert result2["title"] == "Zerproc" assert result2["data"] == {} - await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1