diff --git a/tests/components/faa_delays/test_config_flow.py b/tests/components/faa_delays/test_config_flow.py index 92a8929afbf..61e5ffb8e6b 100644 --- a/tests/components/faa_delays/test_config_flow.py +++ b/tests/components/faa_delays/test_config_flow.py @@ -5,10 +5,11 @@ from unittest.mock import patch from aiohttp import ClientConnectionError import faadelays -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.faa_delays.const import DOMAIN from homeassistant.const import CONF_ID from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from homeassistant.exceptions import HomeAssistantError from tests.common import MockConfigEntry @@ -61,7 +62,7 @@ async def test_duplicate_error(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER}, data=conf ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/fastdotcom/test_config_flow.py b/tests/components/fastdotcom/test_config_flow.py index d2122f4fe61..db28aaec703 100644 --- a/tests/components/fastdotcom/test_config_flow.py +++ b/tests/components/fastdotcom/test_config_flow.py @@ -19,7 +19,7 @@ async def test_user_form(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with patch( @@ -31,7 +31,7 @@ async def test_user_form(hass: HomeAssistant) -> None: user_input={}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Fast.com" assert result["data"] == {} assert result["options"] == {} @@ -52,7 +52,7 @@ async def test_single_instance_allowed( DOMAIN, context={"source": source} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" @@ -66,7 +66,7 @@ async def test_import_flow_success(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Fast.com" assert result["data"] == {} assert result["options"] == {} diff --git a/tests/components/fibaro/test_config_flow.py b/tests/components/fibaro/test_config_flow.py index 2c7d05b87a3..dcf5f12a24a 100644 --- a/tests/components/fibaro/test_config_flow.py +++ b/tests/components/fibaro/test_config_flow.py @@ -35,7 +35,7 @@ async def _recovery_after_failure_works( }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == TEST_NAME assert result["data"] == { CONF_URL: TEST_URL, @@ -56,7 +56,7 @@ async def _recovery_after_reauth_failure_works( user_input={CONF_PASSWORD: "other_fake_password"}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" @@ -66,7 +66,7 @@ async def test_config_flow_user_initiated_success(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -79,7 +79,7 @@ async def test_config_flow_user_initiated_success(hass: HomeAssistant) -> None: }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == TEST_NAME assert result["data"] == { CONF_URL: TEST_URL, @@ -97,7 +97,7 @@ async def test_config_flow_user_initiated_connect_failure( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -112,7 +112,7 @@ async def test_config_flow_user_initiated_connect_failure( }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "cannot_connect"} @@ -127,7 +127,7 @@ async def test_config_flow_user_initiated_auth_failure( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -142,7 +142,7 @@ async def test_config_flow_user_initiated_auth_failure( }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "invalid_auth"} @@ -157,7 +157,7 @@ async def test_config_flow_user_initiated_unknown_failure_1( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -172,7 +172,7 @@ async def test_config_flow_user_initiated_unknown_failure_1( }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "cannot_connect"} @@ -187,7 +187,7 @@ async def test_config_flow_user_initiated_unknown_failure_2( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -202,7 +202,7 @@ async def test_config_flow_user_initiated_unknown_failure_2( }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "cannot_connect"} @@ -222,7 +222,7 @@ async def test_reauth_success( }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["errors"] == {} @@ -231,7 +231,7 @@ async def test_reauth_success( user_input={CONF_PASSWORD: "other_fake_password"}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" @@ -250,7 +250,7 @@ async def test_reauth_connect_failure( }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["errors"] == {} @@ -261,7 +261,7 @@ async def test_reauth_connect_failure( user_input={CONF_PASSWORD: "other_fake_password"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["errors"] == {"base": "cannot_connect"} @@ -283,7 +283,7 @@ async def test_reauth_auth_failure( }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["errors"] == {} @@ -294,7 +294,7 @@ async def test_reauth_auth_failure( user_input={CONF_PASSWORD: "other_fake_password"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["errors"] == {"base": "invalid_auth"} diff --git a/tests/components/filesize/test_config_flow.py b/tests/components/filesize/test_config_flow.py index 38209a3014e..4b275e66d02 100644 --- a/tests/components/filesize/test_config_flow.py +++ b/tests/components/filesize/test_config_flow.py @@ -27,7 +27,7 @@ async def test_full_user_flow(hass: HomeAssistant, tmp_path: Path) -> None: DOMAIN, context={"source": SOURCE_USER} ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "user" result2 = await hass.config_entries.flow.async_configure( @@ -35,7 +35,7 @@ async def test_full_user_flow(hass: HomeAssistant, tmp_path: Path) -> None: user_input={CONF_FILE_PATH: test_file}, ) - assert result2.get("type") == FlowResultType.CREATE_ENTRY + assert result2.get("type") is FlowResultType.CREATE_ENTRY assert result2.get("title") == TEST_FILE_NAME assert result2.get("data") == {CONF_FILE_PATH: test_file} @@ -53,7 +53,7 @@ async def test_unique_path( DOMAIN, context={"source": SOURCE_USER}, data={CONF_FILE_PATH: test_file} ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "already_configured" @@ -66,7 +66,7 @@ async def test_flow_fails_on_validation(hass: HomeAssistant, tmp_path: Path) -> DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" result2 = await hass.config_entries.flow.async_configure( @@ -103,7 +103,7 @@ async def test_flow_fails_on_validation(hass: HomeAssistant, tmp_path: Path) -> }, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == TEST_FILE_NAME assert result2["data"] == { CONF_FILE_PATH: test_file, diff --git a/tests/components/fireservicerota/test_config_flow.py b/tests/components/fireservicerota/test_config_flow.py index e2bf5911089..539906d800b 100644 --- a/tests/components/fireservicerota/test_config_flow.py +++ b/tests/components/fireservicerota/test_config_flow.py @@ -4,10 +4,11 @@ from unittest.mock import patch from pyfireservicerota import InvalidAuthError -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.fireservicerota.const import DOMAIN from homeassistant.const import CONF_PASSWORD, CONF_URL, CONF_USERNAME from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -44,7 +45,7 @@ async def test_show_form(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" @@ -57,7 +58,7 @@ async def test_abort_if_already_setup(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER}, data=MOCK_CONF ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -95,7 +96,7 @@ async def test_step_user(hass: HomeAssistant) -> None: await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == MOCK_CONF[CONF_USERNAME] assert result["data"] == { "auth_implementation": "fireservicerota", @@ -135,7 +136,7 @@ async def test_reauth(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM with ( patch( @@ -154,5 +155,5 @@ async def test_reauth(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == data_entry_flow.FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "reauth_successful" diff --git a/tests/components/fitbit/test_config_flow.py b/tests/components/fitbit/test_config_flow.py index 78d20b0fb58..2fd431176b9 100644 --- a/tests/components/fitbit/test_config_flow.py +++ b/tests/components/fitbit/test_config_flow.py @@ -51,7 +51,7 @@ async def test_full_flow( "redirect_uri": REDIRECT_URL, }, ) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP assert result["url"] == ( f"{OAUTH2_AUTHORIZE}?response_type=code&client_id={CLIENT_ID}" f"&redirect_uri={REDIRECT_URL}" @@ -118,7 +118,7 @@ async def test_token_error( "redirect_uri": REDIRECT_URL, }, ) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP assert result["url"] == ( f"{OAUTH2_AUTHORIZE}?response_type=code&client_id={CLIENT_ID}" f"&redirect_uri={REDIRECT_URL}" @@ -137,7 +137,7 @@ async def test_token_error( ) result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == error_reason @@ -177,7 +177,7 @@ async def test_api_failure( "redirect_uri": REDIRECT_URL, }, ) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP assert result["url"] == ( f"{OAUTH2_AUTHORIZE}?response_type=code&client_id={CLIENT_ID}" f"&redirect_uri={REDIRECT_URL}" @@ -203,7 +203,7 @@ async def test_api_failure( ) result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == error_reason @@ -233,7 +233,7 @@ async def test_config_entry_already_exists( "redirect_uri": REDIRECT_URL, }, ) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP assert result["url"] == ( f"{OAUTH2_AUTHORIZE}?response_type=code&client_id={CLIENT_ID}" f"&redirect_uri={REDIRECT_URL}" @@ -252,7 +252,7 @@ async def test_config_entry_already_exists( ) result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "already_configured" @@ -487,7 +487,7 @@ async def test_reauth_flow( flow_id=result["flow_id"], user_input={}, ) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP state = config_entry_oauth2_flow._encode_jwt( hass, { @@ -522,7 +522,7 @@ async def test_reauth_flow( ) as mock_setup: result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "reauth_successful" assert len(hass.config_entries.async_entries(DOMAIN)) == 1 @@ -554,14 +554,14 @@ async def test_reauth_wrong_user_id( "entry_id": config_entry.entry_id, }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" result = await hass.config_entries.flow.async_configure( flow_id=result["flow_id"], user_input={}, ) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP state = config_entry_oauth2_flow._encode_jwt( hass, { @@ -596,7 +596,7 @@ async def test_reauth_wrong_user_id( ) as mock_setup: result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "wrong_account" assert len(mock_setup.mock_calls) == 0 @@ -630,7 +630,7 @@ async def test_partial_profile_data( "redirect_uri": REDIRECT_URL, }, ) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP assert result["url"] == ( f"{OAUTH2_AUTHORIZE}?response_type=code&client_id={CLIENT_ID}" f"&redirect_uri={REDIRECT_URL}" diff --git a/tests/components/fivem/test_config_flow.py b/tests/components/fivem/test_config_flow.py index 174078c5420..2189a6ec34b 100644 --- a/tests/components/fivem/test_config_flow.py +++ b/tests/components/fivem/test_config_flow.py @@ -55,7 +55,7 @@ async def test_show_config_form(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" @@ -64,7 +64,7 @@ async def test_form(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None with ( @@ -83,7 +83,7 @@ async def test_form(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == USER_INPUT[CONF_HOST] assert result2["data"] == USER_INPUT assert len(mock_setup_entry.mock_calls) == 1 @@ -105,7 +105,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -125,7 +125,7 @@ async def test_form_invalid(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} @@ -145,5 +145,5 @@ async def test_form_invalid_game_name(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "invalid_game_name"} diff --git a/tests/components/fjaraskupan/test_config_flow.py b/tests/components/fjaraskupan/test_config_flow.py index b6da1fcf5b5..fa0df9241dd 100644 --- a/tests/components/fjaraskupan/test_config_flow.py +++ b/tests/components/fjaraskupan/test_config_flow.py @@ -34,10 +34,10 @@ async def test_configure(hass: HomeAssistant, mock_setup_entry) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Fjäråskupan" assert result["data"] == {} @@ -56,8 +56,8 @@ async def test_scan_no_devices(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" diff --git a/tests/components/flexit_bacnet/test_config_flow.py b/tests/components/flexit_bacnet/test_config_flow.py index 7d864a80c2d..77895ac647e 100644 --- a/tests/components/flexit_bacnet/test_config_flow.py +++ b/tests/components/flexit_bacnet/test_config_flow.py @@ -23,7 +23,7 @@ async def test_form( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Device Name" assert result["context"]["unique_id"] == "0000-0001" assert result["data"] == { @@ -67,7 +67,7 @@ async def test_flow_fails( }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": message} assert len(mock_setup_entry.mock_calls) == 0 @@ -81,7 +81,7 @@ async def test_flow_fails( }, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Device Name" assert result2["context"]["unique_id"] == "0000-0001" assert result2["data"] == { @@ -105,5 +105,5 @@ async def test_form_device_already_exist( }, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/flick_electric/test_config_flow.py b/tests/components/flick_electric/test_config_flow.py index 9635f3a1526..1b56aaf6376 100644 --- a/tests/components/flick_electric/test_config_flow.py +++ b/tests/components/flick_electric/test_config_flow.py @@ -4,10 +4,11 @@ from unittest.mock import patch from pyflick.authentication import AuthException -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.flick_electric.const import DOMAIN from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -47,7 +48,7 @@ async def test_form(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Flick Electric: test-username" assert result2["data"] == CONF assert len(mock_setup_entry.mock_calls) == 1 @@ -69,7 +70,7 @@ async def test_form_duplicate_login(hass: HomeAssistant) -> None: ): result = await _flow_submit(hass) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -81,7 +82,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None: ): result = await _flow_submit(hass) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "invalid_auth"} @@ -93,7 +94,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None: ): result = await _flow_submit(hass) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} @@ -105,5 +106,5 @@ async def test_form_generic_exception(hass: HomeAssistant) -> None: ): result = await _flow_submit(hass) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "unknown"} diff --git a/tests/components/flipr/test_config_flow.py b/tests/components/flipr/test_config_flow.py index 4ee6d85cead..60dcc15a701 100644 --- a/tests/components/flipr/test_config_flow.py +++ b/tests/components/flipr/test_config_flow.py @@ -5,10 +5,11 @@ from unittest.mock import patch import pytest from requests.exceptions import HTTPError, Timeout -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.flipr.const import CONF_FLIPR_ID, DOMAIN from homeassistant.const import CONF_EMAIL, CONF_PASSWORD from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType @pytest.fixture(name="mock_setup") @@ -27,7 +28,7 @@ async def test_show_form(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == config_entries.SOURCE_USER @@ -69,7 +70,7 @@ async def test_nominal_case(hass: HomeAssistant, mock_setup) -> None: assert len(mock_flipr_client.mock_calls) == 1 - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "flipid" assert result["data"] == { CONF_EMAIL: "dummylogin", @@ -93,7 +94,7 @@ async def test_multiple_flip_id(hass: HomeAssistant, mock_setup) -> None: }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "flipr_id" result = await hass.config_entries.flow.async_configure( @@ -103,7 +104,7 @@ async def test_multiple_flip_id(hass: HomeAssistant, mock_setup) -> None: assert len(mock_flipr_client.mock_calls) == 1 - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "FLIP2" assert result["data"] == { CONF_EMAIL: "dummylogin", diff --git a/tests/components/flux_led/test_config_flow.py b/tests/components/flux_led/test_config_flow.py index 63a7a671871..a4ba42ed629 100644 --- a/tests/components/flux_led/test_config_flow.py +++ b/tests/components/flux_led/test_config_flow.py @@ -393,7 +393,7 @@ async def test_discovered_by_discovery_and_dhcp(hass: HomeAssistant) -> None: data=FLUX_DISCOVERY, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None with _patch_discovery(), _patch_wifibulb(): @@ -403,7 +403,7 @@ async def test_discovered_by_discovery_and_dhcp(hass: HomeAssistant) -> None: data=DHCP_DISCOVERY, ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_in_progress" with _patch_discovery(), _patch_wifibulb(): @@ -417,7 +417,7 @@ async def test_discovered_by_discovery_and_dhcp(hass: HomeAssistant) -> None: ), ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "already_in_progress" @@ -432,7 +432,7 @@ async def test_discovered_by_discovery(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None with ( @@ -471,7 +471,7 @@ async def test_discovered_by_dhcp_udp_responds(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None with ( @@ -510,7 +510,7 @@ async def test_discovered_by_dhcp_no_udp_response(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None with ( @@ -545,7 +545,7 @@ async def test_discovered_by_dhcp_partial_udp_response_fallback_tcp( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None with ( @@ -581,7 +581,7 @@ async def test_discovered_by_dhcp_no_udp_response_or_tcp_response( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -605,7 +605,7 @@ async def test_discovered_by_dhcp_or_discovery_adds_missing_unique_id( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert config_entry.unique_id == MAC_ADDRESS @@ -628,7 +628,7 @@ async def test_mac_address_off_by_one_updated_via_discovery( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert config_entry.unique_id == MAC_ADDRESS @@ -649,7 +649,7 @@ async def test_mac_address_off_by_one_not_updated_from_dhcp( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert config_entry.unique_id == MAC_ADDRESS_ONE_OFF @@ -677,7 +677,7 @@ async def test_discovered_by_dhcp_or_discovery_mac_address_mismatch_host_already ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert config_entry.unique_id == MAC_ADDRESS_DIFFERENT @@ -745,5 +745,5 @@ async def test_discovered_can_be_ignored(hass: HomeAssistant, source, data) -> N ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/forecast_solar/test_config_flow.py b/tests/components/forecast_solar/test_config_flow.py index 015bd809b20..abaad402e1b 100644 --- a/tests/components/forecast_solar/test_config_flow.py +++ b/tests/components/forecast_solar/test_config_flow.py @@ -25,7 +25,7 @@ async def test_user_flow(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> No DOMAIN, context={"source": SOURCE_USER} ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "user" result2 = await hass.config_entries.flow.async_configure( @@ -40,7 +40,7 @@ async def test_user_flow(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> No }, ) - assert result2.get("type") == FlowResultType.CREATE_ENTRY + assert result2.get("type") is FlowResultType.CREATE_ENTRY assert result2.get("title") == "Name" assert result2.get("data") == { CONF_LATITUDE: 52.42, @@ -67,7 +67,7 @@ async def test_options_flow_invalid_api( result = await hass.config_entries.options.async_init(mock_config_entry.entry_id) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "init" result2 = await hass.config_entries.options.async_configure( @@ -84,7 +84,7 @@ async def test_options_flow_invalid_api( ) await hass.async_block_till_done() - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2["errors"] == {CONF_API_KEY: "invalid_api_key"} @@ -100,7 +100,7 @@ async def test_options_flow( result = await hass.config_entries.options.async_init(mock_config_entry.entry_id) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "init" # With the API key @@ -118,7 +118,7 @@ async def test_options_flow( ) await hass.async_block_till_done() - assert result2.get("type") == FlowResultType.CREATE_ENTRY + assert result2.get("type") is FlowResultType.CREATE_ENTRY assert result2.get("data") == { CONF_API_KEY: "SolarForecast150", CONF_DECLINATION: 21, @@ -142,7 +142,7 @@ async def test_options_flow_without_key( result = await hass.config_entries.options.async_init(mock_config_entry.entry_id) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "init" # Without the API key @@ -159,7 +159,7 @@ async def test_options_flow_without_key( ) await hass.async_block_till_done() - assert result2.get("type") == FlowResultType.CREATE_ENTRY + assert result2.get("type") is FlowResultType.CREATE_ENTRY assert result2.get("data") == { CONF_API_KEY: None, CONF_DECLINATION: 21, diff --git a/tests/components/forked_daapd/test_config_flow.py b/tests/components/forked_daapd/test_config_flow.py index a7f0dc3f603..593b527009b 100644 --- a/tests/components/forked_daapd/test_config_flow.py +++ b/tests/components/forked_daapd/test_config_flow.py @@ -5,7 +5,6 @@ from unittest.mock import AsyncMock, MagicMock, patch import pytest -from homeassistant import data_entry_flow from homeassistant.components import zeroconf from homeassistant.components.forked_daapd.const import ( CONF_LIBRESPOT_JAVA_PORT, @@ -18,6 +17,7 @@ from homeassistant.components.forked_daapd.media_player import async_setup_entry from homeassistant.config_entries import SOURCE_USER, SOURCE_ZEROCONF from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from homeassistant.exceptions import PlatformNotReady from tests.common import MockConfigEntry @@ -63,7 +63,7 @@ async def test_show_form(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" @@ -86,7 +86,7 @@ async def test_config_flow(hass: HomeAssistant, config_entry) -> None: DOMAIN, context={"source": SOURCE_USER}, data=config_data ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "My Music on myhost" assert result["data"][CONF_HOST] == config_data[CONF_HOST] assert result["data"][CONF_PORT] == config_data[CONF_PORT] @@ -99,7 +99,7 @@ async def test_config_flow(hass: HomeAssistant, config_entry) -> None: data=config_entry.data, ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT async def test_zeroconf_updates_title(hass: HomeAssistant, config_entry) -> None: @@ -120,7 +120,7 @@ async def test_zeroconf_updates_title(hass: HomeAssistant, config_entry) -> None DOMAIN, context={"source": SOURCE_ZEROCONF}, data=discovery_info ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert config_entry.title == "zeroconf_test" assert len(hass.config_entries.async_entries(DOMAIN)) == 2 @@ -136,7 +136,7 @@ async def test_config_flow_no_websocket(hass: HomeAssistant, config_entry) -> No result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=config_entry.data ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM async def test_config_flow_zeroconf_invalid(hass: HomeAssistant) -> None: @@ -154,7 +154,7 @@ async def test_config_flow_zeroconf_invalid(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_ZEROCONF}, data=discovery_info ) # doesn't create the entry, tries to show form but gets abort - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_forked_daapd" # test with forked-daapd version < 27 discovery_info = zeroconf.ZeroconfServiceInfo( @@ -169,7 +169,7 @@ async def test_config_flow_zeroconf_invalid(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_ZEROCONF}, data=discovery_info ) # doesn't create the entry, tries to show form but gets abort - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_forked_daapd" # test with verbose mtd-version from Firefly discovery_info = zeroconf.ZeroconfServiceInfo( @@ -184,7 +184,7 @@ async def test_config_flow_zeroconf_invalid(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_ZEROCONF}, data=discovery_info ) # doesn't create the entry, tries to show form but gets abort - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_forked_daapd" # test with svn mtd-version from Firefly discovery_info = zeroconf.ZeroconfServiceInfo( @@ -199,7 +199,7 @@ async def test_config_flow_zeroconf_invalid(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_ZEROCONF}, data=discovery_info ) # doesn't create the entry, tries to show form but gets abort - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_forked_daapd" @@ -221,7 +221,7 @@ async def test_config_flow_zeroconf_valid(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_ZEROCONF}, data=discovery_info ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM async def test_options_flow(hass: HomeAssistant, config_entry) -> None: @@ -237,7 +237,7 @@ async def test_options_flow(hass: HomeAssistant, config_entry) -> None: await hass.async_block_till_done() result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.options.async_configure( result["flow_id"], @@ -248,7 +248,7 @@ async def test_options_flow(hass: HomeAssistant, config_entry) -> None: CONF_MAX_PLAYLISTS: 8, }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY async def test_async_setup_entry_not_ready(hass: HomeAssistant, config_entry) -> None: diff --git a/tests/components/foscam/test_config_flow.py b/tests/components/foscam/test_config_flow.py index 64ad2b946da..9c0a07aa67c 100644 --- a/tests/components/foscam/test_config_flow.py +++ b/tests/components/foscam/test_config_flow.py @@ -9,9 +9,10 @@ from libpyfoscam.foscam import ( ERROR_FOSCAM_UNKNOWN, ) -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.foscam import config_flow from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -82,7 +83,7 @@ async def test_user_valid(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with ( @@ -103,7 +104,7 @@ async def test_user_valid(hass: HomeAssistant) -> None: await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == CAMERA_NAME assert result["data"] == VALID_CONFIG @@ -116,7 +117,7 @@ async def test_user_invalid_auth(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with patch( @@ -134,7 +135,7 @@ async def test_user_invalid_auth(hass: HomeAssistant) -> None: await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "invalid_auth"} @@ -144,7 +145,7 @@ async def test_user_cannot_connect(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with patch( @@ -162,7 +163,7 @@ async def test_user_cannot_connect(hass: HomeAssistant) -> None: await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} @@ -172,7 +173,7 @@ async def test_user_invalid_response(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with patch( @@ -192,7 +193,7 @@ async def test_user_invalid_response(hass: HomeAssistant) -> None: await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "invalid_response"} @@ -208,7 +209,7 @@ async def test_user_already_configured(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with patch( @@ -223,7 +224,7 @@ async def test_user_already_configured(hass: HomeAssistant) -> None: await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -233,7 +234,7 @@ async def test_user_unknown_exception(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with patch( @@ -248,5 +249,5 @@ async def test_user_unknown_exception(hass: HomeAssistant) -> None: await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "unknown"} diff --git a/tests/components/freebox/test_config_flow.py b/tests/components/freebox/test_config_flow.py index a7dff79ecfb..ca9e9c12937 100644 --- a/tests/components/freebox/test_config_flow.py +++ b/tests/components/freebox/test_config_flow.py @@ -9,12 +9,12 @@ from freebox_api.exceptions import ( InvalidTokenError, ) -from homeassistant import data_entry_flow from homeassistant.components import zeroconf from homeassistant.components.freebox.const import DOMAIN from homeassistant.config_entries import SOURCE_USER, SOURCE_ZEROCONF from homeassistant.const import CONF_HOST, CONF_PORT from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from .const import MOCK_HOST, MOCK_PORT @@ -46,7 +46,7 @@ async def test_user(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" # test with all provided @@ -55,7 +55,7 @@ async def test_user(hass: HomeAssistant) -> None: context={"source": SOURCE_USER}, data={CONF_HOST: MOCK_HOST, CONF_PORT: MOCK_PORT}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "link" @@ -66,7 +66,7 @@ async def test_zeroconf(hass: HomeAssistant) -> None: context={"source": SOURCE_ZEROCONF}, data=MOCK_ZEROCONF_DATA, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "link" @@ -83,7 +83,7 @@ async def internal_test_link(hass: HomeAssistant) -> None: ) result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["result"].unique_id == MOCK_HOST assert result["title"] == MOCK_HOST assert result["data"][CONF_HOST] == MOCK_HOST @@ -112,7 +112,7 @@ async def test_link_bridge_mode_error( data={CONF_HOST: MOCK_HOST, CONF_PORT: MOCK_PORT}, ) result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} @@ -130,7 +130,7 @@ async def test_abort_if_already_setup(hass: HomeAssistant) -> None: context={"source": SOURCE_USER}, data={CONF_HOST: MOCK_HOST, CONF_PORT: MOCK_PORT}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -147,7 +147,7 @@ async def test_on_link_failed(hass: HomeAssistant) -> None: side_effect=AuthorizationError(), ): result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "register_failed"} with patch( @@ -155,7 +155,7 @@ async def test_on_link_failed(hass: HomeAssistant) -> None: side_effect=HttpRequestError(), ): result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} with patch( @@ -163,5 +163,5 @@ async def test_on_link_failed(hass: HomeAssistant) -> None: side_effect=InvalidTokenError(), ): result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "unknown"} diff --git a/tests/components/freedompro/test_config_flow.py b/tests/components/freedompro/test_config_flow.py index a0063f72557..0999f157661 100644 --- a/tests/components/freedompro/test_config_flow.py +++ b/tests/components/freedompro/test_config_flow.py @@ -4,11 +4,11 @@ from unittest.mock import patch import pytest -from homeassistant import data_entry_flow from homeassistant.components.freedompro.const import DOMAIN from homeassistant.config_entries import SOURCE_USER from homeassistant.const import CONF_API_KEY from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from .const import DEVICES @@ -25,7 +25,7 @@ async def test_show_form(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" @@ -80,6 +80,6 @@ async def test_create_entry(hass: HomeAssistant) -> None: data=VALID_CONFIG, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Freedompro" assert result["data"][CONF_API_KEY] == "ksdjfgslkjdfksjdfksjgfksjd" diff --git a/tests/components/fritz/test_config_flow.py b/tests/components/fritz/test_config_flow.py index fbd9886f468..074d32bf0ca 100644 --- a/tests/components/fritz/test_config_flow.py +++ b/tests/components/fritz/test_config_flow.py @@ -10,7 +10,6 @@ from fritzconnection.core.exceptions import ( ) import pytest -from homeassistant import data_entry_flow from homeassistant.components.device_tracker import ( CONF_CONSIDER_HOME, DEFAULT_CONSIDER_HOME, @@ -71,13 +70,13 @@ async def test_user(hass: HomeAssistant, fc_class_mock, mock_get_source_ip) -> N result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_USER_DATA ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_HOST] == "fake_host" assert result["data"][CONF_PASSWORD] == "fake_pass" assert result["data"][CONF_USERNAME] == "fake_user" @@ -127,13 +126,13 @@ async def test_user_already_configured( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_USER_DATA ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"]["base"] == "already_configured" @@ -150,7 +149,7 @@ async def test_exception_security( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with patch( @@ -161,7 +160,7 @@ async def test_exception_security( result["flow_id"], user_input=MOCK_USER_DATA ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"]["base"] == ERROR_AUTH_INVALID @@ -172,7 +171,7 @@ async def test_exception_connection(hass: HomeAssistant, mock_get_source_ip) -> result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with patch( @@ -183,7 +182,7 @@ async def test_exception_connection(hass: HomeAssistant, mock_get_source_ip) -> result["flow_id"], user_input=MOCK_USER_DATA ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"]["base"] == ERROR_CANNOT_CONNECT @@ -194,7 +193,7 @@ async def test_exception_unknown(hass: HomeAssistant, mock_get_source_ip) -> Non result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with patch( @@ -205,7 +204,7 @@ async def test_exception_unknown(hass: HomeAssistant, mock_get_source_ip) -> Non result["flow_id"], user_input=MOCK_USER_DATA ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"]["base"] == ERROR_UNKNOWN @@ -248,7 +247,7 @@ async def test_reauth_successful( data=mock_config.data, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" result = await hass.config_entries.flow.async_configure( @@ -259,7 +258,7 @@ async def test_reauth_successful( }, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert mock_setup_entry.called @@ -291,7 +290,7 @@ async def test_reauth_not_successful( data=mock_config.data, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" result = await hass.config_entries.flow.async_configure( @@ -302,7 +301,7 @@ async def test_reauth_not_successful( }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["errors"]["base"] == error @@ -332,7 +331,7 @@ async def test_ssdp_already_configured( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -361,7 +360,7 @@ async def test_ssdp_already_configured_host( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -390,7 +389,7 @@ async def test_ssdp_already_configured_host_uuid( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -405,7 +404,7 @@ async def test_ssdp_already_in_progress_host( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" MOCK_NO_UNIQUE_ID = dataclasses.replace(MOCK_SSDP_DATA) @@ -414,7 +413,7 @@ async def test_ssdp_already_in_progress_host( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_NO_UNIQUE_ID ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_in_progress" @@ -441,7 +440,7 @@ async def test_ssdp(hass: HomeAssistant, fc_class_mock, mock_get_source_ip) -> N result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" result = await hass.config_entries.flow.async_configure( @@ -452,7 +451,7 @@ async def test_ssdp(hass: HomeAssistant, fc_class_mock, mock_get_source_ip) -> N }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_HOST] == MOCK_IPS["fritz.box"] assert result["data"][CONF_PASSWORD] == "fake_pass" assert result["data"][CONF_USERNAME] == "fake_user" @@ -469,7 +468,7 @@ async def test_ssdp_exception(hass: HomeAssistant, mock_get_source_ip) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" result = await hass.config_entries.flow.async_configure( @@ -480,7 +479,7 @@ async def test_ssdp_exception(hass: HomeAssistant, mock_get_source_ip) -> None: }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" @@ -500,7 +499,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { CONF_OLD_DISCOVERY: False, CONF_CONSIDER_HOME: 37, diff --git a/tests/components/fritzbox/test_config_flow.py b/tests/components/fritzbox/test_config_flow.py index 690082085f8..53a4f1c5205 100644 --- a/tests/components/fritzbox/test_config_flow.py +++ b/tests/components/fritzbox/test_config_flow.py @@ -68,13 +68,13 @@ async def test_user(hass: HomeAssistant, fritz: Mock) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_USER_DATA ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "10.0.0.1" assert result["data"][CONF_HOST] == "10.0.0.1" assert result["data"][CONF_PASSWORD] == "fake_pass" @@ -89,7 +89,7 @@ async def test_user_auth_failed(hass: HomeAssistant, fritz: Mock) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=MOCK_USER_DATA ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"]["base"] == "invalid_auth" @@ -101,7 +101,7 @@ async def test_user_not_successful(hass: HomeAssistant, fritz: Mock) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=MOCK_USER_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -110,13 +110,13 @@ async def test_user_already_configured(hass: HomeAssistant, fritz: Mock) -> None result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=MOCK_USER_DATA ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert not result["result"].unique_id result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=MOCK_USER_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -130,7 +130,7 @@ async def test_reauth_success(hass: HomeAssistant, fritz: Mock) -> None: context={"source": SOURCE_REAUTH, "entry_id": mock_config.entry_id}, data=mock_config.data, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" result = await hass.config_entries.flow.async_configure( @@ -141,7 +141,7 @@ async def test_reauth_success(hass: HomeAssistant, fritz: Mock) -> None: }, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert mock_config.data[CONF_USERNAME] == "other_fake_user" assert mock_config.data[CONF_PASSWORD] == "other_fake_password" @@ -159,7 +159,7 @@ async def test_reauth_auth_failed(hass: HomeAssistant, fritz: Mock) -> None: context={"source": SOURCE_REAUTH, "entry_id": mock_config.entry_id}, data=mock_config.data, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" result = await hass.config_entries.flow.async_configure( @@ -170,7 +170,7 @@ async def test_reauth_auth_failed(hass: HomeAssistant, fritz: Mock) -> None: }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["errors"]["base"] == "invalid_auth" @@ -187,7 +187,7 @@ async def test_reauth_not_successful(hass: HomeAssistant, fritz: Mock) -> None: context={"source": SOURCE_REAUTH, "entry_id": mock_config.entry_id}, data=mock_config.data, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" result = await hass.config_entries.flow.async_configure( @@ -198,7 +198,7 @@ async def test_reauth_not_successful(hass: HomeAssistant, fritz: Mock) -> None: }, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -222,7 +222,7 @@ async def test_ssdp( ) assert result["type"] == expected_result - if expected_result == FlowResultType.ABORT: + if expected_result is FlowResultType.ABORT: return assert result["step_id"] == "confirm" @@ -231,7 +231,7 @@ async def test_ssdp( result["flow_id"], user_input={CONF_PASSWORD: "fake_pass", CONF_USERNAME: "fake_user"}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == CONF_FAKE_NAME assert result["data"][CONF_HOST] == urlparse(test_data.ssdp_location).hostname assert result["data"][CONF_PASSWORD] == "fake_pass" @@ -247,14 +247,14 @@ async def test_ssdp_no_friendly_name(hass: HomeAssistant, fritz: Mock) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_NO_NAME ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_PASSWORD: "fake_pass", CONF_USERNAME: "fake_user"}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "10.0.0.1" assert result["data"][CONF_HOST] == "10.0.0.1" assert result["data"][CONF_PASSWORD] == "fake_pass" @@ -269,7 +269,7 @@ async def test_ssdp_auth_failed(hass: HomeAssistant, fritz: Mock) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA["ip4_valid"] ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" assert result["errors"] == {} @@ -277,7 +277,7 @@ async def test_ssdp_auth_failed(hass: HomeAssistant, fritz: Mock) -> None: result["flow_id"], user_input={CONF_PASSWORD: "whatever", CONF_USERNAME: "whatever"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" assert result["errors"]["base"] == "invalid_auth" @@ -289,14 +289,14 @@ async def test_ssdp_not_successful(hass: HomeAssistant, fritz: Mock) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA["ip4_valid"] ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_PASSWORD: "whatever", CONF_USERNAME: "whatever"}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -307,14 +307,14 @@ async def test_ssdp_not_supported(hass: HomeAssistant, fritz: Mock) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA["ip4_valid"] ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_PASSWORD: "whatever", CONF_USERNAME: "whatever"}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_supported" @@ -325,13 +325,13 @@ async def test_ssdp_already_in_progress_unique_id( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA["ip4_valid"] ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA["ip4_valid"] ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_in_progress" @@ -340,7 +340,7 @@ async def test_ssdp_already_in_progress_host(hass: HomeAssistant, fritz: Mock) - result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA["ip4_valid"] ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" MOCK_NO_UNIQUE_ID = dataclasses.replace(MOCK_SSDP_DATA["ip4_valid"]) @@ -349,7 +349,7 @@ async def test_ssdp_already_in_progress_host(hass: HomeAssistant, fritz: Mock) - result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_NO_UNIQUE_ID ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_in_progress" @@ -358,12 +358,12 @@ async def test_ssdp_already_configured(hass: HomeAssistant, fritz: Mock) -> None result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=MOCK_USER_DATA ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert not result["result"].unique_id result2 = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA["ip4_valid"] ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" assert result["result"].unique_id == "only-a-test" diff --git a/tests/components/fritzbox_callmonitor/test_config_flow.py b/tests/components/fritzbox_callmonitor/test_config_flow.py index 33e2d8fb125..14f18e84e0c 100644 --- a/tests/components/fritzbox_callmonitor/test_config_flow.py +++ b/tests/components/fritzbox_callmonitor/test_config_flow.py @@ -90,7 +90,7 @@ async def test_setup_one_phonebook(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with ( @@ -129,7 +129,7 @@ async def test_setup_one_phonebook(hass: HomeAssistant) -> None: result["flow_id"], user_input=MOCK_USER_DATA ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == MOCK_PHONEBOOK_NAME_1 assert result["data"] == MOCK_CONFIG_ENTRY assert len(mock_setup_entry.mock_calls) == 1 @@ -141,7 +141,7 @@ async def test_setup_multiple_phonebooks(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with ( @@ -172,7 +172,7 @@ async def test_setup_multiple_phonebooks(hass: HomeAssistant) -> None: result["flow_id"], user_input=MOCK_USER_DATA ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "phonebook" assert result["errors"] == {} @@ -191,7 +191,7 @@ async def test_setup_multiple_phonebooks(hass: HomeAssistant) -> None: {CONF_PHONEBOOK: MOCK_PHONEBOOK_NAME_2}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == MOCK_PHONEBOOK_NAME_2 assert result["data"] == { CONF_HOST: MOCK_HOST, @@ -219,7 +219,7 @@ async def test_setup_cannot_connect(hass: HomeAssistant) -> None: result["flow_id"], user_input=MOCK_USER_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == ConnectResult.NO_DEVIES_FOUND @@ -238,7 +238,7 @@ async def test_setup_insufficient_permissions(hass: HomeAssistant) -> None: result["flow_id"], user_input=MOCK_USER_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == ConnectResult.INSUFFICIENT_PERMISSIONS @@ -260,7 +260,7 @@ async def test_setup_invalid_auth( result["flow_id"], user_input=MOCK_USER_DATA ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": ConnectResult.INVALID_AUTH} @@ -282,14 +282,14 @@ async def test_options_flow_correct_prefixes(hass: HomeAssistant) -> None: await hass.config_entries.async_setup(config_entry.entry_id) result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( result["flow_id"], user_input={CONF_PREFIXES: "+49, 491234"} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == {CONF_PREFIXES: ["+49", "491234"]} @@ -311,14 +311,14 @@ async def test_options_flow_incorrect_prefixes(hass: HomeAssistant) -> None: await hass.config_entries.async_setup(config_entry.entry_id) result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( result["flow_id"], user_input={CONF_PREFIXES: ""} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": ConnectResult.MALFORMED_PREFIXES} @@ -340,12 +340,12 @@ async def test_options_flow_no_prefixes(hass: HomeAssistant) -> None: await hass.config_entries.async_setup(config_entry.entry_id) result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( result["flow_id"], user_input={} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == {CONF_PREFIXES: None} diff --git a/tests/components/fronius/test_config_flow.py b/tests/components/fronius/test_config_flow.py index c09baeb2d22..bf5ef360752 100644 --- a/tests/components/fronius/test_config_flow.py +++ b/tests/components/fronius/test_config_flow.py @@ -49,7 +49,7 @@ async def test_form_with_logger(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None with ( @@ -70,7 +70,7 @@ async def test_form_with_logger(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "SolarNet Datalogger at 10.9.8.1" assert result2["data"] == { "host": "10.9.8.1", @@ -84,7 +84,7 @@ async def test_form_with_inverter(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None with ( @@ -109,7 +109,7 @@ async def test_form_with_inverter(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "SolarNet Inverter at 10.9.1.1" assert result2["data"] == { "host": "10.9.1.1", @@ -141,7 +141,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -168,7 +168,7 @@ async def test_form_no_device(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -189,7 +189,7 @@ async def test_form_unexpected(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} @@ -217,7 +217,7 @@ async def test_form_already_existing(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" @@ -259,7 +259,7 @@ async def test_form_updates_host( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" mock_unload_entry.assert_called_with(hass, entry) @@ -283,13 +283,13 @@ async def test_dhcp(hass: HomeAssistant, aioclient_mock: AiohttpClientMocker) -> result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_DHCP}, data=MOCK_DHCP_DATA ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm_discovery" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == f"SolarNet Datalogger at {MOCK_DHCP_DATA.ip}" assert result["data"] == { "host": MOCK_DHCP_DATA.ip, @@ -314,7 +314,7 @@ async def test_dhcp_already_configured( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_DHCP}, data=MOCK_DHCP_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -336,5 +336,5 @@ async def test_dhcp_invalid( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_DHCP}, data=MOCK_DHCP_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "invalid_host" diff --git a/tests/components/frontier_silicon/test_config_flow.py b/tests/components/frontier_silicon/test_config_flow.py index 6a5e62f7dce..04bd1febdf8 100644 --- a/tests/components/frontier_silicon/test_config_flow.py +++ b/tests/components/frontier_silicon/test_config_flow.py @@ -52,7 +52,7 @@ async def test_form_default_pin( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -67,7 +67,7 @@ async def test_form_default_pin( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Name of the device" assert result2["data"] == { CONF_WEBFSAPI_URL: "http://1.1.1.1:80/webfsapi", @@ -90,7 +90,7 @@ async def test_form_nondefault_pin( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -104,7 +104,7 @@ async def test_form_nondefault_pin( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "device_config" assert result2["errors"] is None @@ -119,7 +119,7 @@ async def test_form_nondefault_pin( ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == "Name of the device" assert result3["data"] == { CONF_WEBFSAPI_URL: "http://1.1.1.1:80/webfsapi", @@ -146,7 +146,7 @@ async def test_form_nondefault_pin_invalid( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -160,7 +160,7 @@ async def test_form_nondefault_pin_invalid( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "device_config" assert result2["errors"] is None @@ -174,7 +174,7 @@ async def test_form_nondefault_pin_invalid( ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result2["step_id"] == "device_config" assert result3["errors"] == {"base": result_error} @@ -184,7 +184,7 @@ async def test_form_nondefault_pin_invalid( ) await hass.async_block_till_done() - assert result4["type"] == FlowResultType.CREATE_ENTRY + assert result4["type"] is FlowResultType.CREATE_ENTRY assert result4["title"] == "Name of the device" assert result4["data"] == { CONF_WEBFSAPI_URL: "http://1.1.1.1:80/webfsapi", @@ -210,7 +210,7 @@ async def test_invalid_device_url( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -224,7 +224,7 @@ async def test_invalid_device_url( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "user" assert result2["errors"] == {"base": result_error} @@ -234,7 +234,7 @@ async def test_invalid_device_url( ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == "Name of the device" assert result3["data"] == { CONF_WEBFSAPI_URL: "http://1.1.1.1:80/webfsapi", @@ -265,7 +265,7 @@ async def test_ssdp( data=MOCK_DISCOVERY, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" result2 = await hass.config_entries.flow.async_configure( @@ -273,7 +273,7 @@ async def test_ssdp( {}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Name of the device" assert result2["data"] == { CONF_WEBFSAPI_URL: "http://1.1.1.1:80/webfsapi", @@ -291,7 +291,7 @@ async def test_ssdp_invalid_location(hass: HomeAssistant) -> None: data=INVALID_MOCK_DISCOVERY, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -308,7 +308,7 @@ async def test_ssdp_already_configured( data=MOCK_DISCOVERY, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -330,7 +330,7 @@ async def test_ssdp_fail( data=MOCK_DISCOVERY, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == result_error @@ -347,7 +347,7 @@ async def test_ssdp_nondefault_pin(hass: HomeAssistant) -> None: data=MOCK_DISCOVERY, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "invalid_auth" @@ -365,14 +365,14 @@ async def test_reauth_flow(hass: HomeAssistant, config_entry: MockConfigEntry) - }, data=config_entry.data, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "device_config" result2 = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_PIN: "4242"}, ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "reauth_successful" assert config_entry.data[CONF_PIN] == "4242" @@ -404,7 +404,7 @@ async def test_reauth_flow_friendly_name_error( }, data=config_entry.data, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "device_config" with patch( @@ -417,7 +417,7 @@ async def test_reauth_flow_friendly_name_error( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "device_config" assert result2["errors"] == {"base": reason} @@ -425,6 +425,6 @@ async def test_reauth_flow_friendly_name_error( result["flow_id"], user_input={CONF_PIN: "4242"}, ) - assert result3["type"] == FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "reauth_successful" assert config_entry.data[CONF_PIN] == "4242" diff --git a/tests/components/fully_kiosk/test_config_flow.py b/tests/components/fully_kiosk/test_config_flow.py index 6a78eda070f..873fb2c6796 100644 --- a/tests/components/fully_kiosk/test_config_flow.py +++ b/tests/components/fully_kiosk/test_config_flow.py @@ -32,7 +32,7 @@ async def test_user_flow( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "user" result2 = await hass.config_entries.flow.async_configure( @@ -45,7 +45,7 @@ async def test_user_flow( }, ) - assert result2.get("type") == FlowResultType.CREATE_ENTRY + assert result2.get("type") is FlowResultType.CREATE_ENTRY assert result2.get("title") == "Test device" assert result2.get("data") == { CONF_HOST: "1.1.1.1", @@ -94,7 +94,7 @@ async def test_errors( }, ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "user" assert result2.get("errors") == {"base": reason} @@ -112,7 +112,7 @@ async def test_errors( }, ) - assert result3.get("type") == FlowResultType.CREATE_ENTRY + assert result3.get("type") is FlowResultType.CREATE_ENTRY assert result3.get("title") == "Test device" assert result3.get("data") == { CONF_HOST: "1.1.1.1", @@ -139,7 +139,7 @@ async def test_duplicate_updates_existing_entry( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "user" result2 = await hass.config_entries.flow.async_configure( @@ -152,7 +152,7 @@ async def test_duplicate_updates_existing_entry( }, ) - assert result2.get("type") == FlowResultType.ABORT + assert result2.get("type") is FlowResultType.ABORT assert result2.get("reason") == "already_configured" assert mock_config_entry.data == { CONF_HOST: "1.1.1.1", @@ -182,7 +182,7 @@ async def test_dhcp_discovery_updates_entry( ), ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "already_configured" assert mock_config_entry.data == { CONF_HOST: "127.0.0.2", @@ -210,7 +210,7 @@ async def test_dhcp_unknown_device( ), ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "unknown" @@ -234,7 +234,7 @@ async def test_mqtt_discovery_flow( timestamp=None, ), ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "discovery_confirm" confirmResult = await hass.config_entries.flow.async_configure( @@ -247,7 +247,7 @@ async def test_mqtt_discovery_flow( ) assert confirmResult - assert confirmResult.get("type") == FlowResultType.CREATE_ENTRY + assert confirmResult.get("type") is FlowResultType.CREATE_ENTRY assert confirmResult.get("title") == "Test device" assert confirmResult.get("data") == { CONF_HOST: "192.168.1.234", diff --git a/tests/components/fyta/test_config_flow.py b/tests/components/fyta/test_config_flow.py index b21be5abb90..93b83caa379 100644 --- a/tests/components/fyta/test_config_flow.py +++ b/tests/components/fyta/test_config_flow.py @@ -10,10 +10,11 @@ from fyta_cli.fyta_exceptions import ( ) import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.fyta.const import DOMAIN from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -31,7 +32,7 @@ async def test_user_flow( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} result2 = await hass.config_entries.flow.async_configure( @@ -75,7 +76,7 @@ async def test_form_exceptions( ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == error @@ -87,7 +88,7 @@ async def test_form_exceptions( ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == USERNAME assert result["data"][CONF_USERNAME] == USERNAME assert result["data"][CONF_PASSWORD] == PASSWORD @@ -108,7 +109,7 @@ async def test_duplicate_entry(hass: HomeAssistant, mock_fyta: AsyncMock) -> Non DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -118,5 +119,5 @@ async def test_duplicate_entry(hass: HomeAssistant, mock_fyta: AsyncMock) -> Non ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/garages_amsterdam/test_config_flow.py b/tests/components/garages_amsterdam/test_config_flow.py index ae735d71e55..729d31e413c 100644 --- a/tests/components/garages_amsterdam/test_config_flow.py +++ b/tests/components/garages_amsterdam/test_config_flow.py @@ -18,7 +18,7 @@ async def test_full_flow(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM with patch( "homeassistant.components.garages_amsterdam.async_setup_entry", @@ -30,7 +30,7 @@ async def test_full_flow(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2.get("type") == FlowResultType.CREATE_ENTRY + assert result2.get("type") is FlowResultType.CREATE_ENTRY assert result2.get("title") == "IJDok" assert "result" in result2 assert result2["result"].unique_id == "IJDok" @@ -59,5 +59,5 @@ async def test_error_handling( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == reason diff --git a/tests/components/gdacs/test_config_flow.py b/tests/components/gdacs/test_config_flow.py index 71e5dfdb5d5..f11848162cd 100644 --- a/tests/components/gdacs/test_config_flow.py +++ b/tests/components/gdacs/test_config_flow.py @@ -4,7 +4,7 @@ from unittest.mock import patch import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.gdacs import CONF_CATEGORIES, DOMAIN from homeassistant.const import ( CONF_LATITUDE, @@ -13,6 +13,7 @@ from homeassistant.const import ( CONF_SCAN_INTERVAL, ) from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType @pytest.fixture(name="gdacs_setup", autouse=True) @@ -30,7 +31,7 @@ async def test_duplicate_error(hass: HomeAssistant, config_entry) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER}, data=conf ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -39,7 +40,7 @@ async def test_show_form(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" @@ -52,7 +53,7 @@ async def test_step_user(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER}, data=conf ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "-41.2, 174.7" assert result["data"] == { CONF_LATITUDE: -41.2, diff --git a/tests/components/generic/test_config_flow.py b/tests/components/generic/test_config_flow.py index d9b3c848eb6..751361d47dd 100644 --- a/tests/components/generic/test_config_flow.py +++ b/tests/components/generic/test_config_flow.py @@ -84,7 +84,7 @@ async def test_form( user_flow["flow_id"], TESTDATA, ) - assert result1["type"] == FlowResultType.FORM + assert result1["type"] is FlowResultType.FORM assert result1["step_id"] == "user_confirm_still" client = await hass_client() preview_id = result1["flow_id"] @@ -97,7 +97,7 @@ async def test_form( user_input={CONF_CONFIRMED_OK: True}, ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "127_0_0_1" assert result2["options"] == { CONF_STILL_IMAGE_URL: "http://127.0.0.1/testurl/1", @@ -138,13 +138,13 @@ async def test_form_only_stillimage( data, ) await hass.async_block_till_done() - assert result1["type"] == FlowResultType.FORM + assert result1["type"] is FlowResultType.FORM assert result1["step_id"] == "user_confirm_still" result2 = await hass.config_entries.flow.async_configure( result1["flow_id"], user_input={CONF_CONFIRMED_OK: True}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "127_0_0_1" assert result2["options"] == { CONF_STILL_IMAGE_URL: "http://127.0.0.1/testurl/1", @@ -171,13 +171,13 @@ async def test_form_reject_still_preview( user_flow["flow_id"], TESTDATA, ) - assert result1["type"] == FlowResultType.FORM + assert result1["type"] is FlowResultType.FORM assert result1["step_id"] == "user_confirm_still" result2 = await hass.config_entries.flow.async_configure( result1["flow_id"], user_input={CONF_CONFIRMED_OK: False}, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "user" @@ -201,7 +201,7 @@ async def test_form_still_preview_cam_off( user_flow["flow_id"], TESTDATA, ) - assert result1["type"] == FlowResultType.FORM + assert result1["type"] is FlowResultType.FORM assert result1["step_id"] == "user_confirm_still" preview_id = result1["flow_id"] # Try to view the image, should be unavailable. @@ -222,14 +222,14 @@ async def test_form_only_stillimage_gif( user_flow["flow_id"], data, ) - assert result1["type"] == FlowResultType.FORM + assert result1["type"] is FlowResultType.FORM assert result1["step_id"] == "user_confirm_still" result2 = await hass.config_entries.flow.async_configure( result1["flow_id"], user_input={CONF_CONFIRMED_OK: True}, ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["options"][CONF_CONTENT_TYPE] == "image/gif" @@ -247,14 +247,14 @@ async def test_form_only_svg_whitespace( user_flow["flow_id"], data, ) - assert result1["type"] == FlowResultType.FORM + assert result1["type"] is FlowResultType.FORM assert result1["step_id"] == "user_confirm_still" result2 = await hass.config_entries.flow.async_configure( result1["flow_id"], user_input={CONF_CONFIRMED_OK: True}, ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY @respx.mock @@ -282,14 +282,14 @@ async def test_form_only_still_sample( user_flow["flow_id"], data, ) - assert result1["type"] == FlowResultType.FORM + assert result1["type"] is FlowResultType.FORM assert result1["step_id"] == "user_confirm_still" result2 = await hass.config_entries.flow.async_configure( result1["flow_id"], user_input={CONF_CONFIRMED_OK: True}, ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY @respx.mock @@ -371,13 +371,13 @@ async def test_form_rtsp_mode( result1 = await hass.config_entries.flow.async_configure( user_flow["flow_id"], data ) - assert result1["type"] == FlowResultType.FORM + assert result1["type"] is FlowResultType.FORM assert result1["step_id"] == "user_confirm_still" result2 = await hass.config_entries.flow.async_configure( result1["flow_id"], user_input={CONF_CONFIRMED_OK: True}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "127_0_0_1" assert result2["options"] == { CONF_STILL_IMAGE_URL: "http://127.0.0.1/testurl/1", @@ -408,14 +408,14 @@ async def test_form_only_stream( user_flow["flow_id"], data, ) - assert result1["type"] == FlowResultType.FORM + assert result1["type"] is FlowResultType.FORM assert result1["step_id"] == "user_confirm_still" result3 = await hass.config_entries.flow.async_configure( result1["flow_id"], user_input={CONF_CONFIRMED_OK: True}, ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == "127_0_0_1" assert result3["options"] == { CONF_AUTHENTICATION: HTTP_BASIC_AUTHENTICATION, @@ -451,7 +451,7 @@ async def test_form_still_and_stream_not_provided( CONF_VERIFY_SSL: False, }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "no_still_image_or_stream_url"} @@ -680,7 +680,7 @@ async def test_options_template_error( await hass.async_block_till_done() result = await hass.config_entries.options.async_init(mock_entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" # try updating the still image url @@ -691,16 +691,16 @@ async def test_options_template_error( result["flow_id"], user_input=data, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "confirm_still" result2a = await hass.config_entries.options.async_configure( result2["flow_id"], user_input={CONF_CONFIRMED_OK: True} ) - assert result2a["type"] == FlowResultType.CREATE_ENTRY + assert result2a["type"] is FlowResultType.CREATE_ENTRY result3 = await hass.config_entries.options.async_init(mock_entry.entry_id) - assert result3["type"] == FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["step_id"] == "init" # verify that an invalid template reports the correct UI error. @@ -709,7 +709,7 @@ async def test_options_template_error( result3["flow_id"], user_input=data, ) - assert result4.get("type") == FlowResultType.FORM + assert result4.get("type") is FlowResultType.FORM assert result4["errors"] == {"still_image_url": "template_error"} # verify that an invalid template reports the correct UI error. @@ -720,7 +720,7 @@ async def test_options_template_error( user_input=data, ) - assert result5.get("type") == FlowResultType.FORM + assert result5.get("type") is FlowResultType.FORM assert result5["errors"] == {"stream_source": "template_error"} # verify that an relative stream url is rejected. @@ -730,7 +730,7 @@ async def test_options_template_error( result5["flow_id"], user_input=data, ) - assert result6.get("type") == FlowResultType.FORM + assert result6.get("type") is FlowResultType.FORM assert result6["errors"] == {"stream_source": "relative_url"} # verify that an malformed stream url is rejected. @@ -740,7 +740,7 @@ async def test_options_template_error( result6["flow_id"], user_input=data, ) - assert result7.get("type") == FlowResultType.FORM + assert result7.get("type") is FlowResultType.FORM assert result7["errors"] == {"stream_source": "malformed_url"} @@ -778,7 +778,7 @@ async def test_options_only_stream( await hass.async_block_till_done() result = await hass.config_entries.options.async_init(mock_entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" # try updating the config options @@ -787,13 +787,13 @@ async def test_options_only_stream( result["flow_id"], user_input=data, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "confirm_still" result3 = await hass.config_entries.options.async_configure( result2["flow_id"], user_input={CONF_CONFIRMED_OK: True} ) - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["data"][CONF_CONTENT_TYPE] == "image/jpeg" @@ -886,7 +886,7 @@ async def test_use_wallclock_as_timestamps_option( result = await hass.config_entries.options.async_init( mock_entry.entry_id, context={"show_advanced_options": True} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" with ( patch("homeassistant.components.generic.async_setup_entry", return_value=True), @@ -896,12 +896,12 @@ async def test_use_wallclock_as_timestamps_option( result["flow_id"], user_input={CONF_USE_WALLCLOCK_AS_TIMESTAMPS: True, **TESTDATA}, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM # Test what happens if user rejects the preview result3 = await hass.config_entries.options.async_configure( result2["flow_id"], user_input={CONF_CONFIRMED_OK: False} ) - assert result3["type"] == FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["step_id"] == "init" with ( patch("homeassistant.components.generic.async_setup_entry", return_value=True), @@ -911,10 +911,10 @@ async def test_use_wallclock_as_timestamps_option( result3["flow_id"], user_input={CONF_USE_WALLCLOCK_AS_TIMESTAMPS: True, **TESTDATA}, ) - assert result4["type"] == FlowResultType.FORM + assert result4["type"] is FlowResultType.FORM assert result4["step_id"] == "confirm_still" result5 = await hass.config_entries.options.async_configure( result4["flow_id"], user_input={CONF_CONFIRMED_OK: True}, ) - assert result5["type"] == FlowResultType.CREATE_ENTRY + assert result5["type"] is FlowResultType.CREATE_ENTRY diff --git a/tests/components/geo_json_events/test_config_flow.py b/tests/components/geo_json_events/test_config_flow.py index a6e20ad4ba8..fe21bccc7aa 100644 --- a/tests/components/geo_json_events/test_config_flow.py +++ b/tests/components/geo_json_events/test_config_flow.py @@ -31,7 +31,7 @@ async def test_duplicate_error_user( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["step_id"] == "user" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure( result["flow_id"], @@ -44,7 +44,7 @@ async def test_duplicate_error_user( }, }, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -54,7 +54,7 @@ async def test_step_user(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["step_id"] == "user" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure( result["flow_id"], @@ -67,7 +67,7 @@ async def test_step_user(hass: HomeAssistant) -> None: }, }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert ( result["title"] == "http://geo.json.local/geo_json_events.json (-41.2, 174.7)" ) diff --git a/tests/components/geocaching/test_config_flow.py b/tests/components/geocaching/test_config_flow.py index 15f7ee0972f..f4e8f0c8a96 100644 --- a/tests/components/geocaching/test_config_flow.py +++ b/tests/components/geocaching/test_config_flow.py @@ -61,7 +61,7 @@ async def test_full_flow( }, ) - assert result.get("type") == FlowResultType.EXTERNAL_STEP + assert result.get("type") is FlowResultType.EXTERNAL_STEP assert result.get("step_id") == "auth" assert result.get("url") == ( f"{CURRENT_ENVIRONMENT_URLS['authorize_url']}?response_type=code&client_id={CLIENT_ID}" @@ -156,7 +156,7 @@ async def test_oauth_error( "redirect_uri": REDIRECT_URI, }, ) - assert result.get("type") == FlowResultType.EXTERNAL_STEP + assert result.get("type") is FlowResultType.EXTERNAL_STEP client = await hass_client_no_auth() resp = await client.get(f"/auth/external/callback?code=abcd&state={state}") @@ -176,7 +176,7 @@ async def test_oauth_error( ) result2 = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result2.get("type") == FlowResultType.ABORT + assert result2.get("type") is FlowResultType.ABORT assert result2.get("reason") == "oauth_error" assert len(hass.config_entries.async_entries(DOMAIN)) == 0 diff --git a/tests/components/geonetnz_quakes/test_config_flow.py b/tests/components/geonetnz_quakes/test_config_flow.py index d4b406cf054..61729776f9c 100644 --- a/tests/components/geonetnz_quakes/test_config_flow.py +++ b/tests/components/geonetnz_quakes/test_config_flow.py @@ -3,7 +3,7 @@ from datetime import timedelta from unittest.mock import patch -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.geonetnz_quakes import ( CONF_MINIMUM_MAGNITUDE, CONF_MMI, @@ -17,6 +17,7 @@ from homeassistant.const import ( CONF_UNIT_SYSTEM, ) from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType async def test_duplicate_error(hass: HomeAssistant, config_entry) -> None: @@ -27,7 +28,7 @@ async def test_duplicate_error(hass: HomeAssistant, config_entry) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER}, data=conf ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -36,7 +37,7 @@ async def test_show_form(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" @@ -64,7 +65,7 @@ async def test_step_import(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, data=conf ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "-41.2, 174.7" assert result["data"] == { CONF_LATITUDE: -41.2, @@ -95,7 +96,7 @@ async def test_step_user(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER}, data=conf ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "-41.2, 174.7" assert result["data"] == { CONF_LATITUDE: -41.2, diff --git a/tests/components/geonetnz_volcano/test_config_flow.py b/tests/components/geonetnz_volcano/test_config_flow.py index e314896dd6b..b074bdffa20 100644 --- a/tests/components/geonetnz_volcano/test_config_flow.py +++ b/tests/components/geonetnz_volcano/test_config_flow.py @@ -3,7 +3,6 @@ from datetime import timedelta from unittest.mock import patch -from homeassistant import data_entry_flow from homeassistant.components.geonetnz_volcano import config_flow from homeassistant.const import ( CONF_LATITUDE, @@ -13,6 +12,7 @@ from homeassistant.const import ( CONF_UNIT_SYSTEM, ) from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType async def test_duplicate_error(hass: HomeAssistant, config_entry) -> None: @@ -34,7 +34,7 @@ async def test_show_form(hass: HomeAssistant) -> None: result = await flow.async_step_user(user_input=None) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" @@ -61,7 +61,7 @@ async def test_step_import(hass: HomeAssistant) -> None: ), ): result = await flow.async_step_import(import_config=conf) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "-41.2, 174.7" assert result["data"] == { CONF_LATITUDE: -41.2, @@ -91,7 +91,7 @@ async def test_step_user(hass: HomeAssistant) -> None: ), ): result = await flow.async_step_user(user_input=conf) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "-41.2, 174.7" assert result["data"] == { CONF_LATITUDE: -41.2, diff --git a/tests/components/gios/test_config_flow.py b/tests/components/gios/test_config_flow.py index 4471cfa64ec..a96b065574a 100644 --- a/tests/components/gios/test_config_flow.py +++ b/tests/components/gios/test_config_flow.py @@ -5,11 +5,11 @@ from unittest.mock import patch from gios import ApiError -from homeassistant import data_entry_flow from homeassistant.components.gios import config_flow from homeassistant.components.gios.const import CONF_STATION_ID from homeassistant.const import CONF_NAME from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from . import STATIONS @@ -28,7 +28,7 @@ async def test_show_form(hass: HomeAssistant) -> None: result = await flow.async_step_user(user_input=None) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" @@ -112,7 +112,7 @@ async def test_create_entry(hass: HomeAssistant) -> None: result = await flow.async_step_user(user_input=CONFIG) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Test Name 1" assert result["data"][CONF_STATION_ID] == CONFIG[CONF_STATION_ID] diff --git a/tests/components/github/test_config_flow.py b/tests/components/github/test_config_flow.py index c715889b7dc..882ed88edb2 100644 --- a/tests/components/github/test_config_flow.py +++ b/tests/components/github/test_config_flow.py @@ -60,7 +60,7 @@ async def test_full_user_flow_implementation( ) assert result["step_id"] == "device" - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS # Wait for the task to start before configuring await hass.async_block_till_done() @@ -74,7 +74,7 @@ async def test_full_user_flow_implementation( ) assert result["title"] == "" - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert "data" in result assert result["data"][CONF_ACCESS_TOKEN] == MOCK_ACCESS_TOKEN assert "options" in result @@ -94,7 +94,7 @@ async def test_flow_with_registration_failure( DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result.get("reason") == "could_not_register" @@ -123,11 +123,11 @@ async def test_flow_with_activation_failure( context={"source": config_entries.SOURCE_USER}, ) assert result["step_id"] == "device" - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS await hass.async_block_till_done() result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "could_not_register" @@ -157,7 +157,7 @@ async def test_flow_with_remove_while_activating( context={"source": config_entries.SOURCE_USER}, ) assert result["step_id"] == "device" - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert hass.config_entries.flow.async_get(result["flow_id"]) @@ -181,7 +181,7 @@ async def test_already_configured( context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result.get("reason") == "already_configured" diff --git a/tests/components/glances/test_config_flow.py b/tests/components/glances/test_config_flow.py index 09dc638bb53..a7d6934e32d 100644 --- a/tests/components/glances/test_config_flow.py +++ b/tests/components/glances/test_config_flow.py @@ -32,14 +32,14 @@ async def test_form(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( glances.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_USER_INPUT ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "0.0.0.0:61208" assert result["data"] == MOCK_USER_INPUT @@ -65,7 +65,7 @@ async def test_form_fails( result["flow_id"], user_input=MOCK_USER_INPUT ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": message} @@ -80,7 +80,7 @@ async def test_form_already_configured(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_USER_INPUT ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -98,7 +98,7 @@ async def test_reauth_success(hass: HomeAssistant) -> None: data=MOCK_USER_INPUT, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["description_placeholders"] == {"username": "username"} @@ -109,7 +109,7 @@ async def test_reauth_success(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "reauth_successful" @@ -137,7 +137,7 @@ async def test_reauth_fails( data=MOCK_USER_INPUT, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["description_placeholders"] == {"username": "username"} @@ -148,7 +148,7 @@ async def test_reauth_fails( }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": message} result3 = await hass.config_entries.flow.async_configure( @@ -158,5 +158,5 @@ async def test_reauth_fails( }, ) - assert result3["type"] == FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "reauth_successful" diff --git a/tests/components/goalzero/test_config_flow.py b/tests/components/goalzero/test_config_flow.py index 7e57312c5b6..a8a8f67bcc1 100644 --- a/tests/components/goalzero/test_config_flow.py +++ b/tests/components/goalzero/test_config_flow.py @@ -4,10 +4,10 @@ from unittest.mock import patch from goalzero import exceptions -from homeassistant import data_entry_flow from homeassistant.components.goalzero.const import DEFAULT_NAME, DOMAIN, MANUFACTURER from homeassistant.config_entries import SOURCE_DHCP, SOURCE_USER from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from . import ( CONF_DATA, @@ -35,7 +35,7 @@ async def test_flow_user(hass: HomeAssistant) -> None: result["flow_id"], user_input=CONF_DATA, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == DEFAULT_NAME assert result["data"] == CONF_DATA assert result["result"].unique_id == MAC @@ -48,7 +48,7 @@ async def test_flow_user_already_configured(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER}, data=CONF_DATA ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -59,7 +59,7 @@ async def test_flow_user_cannot_connect(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=CONF_DATA ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"]["base"] == "cannot_connect" @@ -71,7 +71,7 @@ async def test_flow_user_invalid_host(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=CONF_DATA ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"]["base"] == "invalid_host" @@ -83,7 +83,7 @@ async def test_flow_user_unknown_error(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=CONF_DATA ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"]["base"] == "unknown" @@ -98,14 +98,14 @@ async def test_dhcp_discovery(hass: HomeAssistant) -> None: context={"source": SOURCE_DHCP}, data=CONF_DHCP_FLOW, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure( result["flow_id"], {}, ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == MANUFACTURER assert result["data"] == CONF_DATA assert result["result"].unique_id == MAC @@ -115,7 +115,7 @@ async def test_dhcp_discovery(hass: HomeAssistant) -> None: context={"source": SOURCE_DHCP}, data=CONF_DHCP_FLOW, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -129,7 +129,7 @@ async def test_dhcp_discovery_failed(hass: HomeAssistant) -> None: context={"source": SOURCE_DHCP}, data=CONF_DHCP_FLOW, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" with patch_config_flow_yeti(mocked_yeti) as yetimock: @@ -139,7 +139,7 @@ async def test_dhcp_discovery_failed(hass: HomeAssistant) -> None: context={"source": SOURCE_DHCP}, data=CONF_DHCP_FLOW, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "invalid_host" with patch_config_flow_yeti(mocked_yeti) as yetimock: @@ -149,5 +149,5 @@ async def test_dhcp_discovery_failed(hass: HomeAssistant) -> None: context={"source": SOURCE_DHCP}, data=CONF_DHCP_FLOW, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "unknown" diff --git a/tests/components/gogogate2/test_config_flow.py b/tests/components/gogogate2/test_config_flow.py index a88dbd45116..25fb5922506 100644 --- a/tests/components/gogogate2/test_config_flow.py +++ b/tests/components/gogogate2/test_config_flow.py @@ -57,7 +57,7 @@ async def test_auth_fail( }, ) assert result - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == { "base": "invalid_auth", } @@ -77,7 +77,7 @@ async def test_auth_fail( }, ) assert result - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} api.reset_mock() @@ -95,7 +95,7 @@ async def test_auth_fail( }, ) assert result - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} @@ -115,7 +115,7 @@ async def test_form_homekit_unique_id_already_setup(hass: HomeAssistant) -> None type="mock_type", ), ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} flow = next( flow @@ -143,7 +143,7 @@ async def test_form_homekit_unique_id_already_setup(hass: HomeAssistant) -> None type="mock_type", ), ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT async def test_form_homekit_ip_address_already_setup(hass: HomeAssistant) -> None: @@ -168,7 +168,7 @@ async def test_form_homekit_ip_address_already_setup(hass: HomeAssistant) -> Non type="mock_type", ), ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT async def test_form_homekit_ip_address(hass: HomeAssistant) -> None: @@ -187,7 +187,7 @@ async def test_form_homekit_ip_address(hass: HomeAssistant) -> None: type="mock_type", ), ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} data_schema = result["data_schema"] @@ -217,7 +217,7 @@ async def test_discovered_dhcp( ip="1.2.3.4", macaddress=MOCK_MAC_ADDR, hostname="mock_hostname" ), ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} result2 = await hass.config_entries.flow.async_configure( result["flow_id"], @@ -229,7 +229,7 @@ async def test_discovered_dhcp( }, ) assert result2 - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} api.reset_mock() @@ -245,7 +245,7 @@ async def test_discovered_dhcp( }, ) assert result3 - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["data"] == { "device": "ismartgate", "ip_address": "1.2.3.4", @@ -270,7 +270,7 @@ async def test_discovered_by_homekit_and_dhcp(hass: HomeAssistant) -> None: type="mock_type", ), ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} result2 = await hass.config_entries.flow.async_init( @@ -280,7 +280,7 @@ async def test_discovered_by_homekit_and_dhcp(hass: HomeAssistant) -> None: ip="1.2.3.4", macaddress=MOCK_MAC_ADDR, hostname="mock_hostname" ), ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_in_progress" result3 = await hass.config_entries.flow.async_init( @@ -290,5 +290,5 @@ async def test_discovered_by_homekit_and_dhcp(hass: HomeAssistant) -> None: ip="1.2.3.4", macaddress="00:00:00:00:00:00", hostname="mock_hostname" ), ) - assert result3["type"] == FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "already_in_progress" diff --git a/tests/components/goodwe/test_config_flow.py b/tests/components/goodwe/test_config_flow.py index 0d0a1249ea1..bede53ec9ed 100644 --- a/tests/components/goodwe/test_config_flow.py +++ b/tests/components/goodwe/test_config_flow.py @@ -32,7 +32,7 @@ async def test_manual_setup(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert not result["errors"] @@ -50,7 +50,7 @@ async def test_manual_setup(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == DEFAULT_NAME assert result["data"] == { CONF_HOST: TEST_HOST, @@ -68,7 +68,7 @@ async def test_manual_setup_already_exists(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert not result["errors"] @@ -84,7 +84,7 @@ async def test_manual_setup_already_exists(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -93,7 +93,7 @@ async def test_manual_setup_device_offline(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert not result["errors"] @@ -106,5 +106,5 @@ async def test_manual_setup_device_offline(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {CONF_HOST: "connection_error"} diff --git a/tests/components/google/test_config_flow.py b/tests/components/google/test_config_flow.py index f8eff022d9f..c27808c24aa 100644 --- a/tests/components/google/test_config_flow.py +++ b/tests/components/google/test_config_flow.py @@ -716,7 +716,7 @@ async def test_web_auth_compatibility( "homeassistant.components.google.async_setup_entry", return_value=True ) as mock_setup: result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY token = result.get("data", {}).get("token", {}) del token["expires_at"] assert token == { @@ -820,7 +820,7 @@ async def test_web_reauth_flow( "homeassistant.components.google.async_setup_entry", return_value=True ) as mock_setup: result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" entries = hass.config_entries.async_entries(DOMAIN) diff --git a/tests/components/google_generative_ai_conversation/test_config_flow.py b/tests/components/google_generative_ai_conversation/test_config_flow.py index 6ae42a350e6..3bac01db42d 100644 --- a/tests/components/google_generative_ai_conversation/test_config_flow.py +++ b/tests/components/google_generative_ai_conversation/test_config_flow.py @@ -36,7 +36,7 @@ async def test_form(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None with ( @@ -56,7 +56,7 @@ async def test_form(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["data"] == { "api_key": "bla", } @@ -78,7 +78,7 @@ async def test_options( }, ) await hass.async_block_till_done() - assert options["type"] == FlowResultType.CREATE_ENTRY + assert options["type"] is FlowResultType.CREATE_ENTRY assert options["data"]["prompt"] == "Speak like a pirate" assert options["data"]["temperature"] == 0.3 assert options["data"][CONF_CHAT_MODEL] == DEFAULT_CHAT_MODEL @@ -121,5 +121,5 @@ async def test_form_errors(hass: HomeAssistant, side_effect, error) -> None: }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": error} diff --git a/tests/components/google_tasks/test_config_flow.py b/tests/components/google_tasks/test_config_flow.py index d7ad21292fc..24801959674 100644 --- a/tests/components/google_tasks/test_config_flow.py +++ b/tests/components/google_tasks/test_config_flow.py @@ -70,7 +70,7 @@ async def test_full_flow( patch("homeassistant.components.google_tasks.config_flow.build"), ): result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert len(hass.config_entries.async_entries(DOMAIN)) == 1 assert len(mock_setup.mock_calls) == 1 @@ -126,7 +126,7 @@ async def test_api_not_enabled( ): result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "access_not_configured" assert ( result["description_placeholders"]["message"] @@ -182,5 +182,5 @@ async def test_general_exception( ): result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "unknown" diff --git a/tests/components/google_translate/test_config_flow.py b/tests/components/google_translate/test_config_flow.py index a4104fc0908..36399c6770a 100644 --- a/tests/components/google_translate/test_config_flow.py +++ b/tests/components/google_translate/test_config_flow.py @@ -20,7 +20,7 @@ async def test_user_step(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> No result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None result = await hass.config_entries.flow.async_configure( @@ -32,7 +32,7 @@ async def test_user_step(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> No ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Google Translate text-to-speech" assert result["data"] == { CONF_LANG: "de", @@ -53,7 +53,7 @@ async def test_already_configured( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None result = await hass.config_entries.flow.async_configure( @@ -64,7 +64,7 @@ async def test_already_configured( }, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert len(mock_setup_entry.mock_calls) == 0 @@ -77,7 +77,7 @@ async def test_onboarding_flow( DOMAIN, context={"source": "onboarding"} ) - assert result.get("type") == FlowResultType.CREATE_ENTRY + assert result.get("type") is FlowResultType.CREATE_ENTRY assert result.get("title") == "Google Translate text-to-speech" assert result.get("data") == { CONF_LANG: "en", diff --git a/tests/components/google_travel_time/test_config_flow.py b/tests/components/google_travel_time/test_config_flow.py index 24e9cb1297a..6e73bfd8d23 100644 --- a/tests/components/google_travel_time/test_config_flow.py +++ b/tests/components/google_travel_time/test_config_flow.py @@ -2,7 +2,7 @@ import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.google_travel_time.const import ( ARRIVAL_TIME, CONF_ARRIVAL_TIME, @@ -23,6 +23,7 @@ from homeassistant.components.google_travel_time.const import ( ) from homeassistant.const import CONF_API_KEY, CONF_LANGUAGE, CONF_MODE, CONF_NAME from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from .const import MOCK_CONFIG @@ -33,7 +34,7 @@ async def test_minimum_fields(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} result2 = await hass.config_entries.flow.async_configure( @@ -41,7 +42,7 @@ async def test_minimum_fields(hass: HomeAssistant) -> None: MOCK_CONFIG, ) - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == DEFAULT_NAME assert result2["data"] == { CONF_NAME: DEFAULT_NAME, @@ -57,14 +58,14 @@ async def test_invalid_config_entry(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} result2 = await hass.config_entries.flow.async_configure( result["flow_id"], MOCK_CONFIG, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -74,14 +75,14 @@ async def test_invalid_api_key(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} result2 = await hass.config_entries.flow.async_configure( result["flow_id"], MOCK_CONFIG, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "invalid_auth"} @@ -91,14 +92,14 @@ async def test_transport_error(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} result2 = await hass.config_entries.flow.async_configure( result["flow_id"], MOCK_CONFIG, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -108,14 +109,14 @@ async def test_timeout(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} result2 = await hass.config_entries.flow.async_configure( result["flow_id"], MOCK_CONFIG, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "timeout_connect"} @@ -124,14 +125,14 @@ async def test_malformed_api_key(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} result2 = await hass.config_entries.flow.async_configure( result["flow_id"], MOCK_CONFIG, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "invalid_auth"} @@ -154,7 +155,7 @@ async def test_options_flow(hass: HomeAssistant, mock_config) -> None: mock_config.entry_id, data=None ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -171,7 +172,7 @@ async def test_options_flow(hass: HomeAssistant, mock_config) -> None: CONF_TRANSIT_ROUTING_PREFERENCE: "less_walking", }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "" assert result["data"] == { CONF_MODE: "driving", @@ -215,7 +216,7 @@ async def test_options_flow_departure_time(hass: HomeAssistant, mock_config) -> mock_config.entry_id, data=None ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -232,7 +233,7 @@ async def test_options_flow_departure_time(hass: HomeAssistant, mock_config) -> CONF_TRANSIT_ROUTING_PREFERENCE: "less_walking", }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "" assert result["data"] == { CONF_MODE: "driving", @@ -285,7 +286,7 @@ async def test_reset_departure_time(hass: HomeAssistant, mock_config) -> None: mock_config.entry_id, data=None ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -331,7 +332,7 @@ async def test_reset_arrival_time(hass: HomeAssistant, mock_config) -> None: mock_config.entry_id, data=None ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -375,7 +376,7 @@ async def test_reset_options_flow_fields(hass: HomeAssistant, mock_config) -> No mock_config.entry_id, data=None ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -401,7 +402,7 @@ async def test_dupe(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} result2 = await hass.config_entries.flow.async_configure( @@ -413,13 +414,13 @@ async def test_dupe(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} result2 = await hass.config_entries.flow.async_configure( @@ -432,4 +433,4 @@ async def test_dupe(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY diff --git a/tests/components/govee_ble/test_config_flow.py b/tests/components/govee_ble/test_config_flow.py index 4b498b2618a..0c340c01f2a 100644 --- a/tests/components/govee_ble/test_config_flow.py +++ b/tests/components/govee_ble/test_config_flow.py @@ -19,7 +19,7 @@ async def test_async_step_bluetooth_valid_device(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=GVH5075_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch( "homeassistant.components.govee_ble.async_setup_entry", return_value=True @@ -27,7 +27,7 @@ async def test_async_step_bluetooth_valid_device(hass: HomeAssistant) -> None: result2 = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "H5075 2762" assert result2["data"] == {} assert result2["result"].unique_id == "61DE521B-F0BF-9F44-64D4-75BBE1738105" @@ -40,7 +40,7 @@ async def test_async_step_bluetooth_not_govee(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=NOT_GOVEE_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_supported" @@ -50,7 +50,7 @@ async def test_async_step_user_no_devices_found(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -64,7 +64,7 @@ async def test_async_step_user_with_found_devices(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with patch( "homeassistant.components.govee_ble.async_setup_entry", return_value=True @@ -73,7 +73,7 @@ async def test_async_step_user_with_found_devices(hass: HomeAssistant) -> None: result["flow_id"], user_input={"address": "4125DDBA-2774-4851-9889-6AADDD4CAC3D"}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "H5177 2EC8" assert result2["data"] == {} assert result2["result"].unique_id == "4125DDBA-2774-4851-9889-6AADDD4CAC3D" @@ -89,7 +89,7 @@ async def test_async_step_user_device_added_between_steps(hass: HomeAssistant) - DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" entry = MockConfigEntry( @@ -105,7 +105,7 @@ async def test_async_step_user_device_added_between_steps(hass: HomeAssistant) - result["flow_id"], user_input={"address": "4125DDBA-2774-4851-9889-6AADDD4CAC3D"}, ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" @@ -127,7 +127,7 @@ async def test_async_step_user_with_found_devices_already_setup( DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -144,7 +144,7 @@ async def test_async_step_bluetooth_devices_already_setup(hass: HomeAssistant) - context={"source": config_entries.SOURCE_BLUETOOTH}, data=GVH5177_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -155,7 +155,7 @@ async def test_async_step_bluetooth_already_in_progress(hass: HomeAssistant) -> context={"source": config_entries.SOURCE_BLUETOOTH}, data=GVH5177_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" result = await hass.config_entries.flow.async_init( @@ -163,7 +163,7 @@ async def test_async_step_bluetooth_already_in_progress(hass: HomeAssistant) -> context={"source": config_entries.SOURCE_BLUETOOTH}, data=GVH5177_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_in_progress" @@ -176,7 +176,7 @@ async def test_async_step_user_takes_precedence_over_discovery( context={"source": config_entries.SOURCE_BLUETOOTH}, data=GVH5177_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch( @@ -187,7 +187,7 @@ async def test_async_step_user_takes_precedence_over_discovery( DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM with patch( "homeassistant.components.govee_ble.async_setup_entry", return_value=True @@ -196,7 +196,7 @@ async def test_async_step_user_takes_precedence_over_discovery( result["flow_id"], user_input={"address": "4125DDBA-2774-4851-9889-6AADDD4CAC3D"}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "H5177 2EC8" assert result2["data"] == {} assert result2["result"].unique_id == "4125DDBA-2774-4851-9889-6AADDD4CAC3D" diff --git a/tests/components/govee_light_local/test_config_flow.py b/tests/components/govee_light_local/test_config_flow.py index 79baef33969..1f935f18530 100644 --- a/tests/components/govee_light_local/test_config_flow.py +++ b/tests/components/govee_light_local/test_config_flow.py @@ -4,9 +4,10 @@ from unittest.mock import AsyncMock, patch from govee_local_api import GoveeDevice -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.govee_light_local.const import DOMAIN from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from .conftest import DEFAULT_CAPABILITEIS @@ -33,10 +34,10 @@ async def test_creating_entry_has_no_devices( ) # Confirmation form - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT await hass.async_block_till_done() @@ -70,10 +71,10 @@ async def test_creating_entry_has_with_devices( ) # Confirmation form - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY await hass.async_block_till_done() diff --git a/tests/components/gpsd/test_config_flow.py b/tests/components/gpsd/test_config_flow.py index 81d6681dabd..6f330571076 100644 --- a/tests/components/gpsd/test_config_flow.py +++ b/tests/components/gpsd/test_config_flow.py @@ -4,7 +4,7 @@ from unittest.mock import AsyncMock, patch from gps3.agps3threaded import GPSD_PORT as DEFAULT_PORT -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.gpsd.const import DOMAIN from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT from homeassistant.core import HomeAssistant @@ -18,7 +18,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM with patch("socket.socket") as mock_socket: mock_connect = mock_socket.return_value.connect @@ -32,7 +32,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == f"GPS {HOST}" assert result2["data"] == { CONF_HOST: HOST, @@ -53,7 +53,7 @@ async def test_connection_error(hass: HomeAssistant) -> None: data={CONF_HOST: "nonexistent.local", CONF_PORT: 1234}, ) - assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -68,7 +68,7 @@ async def test_import(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_IMPORT}, data={CONF_HOST: HOST, CONF_PORT: 1234, CONF_NAME: "MyGPS"}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "MyGPS" assert result["data"] == { CONF_HOST: HOST, diff --git a/tests/components/gree/test_config_flow.py b/tests/components/gree/test_config_flow.py index 7127af6b913..af374fb4245 100644 --- a/tests/components/gree/test_config_flow.py +++ b/tests/components/gree/test_config_flow.py @@ -4,9 +4,10 @@ from unittest.mock import AsyncMock, patch import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.gree.const import DOMAIN as GREE_DOMAIN from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from .common import FakeDiscovery @@ -27,10 +28,10 @@ async def test_creating_entry_sets_up_climate( ) # Confirmation form - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY await hass.async_block_till_done() @@ -53,10 +54,10 @@ async def test_creating_entry_has_no_devices( ) # Confirmation form - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT await hass.async_block_till_done() diff --git a/tests/components/group/test_config_flow.py b/tests/components/group/test_config_flow.py index 623bcb5c1ee..3de6d9ac32d 100644 --- a/tests/components/group/test_config_flow.py +++ b/tests/components/group/test_config_flow.py @@ -76,14 +76,14 @@ async def test_config_flow( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU result = await hass.config_entries.flow.async_configure( result["flow_id"], {"next_step_id": group_type}, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == group_type with patch( @@ -99,7 +99,7 @@ async def test_config_flow( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Living Room" assert result["data"] == {} assert result["options"] == { @@ -170,14 +170,14 @@ async def test_config_flow_hides_members( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU result = await hass.config_entries.flow.async_configure( result["flow_id"], {"next_step_id": group_type}, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == group_type result = await hass.config_entries.flow.async_configure( @@ -191,7 +191,7 @@ async def test_config_flow_hides_members( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert entity_registry.async_get(f"{group_type}.one").hidden_by == hidden_by assert entity_registry.async_get(f"{group_type}.three").hidden_by == hidden_by @@ -261,7 +261,7 @@ async def test_options( config_entry = hass.config_entries.async_entries(DOMAIN)[0] result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == group_type assert get_suggested(result["data_schema"].schema, "entities") == members1 assert "name" not in result["data_schema"].schema @@ -273,7 +273,7 @@ async def test_options( result["flow_id"], user_input={"entities": members2, **options_options}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "entities": members2, "group_type": group_type, @@ -300,14 +300,14 @@ async def test_options( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU result = await hass.config_entries.flow.async_configure( result["flow_id"], {"next_step_id": group_type}, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == group_type assert get_suggested(result["data_schema"].schema, "entities") is None @@ -357,7 +357,7 @@ async def test_all_options( result = await hass.config_entries.options.async_init( config_entry.entry_id, context={"show_advanced_options": advanced} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == group_type result = await hass.config_entries.options.async_configure( @@ -366,7 +366,7 @@ async def test_all_options( "entities": members2, }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "entities": members2, "group_type": group_type, @@ -454,7 +454,7 @@ async def test_options_flow_hides_members( await hass.async_block_till_done() result = await hass.config_entries.options.async_init(group_config_entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.options.async_configure( result["flow_id"], @@ -465,7 +465,7 @@ async def test_options_flow_hides_members( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert entity_registry.async_get(f"{group_type}.one").hidden_by == hidden_by assert entity_registry.async_get(f"{group_type}.three").hidden_by == hidden_by @@ -518,14 +518,14 @@ async def test_config_flow_preview( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU result = await hass.config_entries.flow.async_configure( result["flow_id"], {"next_step_id": domain}, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == domain assert result["errors"] is None assert result["preview"] == "group" @@ -626,7 +626,7 @@ async def test_option_flow_preview( client = await hass_ws_client(hass) result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None assert result["preview"] == "group" @@ -681,7 +681,7 @@ async def test_option_flow_sensor_preview_config_entry_removed( await hass.async_block_till_done() result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None assert result["preview"] == "group" diff --git a/tests/components/growatt_server/test_config_flow.py b/tests/components/growatt_server/test_config_flow.py index 57777a57783..81ca870a22e 100644 --- a/tests/components/growatt_server/test_config_flow.py +++ b/tests/components/growatt_server/test_config_flow.py @@ -3,7 +3,7 @@ from copy import deepcopy from unittest.mock import patch -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.growatt_server.const import ( CONF_PLANT_ID, DEFAULT_URL, @@ -12,6 +12,7 @@ from homeassistant.components.growatt_server.const import ( ) from homeassistant.const import CONF_PASSWORD, CONF_URL, CONF_USERNAME from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -52,7 +53,7 @@ async def test_show_authenticate_form(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" @@ -70,7 +71,7 @@ async def test_incorrect_login(hass: HomeAssistant) -> None: result["flow_id"], FIXTURE_USER_INPUT ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "invalid_auth"} @@ -116,7 +117,7 @@ async def test_multiple_plant_ids(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "plant" user_input = {CONF_PLANT_ID: "123456"} @@ -125,7 +126,7 @@ async def test_multiple_plant_ids(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_USERNAME] == FIXTURE_USER_INPUT[CONF_USERNAME] assert result["data"][CONF_PASSWORD] == FIXTURE_USER_INPUT[CONF_PASSWORD] assert result["data"][CONF_PLANT_ID] == "123456" @@ -153,7 +154,7 @@ async def test_one_plant_on_account(hass: HomeAssistant) -> None: result["flow_id"], user_input ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_USERNAME] == FIXTURE_USER_INPUT[CONF_USERNAME] assert result["data"][CONF_PASSWORD] == FIXTURE_USER_INPUT[CONF_PASSWORD] assert result["data"][CONF_PLANT_ID] == "123456" diff --git a/tests/components/guardian/test_config_flow.py b/tests/components/guardian/test_config_flow.py index 3922b196e4b..06ce37a32af 100644 --- a/tests/components/guardian/test_config_flow.py +++ b/tests/components/guardian/test_config_flow.py @@ -6,7 +6,6 @@ from unittest.mock import patch from aioguardian.errors import GuardianError import pytest -from homeassistant import data_entry_flow from homeassistant.components import dhcp, zeroconf from homeassistant.components.guardian import CONF_UID, DOMAIN from homeassistant.components.guardian.config_flow import ( @@ -16,6 +15,7 @@ from homeassistant.components.guardian.config_flow import ( from homeassistant.config_entries import SOURCE_DHCP, SOURCE_USER, SOURCE_ZEROCONF from homeassistant.const import CONF_IP_ADDRESS, CONF_PORT from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -29,7 +29,7 @@ async def test_duplicate_error( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=config ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -42,7 +42,7 @@ async def test_connect_error(hass: HomeAssistant, config) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=config ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {CONF_IP_ADDRESS: "cannot_connect"} @@ -63,13 +63,13 @@ async def test_step_user(hass: HomeAssistant, config, setup_guardian) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=config ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "ABCDEF123456" assert result["data"] == { CONF_IP_ADDRESS: "192.168.1.100", @@ -93,13 +93,13 @@ async def test_step_zeroconf(hass: HomeAssistant, setup_guardian) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_ZEROCONF}, data=zeroconf_data ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "discovery_confirm" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "ABCDEF123456" assert result["data"] == { CONF_IP_ADDRESS: "192.168.1.100", @@ -123,7 +123,7 @@ async def test_step_zeroconf_already_in_progress(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_ZEROCONF}, data=zeroconf_data ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "discovery_confirm" result = await hass.config_entries.flow.async_init( @@ -144,13 +144,13 @@ async def test_step_dhcp(hass: HomeAssistant, setup_guardian) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_DHCP}, data=dhcp_data ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "discovery_confirm" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "ABCDEF123456" assert result["data"] == { CONF_IP_ADDRESS: "192.168.1.100", @@ -170,7 +170,7 @@ async def test_step_dhcp_already_in_progress(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_DHCP}, data=dhcp_data ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "discovery_confirm" result = await hass.config_entries.flow.async_init( @@ -196,7 +196,7 @@ async def test_step_dhcp_already_setup_match_mac(hass: HomeAssistant) -> None: macaddress="aabbccddabcd", ), ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -218,5 +218,5 @@ async def test_step_dhcp_already_setup_match_ip(hass: HomeAssistant) -> None: macaddress="aabbccddabcd", ), ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/hardkernel/test_config_flow.py b/tests/components/hardkernel/test_config_flow.py index 1965e2af8c7..998c024dc72 100644 --- a/tests/components/hardkernel/test_config_flow.py +++ b/tests/components/hardkernel/test_config_flow.py @@ -21,7 +21,7 @@ async def test_config_flow(hass: HomeAssistant) -> None: DOMAIN, context={"source": "system"} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Hardkernel" assert result["data"] == {} assert result["options"] == {} @@ -54,6 +54,6 @@ async def test_config_flow_single_entry(hass: HomeAssistant) -> None: DOMAIN, context={"source": "system"} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" mock_setup_entry.assert_not_called() diff --git a/tests/components/harmony/test_config_flow.py b/tests/components/harmony/test_config_flow.py index c2daa98728b..3dc5a612452 100644 --- a/tests/components/harmony/test_config_flow.py +++ b/tests/components/harmony/test_config_flow.py @@ -4,12 +4,13 @@ from unittest.mock import AsyncMock, MagicMock, patch import aiohttp -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components import ssdp from homeassistant.components.harmony.config_flow import CannotConnect from homeassistant.components.harmony.const import DOMAIN, PREVIOUS_ACTIVE_ACTIVITY from homeassistant.const import CONF_HOST, CONF_NAME from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -211,7 +212,7 @@ async def test_options_flow(hass: HomeAssistant, mock_hc, mock_write_config) -> assert await hass.config_entries.async_unload(config_entry.entry_id) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -219,7 +220,7 @@ async def test_options_flow(hass: HomeAssistant, mock_hc, mock_write_config) -> user_input={"activity": PREVIOUS_ACTIVE_ACTIVITY, "delay_secs": 0.4}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { "activity": PREVIOUS_ACTIVE_ACTIVITY, "delay_secs": 0.4, diff --git a/tests/components/heos/test_config_flow.py b/tests/components/heos/test_config_flow.py index 7f0cd6cbd5a..7b737d7bb4b 100644 --- a/tests/components/heos/test_config_flow.py +++ b/tests/components/heos/test_config_flow.py @@ -5,13 +5,13 @@ from urllib.parse import urlparse from pyheos import HeosError -from homeassistant import data_entry_flow from homeassistant.components import heos, ssdp from homeassistant.components.heos.config_flow import HeosFlowHandler from homeassistant.components.heos.const import DATA_DISCOVERED_HOSTS, DOMAIN from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_SSDP, SOURCE_USER from homeassistant.const import CONF_HOST from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType async def test_flow_aborts_already_setup(hass: HomeAssistant, config_entry) -> None: @@ -20,7 +20,7 @@ async def test_flow_aborts_already_setup(hass: HomeAssistant, config_entry) -> N flow = HeosFlowHandler() flow.hass = hass result = await flow.async_step_user() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" @@ -29,7 +29,7 @@ async def test_no_host_shows_form(hass: HomeAssistant) -> None: flow = HeosFlowHandler() flow.hass = hass result = await flow.async_step_user() - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -40,7 +40,7 @@ async def test_cannot_connect_shows_error_form(hass: HomeAssistant, controller) result = await hass.config_entries.flow.async_init( heos.DOMAIN, context={"source": SOURCE_USER}, data={CONF_HOST: "127.0.0.1"} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"][CONF_HOST] == "cannot_connect" assert controller.connect.call_count == 1 @@ -56,7 +56,7 @@ async def test_create_entry_when_host_valid(hass: HomeAssistant, controller) -> result = await hass.config_entries.flow.async_init( heos.DOMAIN, context={"source": SOURCE_USER}, data=data ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["result"].unique_id == DOMAIN assert result["title"] == "Controller (127.0.0.1)" assert result["data"] == data @@ -74,7 +74,7 @@ async def test_create_entry_when_friendly_name_valid( result = await hass.config_entries.flow.async_init( heos.DOMAIN, context={"source": SOURCE_USER}, data=data ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["result"].unique_id == DOMAIN assert result["title"] == "Controller (127.0.0.1)" assert result["data"] == {CONF_HOST: "127.0.0.1"} @@ -122,7 +122,7 @@ async def test_discovery_flow_aborts_already_setup( flow = HeosFlowHandler() flow.hass = hass result = await flow.async_step_ssdp(discovery_data) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" @@ -155,5 +155,5 @@ async def test_import_sets_the_unique_id(hass: HomeAssistant, controller) -> Non data={CONF_HOST: "127.0.0.2"}, ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["result"].unique_id == DOMAIN diff --git a/tests/components/here_travel_time/test_config_flow.py b/tests/components/here_travel_time/test_config_flow.py index 51b12978856..1309878a2f3 100644 --- a/tests/components/here_travel_time/test_config_flow.py +++ b/tests/components/here_travel_time/test_config_flow.py @@ -5,7 +5,7 @@ from unittest.mock import patch from here_routing import HERERoutingError, HERERoutingUnauthorizedError import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.here_travel_time.const import ( CONF_ARRIVAL_TIME, CONF_DEPARTURE_TIME, @@ -22,6 +22,7 @@ from homeassistant.components.here_travel_time.const import ( ) from homeassistant.const import CONF_API_KEY, CONF_MODE, CONF_NAME from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from .const import ( API_KEY, @@ -46,7 +47,7 @@ def bypass_setup_fixture(): @pytest.fixture(name="user_step_result") -async def user_step_result_fixture(hass: HomeAssistant) -> data_entry_flow.FlowResult: +async def user_step_result_fixture(hass: HomeAssistant) -> FlowResultType: """Provide the result of a completed user step.""" init_result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} @@ -64,7 +65,7 @@ async def user_step_result_fixture(hass: HomeAssistant) -> data_entry_flow.FlowR @pytest.fixture(name="option_init_result") -async def option_init_result_fixture(hass: HomeAssistant) -> data_entry_flow.FlowResult: +async def option_init_result_fixture(hass: HomeAssistant) -> FlowResultType: """Provide the result of a completed options init step.""" entry = MockConfigEntry( domain=DOMAIN, @@ -94,8 +95,8 @@ async def option_init_result_fixture(hass: HomeAssistant) -> data_entry_flow.Flo @pytest.fixture(name="origin_step_result") async def origin_step_result_fixture( - hass: HomeAssistant, user_step_result: data_entry_flow.FlowResult -) -> data_entry_flow.FlowResult: + hass: HomeAssistant, user_step_result: FlowResultType +) -> FlowResultType: """Provide the result of a completed origin by coordinates step.""" origin_menu_result = await hass.config_entries.flow.async_configure( user_step_result["flow_id"], {"next_step_id": "origin_coordinates"} @@ -124,7 +125,7 @@ async def test_step_user(hass: HomeAssistant, menu_options) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} result2 = await hass.config_entries.flow.async_configure( @@ -137,19 +138,19 @@ async def test_step_user(hass: HomeAssistant, menu_options) -> None: ) await hass.async_block_till_done() - assert result2["type"] == data_entry_flow.FlowResultType.MENU + assert result2["type"] is FlowResultType.MENU assert result2["menu_options"] == menu_options @pytest.mark.usefixtures("valid_response") async def test_step_origin_coordinates( - hass: HomeAssistant, user_step_result: data_entry_flow.FlowResult + hass: HomeAssistant, user_step_result: FlowResultType ) -> None: """Test the origin coordinates step.""" menu_result = await hass.config_entries.flow.async_configure( user_step_result["flow_id"], {"next_step_id": "origin_coordinates"} ) - assert menu_result["type"] == data_entry_flow.FlowResultType.FORM + assert menu_result["type"] is FlowResultType.FORM location_selector_result = await hass.config_entries.flow.async_configure( menu_result["flow_id"], @@ -161,35 +162,35 @@ async def test_step_origin_coordinates( } }, ) - assert location_selector_result["type"] == data_entry_flow.FlowResultType.MENU + assert location_selector_result["type"] is FlowResultType.MENU @pytest.mark.usefixtures("valid_response") async def test_step_origin_entity( - hass: HomeAssistant, user_step_result: data_entry_flow.FlowResult + hass: HomeAssistant, user_step_result: FlowResultType ) -> None: """Test the origin coordinates step.""" menu_result = await hass.config_entries.flow.async_configure( user_step_result["flow_id"], {"next_step_id": "origin_entity"} ) - assert menu_result["type"] == data_entry_flow.FlowResultType.FORM + assert menu_result["type"] is FlowResultType.FORM entity_selector_result = await hass.config_entries.flow.async_configure( menu_result["flow_id"], {"origin_entity_id": "zone.home"}, ) - assert entity_selector_result["type"] == data_entry_flow.FlowResultType.MENU + assert entity_selector_result["type"] is FlowResultType.MENU @pytest.mark.usefixtures("valid_response") async def test_step_destination_coordinates( - hass: HomeAssistant, origin_step_result: data_entry_flow.FlowResult + hass: HomeAssistant, origin_step_result: FlowResultType ) -> None: """Test the origin coordinates step.""" menu_result = await hass.config_entries.flow.async_configure( origin_step_result["flow_id"], {"next_step_id": "destination_coordinates"} ) - assert menu_result["type"] == data_entry_flow.FlowResultType.FORM + assert menu_result["type"] is FlowResultType.FORM location_selector_result = await hass.config_entries.flow.async_configure( menu_result["flow_id"], @@ -201,9 +202,7 @@ async def test_step_destination_coordinates( } }, ) - assert ( - location_selector_result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY - ) + assert location_selector_result["type"] is FlowResultType.CREATE_ENTRY entry = hass.config_entries.async_entries(DOMAIN)[0] assert entry.data == { CONF_NAME: "test", @@ -219,19 +218,19 @@ async def test_step_destination_coordinates( @pytest.mark.usefixtures("valid_response") async def test_step_destination_entity( hass: HomeAssistant, - origin_step_result: data_entry_flow.FlowResult, + origin_step_result: FlowResultType, ) -> None: """Test the origin coordinates step.""" menu_result = await hass.config_entries.flow.async_configure( origin_step_result["flow_id"], {"next_step_id": "destination_entity"} ) - assert menu_result["type"] == data_entry_flow.FlowResultType.FORM + assert menu_result["type"] is FlowResultType.FORM entity_selector_result = await hass.config_entries.flow.async_configure( menu_result["flow_id"], {"destination_entity_id": "zone.home"}, ) - assert entity_selector_result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert entity_selector_result["type"] is FlowResultType.CREATE_ENTRY entry = hass.config_entries.async_entries(DOMAIN)[0] assert entry.data == { CONF_NAME: "test", @@ -310,7 +309,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: result = await hass.config_entries.options.async_init(entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -320,18 +319,18 @@ async def test_options_flow(hass: HomeAssistant) -> None: }, ) - assert result["type"] == data_entry_flow.FlowResultType.MENU + assert result["type"] is FlowResultType.MENU @pytest.mark.usefixtures("valid_response") async def test_options_flow_arrival_time_step( - hass: HomeAssistant, option_init_result: data_entry_flow.FlowResult + hass: HomeAssistant, option_init_result: FlowResultType ) -> None: """Test the options flow arrival time type.""" menu_result = await hass.config_entries.options.async_configure( option_init_result["flow_id"], {"next_step_id": "arrival_time"} ) - assert menu_result["type"] == data_entry_flow.FlowResultType.FORM + assert menu_result["type"] is FlowResultType.FORM time_selector_result = await hass.config_entries.options.async_configure( option_init_result["flow_id"], user_input={ @@ -339,7 +338,7 @@ async def test_options_flow_arrival_time_step( }, ) - assert time_selector_result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert time_selector_result["type"] is FlowResultType.CREATE_ENTRY entry = hass.config_entries.async_entries(DOMAIN)[0] assert entry.options == { CONF_ROUTE_MODE: ROUTE_MODE_FASTEST, @@ -349,13 +348,13 @@ async def test_options_flow_arrival_time_step( @pytest.mark.usefixtures("valid_response") async def test_options_flow_departure_time_step( - hass: HomeAssistant, option_init_result: data_entry_flow.FlowResult + hass: HomeAssistant, option_init_result: FlowResultType ) -> None: """Test the options flow departure time type.""" menu_result = await hass.config_entries.options.async_configure( option_init_result["flow_id"], {"next_step_id": "departure_time"} ) - assert menu_result["type"] == data_entry_flow.FlowResultType.FORM + assert menu_result["type"] is FlowResultType.FORM time_selector_result = await hass.config_entries.options.async_configure( option_init_result["flow_id"], user_input={ @@ -363,7 +362,7 @@ async def test_options_flow_departure_time_step( }, ) - assert time_selector_result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert time_selector_result["type"] is FlowResultType.CREATE_ENTRY entry = hass.config_entries.async_entries(DOMAIN)[0] assert entry.options == { CONF_ROUTE_MODE: ROUTE_MODE_FASTEST, @@ -373,14 +372,14 @@ async def test_options_flow_departure_time_step( @pytest.mark.usefixtures("valid_response") async def test_options_flow_no_time_step( - hass: HomeAssistant, option_init_result: data_entry_flow.FlowResult + hass: HomeAssistant, option_init_result: FlowResultType ) -> None: """Test the options flow arrival time type.""" menu_result = await hass.config_entries.options.async_configure( option_init_result["flow_id"], {"next_step_id": "no_time"} ) - assert menu_result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert menu_result["type"] is FlowResultType.CREATE_ENTRY entry = hass.config_entries.async_entries(DOMAIN)[0] assert entry.options == { CONF_ROUTE_MODE: ROUTE_MODE_FASTEST, diff --git a/tests/components/hive/test_config_flow.py b/tests/components/hive/test_config_flow.py index b1553b2c485..fd6eb564a39 100644 --- a/tests/components/hive/test_config_flow.py +++ b/tests/components/hive/test_config_flow.py @@ -4,10 +4,11 @@ from unittest.mock import patch from apyhiveapi.helper import hive_exceptions -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.hive.const import CONF_CODE, CONF_DEVICE_NAME, DOMAIN from homeassistant.const import CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -52,7 +53,7 @@ async def test_import_flow(hass: HomeAssistant) -> None: data={CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == USERNAME assert result["data"] == { CONF_USERNAME: USERNAME, @@ -76,7 +77,7 @@ async def test_user_flow(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with ( @@ -104,7 +105,7 @@ async def test_user_flow(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == USERNAME assert result2["data"] == { CONF_USERNAME: USERNAME, @@ -129,7 +130,7 @@ async def test_user_flow_2fa(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with patch( @@ -146,7 +147,7 @@ async def test_user_flow_2fa(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == CONF_CODE assert result2["errors"] == {} @@ -167,7 +168,7 @@ async def test_user_flow_2fa(hass: HomeAssistant) -> None: }, ) - assert result3["type"] == data_entry_flow.FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["step_id"] == "configuration" assert result3["errors"] == {} @@ -200,7 +201,7 @@ async def test_user_flow_2fa(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result4["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result4["type"] is FlowResultType.CREATE_ENTRY assert result4["title"] == USERNAME assert result4["data"] == { CONF_USERNAME: USERNAME, @@ -254,7 +255,7 @@ async def test_reauth_flow(hass: HomeAssistant) -> None: data=mock_config.data, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "invalid_password"} with patch( @@ -278,7 +279,7 @@ async def test_reauth_flow(hass: HomeAssistant) -> None: assert mock_config.data.get("username") == USERNAME assert mock_config.data.get("password") == UPDATED_PASSWORD - assert result2["type"] == data_entry_flow.FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "reauth_successful" assert len(hass.config_entries.async_entries(DOMAIN)) == 1 @@ -313,7 +314,7 @@ async def test_reauth_2fa_flow(hass: HomeAssistant) -> None: data=mock_config.data, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "invalid_password"} with patch( @@ -356,7 +357,7 @@ async def test_reauth_2fa_flow(hass: HomeAssistant) -> None: assert mock_config.data.get("username") == USERNAME assert mock_config.data.get("password") == UPDATED_PASSWORD - assert result3["type"] == data_entry_flow.FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "reauth_successful" assert len(mock_setup_entry.mock_calls) == 1 assert len(hass.config_entries.async_entries(DOMAIN)) == 1 @@ -388,14 +389,14 @@ async def test_option_flow(hass: HomeAssistant) -> None: data=None, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" result = await hass.config_entries.options.async_configure( result["flow_id"], user_input={CONF_SCAN_INTERVAL: UPDATED_SCAN_INTERVAL} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_SCAN_INTERVAL] == UPDATED_SCAN_INTERVAL @@ -405,7 +406,7 @@ async def test_user_flow_2fa_send_new_code(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with patch( @@ -422,7 +423,7 @@ async def test_user_flow_2fa_send_new_code(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == CONF_CODE assert result2["errors"] == {} @@ -437,7 +438,7 @@ async def test_user_flow_2fa_send_new_code(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result3["type"] == data_entry_flow.FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["step_id"] == CONF_CODE assert result3["errors"] == {} @@ -458,7 +459,7 @@ async def test_user_flow_2fa_send_new_code(hass: HomeAssistant) -> None: }, ) - assert result4["type"] == data_entry_flow.FlowResultType.FORM + assert result4["type"] is FlowResultType.FORM assert result4["step_id"] == "configuration" assert result4["errors"] == {} @@ -488,7 +489,7 @@ async def test_user_flow_2fa_send_new_code(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result5["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result5["type"] is FlowResultType.CREATE_ENTRY assert result5["title"] == USERNAME assert result5["data"] == { CONF_USERNAME: USERNAME, @@ -530,7 +531,7 @@ async def test_abort_if_existing_entry(hass: HomeAssistant) -> None: }, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -540,7 +541,7 @@ async def test_user_flow_invalid_username(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with patch( @@ -552,7 +553,7 @@ async def test_user_flow_invalid_username(hass: HomeAssistant) -> None: {CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "user" assert result2["errors"] == {"base": "invalid_username"} @@ -563,7 +564,7 @@ async def test_user_flow_invalid_password(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with patch( @@ -575,7 +576,7 @@ async def test_user_flow_invalid_password(hass: HomeAssistant) -> None: {CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "user" assert result2["errors"] == {"base": "invalid_password"} @@ -587,7 +588,7 @@ async def test_user_flow_no_internet_connection(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with patch( @@ -599,7 +600,7 @@ async def test_user_flow_no_internet_connection(hass: HomeAssistant) -> None: {CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "user" assert result2["errors"] == {"base": "no_internet_available"} @@ -611,7 +612,7 @@ async def test_user_flow_2fa_no_internet_connection(hass: HomeAssistant) -> None DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with patch( @@ -625,7 +626,7 @@ async def test_user_flow_2fa_no_internet_connection(hass: HomeAssistant) -> None {CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == CONF_CODE assert result2["errors"] == {} @@ -638,7 +639,7 @@ async def test_user_flow_2fa_no_internet_connection(hass: HomeAssistant) -> None {CONF_CODE: MFA_CODE}, ) - assert result3["type"] == data_entry_flow.FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["step_id"] == CONF_CODE assert result3["errors"] == {"base": "no_internet_available"} @@ -649,7 +650,7 @@ async def test_user_flow_2fa_invalid_code(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with patch( @@ -663,7 +664,7 @@ async def test_user_flow_2fa_invalid_code(hass: HomeAssistant) -> None: {CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == CONF_CODE assert result2["errors"] == {} @@ -675,7 +676,7 @@ async def test_user_flow_2fa_invalid_code(hass: HomeAssistant) -> None: result["flow_id"], {CONF_CODE: MFA_INVALID_CODE}, ) - assert result3["type"] == data_entry_flow.FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["step_id"] == CONF_CODE assert result3["errors"] == {"base": "invalid_code"} @@ -686,7 +687,7 @@ async def test_user_flow_unknown_error(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with patch( @@ -699,7 +700,7 @@ async def test_user_flow_unknown_error(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} @@ -709,7 +710,7 @@ async def test_user_flow_2fa_unknown_error(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with patch( @@ -723,7 +724,7 @@ async def test_user_flow_2fa_unknown_error(hass: HomeAssistant) -> None: {CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == CONF_CODE with patch( @@ -735,7 +736,7 @@ async def test_user_flow_2fa_unknown_error(hass: HomeAssistant) -> None: {CONF_CODE: MFA_CODE}, ) - assert result3["type"] == data_entry_flow.FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["step_id"] == "configuration" assert result3["errors"] == {} @@ -759,6 +760,6 @@ async def test_user_flow_2fa_unknown_error(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result4["type"] == data_entry_flow.FlowResultType.FORM + assert result4["type"] is FlowResultType.FORM assert result4["step_id"] == "configuration" assert result4["errors"] == {"base": "unknown"} diff --git a/tests/components/hko/test_config_flow.py b/tests/components/hko/test_config_flow.py index ce32d2cd0da..7a2cec961db 100644 --- a/tests/components/hko/test_config_flow.py +++ b/tests/components/hko/test_config_flow.py @@ -17,7 +17,7 @@ async def test_config_flow_default(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == SOURCE_USER assert "flow_id" in result @@ -26,7 +26,7 @@ async def test_config_flow_default(hass: HomeAssistant) -> None: user_input={CONF_LOCATION: DEFAULT_LOCATION}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == DEFAULT_LOCATION assert result2["result"].unique_id == DEFAULT_LOCATION assert result2["data"][CONF_LOCATION] == DEFAULT_LOCATION @@ -42,7 +42,7 @@ async def test_config_flow_cannot_connect(hass: HomeAssistant) -> None: data={CONF_LOCATION: DEFAULT_LOCATION}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"]["base"] == "cannot_connect" client_mock.side_effect = None @@ -53,7 +53,7 @@ async def test_config_flow_cannot_connect(hass: HomeAssistant) -> None: data={CONF_LOCATION: DEFAULT_LOCATION}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["result"].unique_id == DEFAULT_LOCATION assert result["data"][CONF_LOCATION] == DEFAULT_LOCATION @@ -68,7 +68,7 @@ async def test_config_flow_timeout(hass: HomeAssistant) -> None: data={CONF_LOCATION: DEFAULT_LOCATION}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"]["base"] == "unknown" client_mock.side_effect = None @@ -79,7 +79,7 @@ async def test_config_flow_timeout(hass: HomeAssistant) -> None: data={CONF_LOCATION: DEFAULT_LOCATION}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["result"].unique_id == DEFAULT_LOCATION assert result["data"][CONF_LOCATION] == DEFAULT_LOCATION @@ -89,24 +89,24 @@ async def test_config_flow_already_configured(hass: HomeAssistant) -> None: r1 = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert r1["type"] == FlowResultType.FORM + assert r1["type"] is FlowResultType.FORM assert r1["step_id"] == SOURCE_USER assert "flow_id" in r1 result1 = await hass.config_entries.flow.async_configure( r1["flow_id"], user_input={CONF_LOCATION: DEFAULT_LOCATION}, ) - assert result1["type"] == FlowResultType.CREATE_ENTRY + assert result1["type"] is FlowResultType.CREATE_ENTRY r2 = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert r2["type"] == FlowResultType.FORM + assert r2["type"] is FlowResultType.FORM assert r2["step_id"] == SOURCE_USER assert "flow_id" in r2 result2 = await hass.config_entries.flow.async_configure( r2["flow_id"], user_input={CONF_LOCATION: DEFAULT_LOCATION}, ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" diff --git a/tests/components/holiday/test_config_flow.py b/tests/components/holiday/test_config_flow.py index 44a72f58404..14e2b68234c 100644 --- a/tests/components/holiday/test_config_flow.py +++ b/tests/components/holiday/test_config_flow.py @@ -20,7 +20,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result2 = await hass.config_entries.flow.async_configure( result["flow_id"], @@ -30,7 +30,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM result3 = await hass.config_entries.flow.async_configure( result2["flow_id"], @@ -40,7 +40,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == "Germany, BW" assert result3["data"] == { "country": "DE", @@ -54,7 +54,7 @@ async def test_form_no_subdivision(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result2 = await hass.config_entries.flow.async_configure( result["flow_id"], @@ -64,7 +64,7 @@ async def test_form_no_subdivision(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Sweden" assert result2["data"] == { "country": "SE", @@ -108,7 +108,7 @@ async def test_single_combination_country_province(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_USER}, data=data_se, ) - assert result_se["type"] == FlowResultType.ABORT + assert result_se["type"] is FlowResultType.ABORT assert result_se["reason"] == "already_configured" # Test for country with subdivisions @@ -117,7 +117,7 @@ async def test_single_combination_country_province(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_USER}, data=data_de, ) - assert result_de_step1["type"] == FlowResultType.FORM + assert result_de_step1["type"] is FlowResultType.FORM result_de_step2 = await hass.config_entries.flow.async_configure( result_de_step1["flow_id"], @@ -125,7 +125,7 @@ async def test_single_combination_country_province(hass: HomeAssistant) -> None: CONF_PROVINCE: data_de[CONF_PROVINCE], }, ) - assert result_de_step2["type"] == FlowResultType.ABORT + assert result_de_step2["type"] is FlowResultType.ABORT assert result_de_step2["reason"] == "already_configured" @@ -167,7 +167,7 @@ async def test_form_babel_unresolved_language(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Germany, BW" assert result["data"] == { "country": "DE", @@ -213,7 +213,7 @@ async def test_form_babel_replace_dash_with_underscore(hass: HomeAssistant) -> N ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Germany, BW" assert result["data"] == { "country": "DE", @@ -237,7 +237,7 @@ async def test_reconfigure(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> "entry_id": entry.entry_id, }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure( result["flow_id"], @@ -247,7 +247,7 @@ async def test_reconfigure(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reconfigure_successful" entry = hass.config_entries.async_get_entry(entry.entry_id) assert entry.title == "Germany, NW" @@ -274,7 +274,7 @@ async def test_reconfigure_incorrect_language( "entry_id": entry.entry_id, }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure( result["flow_id"], @@ -284,7 +284,7 @@ async def test_reconfigure_incorrect_language( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reconfigure_successful" entry = hass.config_entries.async_get_entry(entry.entry_id) assert entry.title == "Germany, NW" @@ -315,7 +315,7 @@ async def test_reconfigure_entry_exists( "entry_id": entry.entry_id, }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure( result["flow_id"], @@ -325,7 +325,7 @@ async def test_reconfigure_entry_exists( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" entry = hass.config_entries.async_get_entry(entry.entry_id) assert entry.title == "Germany, BW" diff --git a/tests/components/home_connect/test_config_flow.py b/tests/components/home_connect/test_config_flow.py index 74ca918889d..2c094c74246 100644 --- a/tests/components/home_connect/test_config_flow.py +++ b/tests/components/home_connect/test_config_flow.py @@ -3,7 +3,7 @@ from http import HTTPStatus from unittest.mock import patch -from homeassistant import config_entries, data_entry_flow, setup +from homeassistant import config_entries, setup from homeassistant.components.application_credentials import ( ClientCredential, async_import_client_credential, @@ -14,6 +14,7 @@ from homeassistant.components.home_connect.const import ( OAUTH2_TOKEN, ) from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from homeassistant.helpers import config_entry_oauth2_flow from tests.test_util.aiohttp import AiohttpClientMocker @@ -47,7 +48,7 @@ async def test_full_flow( }, ) - assert result["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP assert result["url"] == ( f"{OAUTH2_AUTHORIZE}?response_type=code&client_id={CLIENT_ID}" "&redirect_uri=https://example.com/auth/external/callback" diff --git a/tests/components/homeassistant_green/test_config_flow.py b/tests/components/homeassistant_green/test_config_flow.py index f0bf15aaa53..5fa71d9a091 100644 --- a/tests/components/homeassistant_green/test_config_flow.py +++ b/tests/components/homeassistant_green/test_config_flow.py @@ -49,7 +49,7 @@ async def test_config_flow(hass: HomeAssistant) -> None: DOMAIN, context={"source": "system"} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Home Assistant Green" assert result["data"] == {} assert result["options"] == {} @@ -83,7 +83,7 @@ async def test_config_flow_single_entry(hass: HomeAssistant) -> None: DOMAIN, context={"source": "system"} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" mock_setup_entry.assert_not_called() @@ -109,7 +109,7 @@ async def test_option_flow_non_hassio( ): result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_hassio" @@ -132,14 +132,14 @@ async def test_option_flow_led_settings( config_entry.add_to_hass(hass) result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "hardware_settings" result = await hass.config_entries.options.async_configure( result["flow_id"], {"activity_led": False, "power_led": False, "system_health_led": False}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY set_green_settings.assert_called_once_with( hass, {"activity_led": False, "power_led": False, "system_health_led": False} ) @@ -164,14 +164,14 @@ async def test_option_flow_led_settings_unchanged( config_entry.add_to_hass(hass) result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "hardware_settings" result = await hass.config_entries.options.async_configure( result["flow_id"], {"activity_led": True, "power_led": True, "system_health_led": True}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY set_green_settings.assert_not_called() @@ -195,7 +195,7 @@ async def test_option_flow_led_settings_fail_1(hass: HomeAssistant) -> None: ): result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "read_hw_settings_error" @@ -216,7 +216,7 @@ async def test_option_flow_led_settings_fail_2( config_entry.add_to_hass(hass) result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "hardware_settings" with patch( @@ -227,5 +227,5 @@ async def test_option_flow_led_settings_fail_2( result["flow_id"], {"activity_led": False, "power_led": False, "system_health_led": False}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "write_hw_settings_error" diff --git a/tests/components/homeassistant_sky_connect/test_config_flow.py b/tests/components/homeassistant_sky_connect/test_config_flow.py index 957a407cc0e..9647cef4721 100644 --- a/tests/components/homeassistant_sky_connect/test_config_flow.py +++ b/tests/components/homeassistant_sky_connect/test_config_flow.py @@ -75,7 +75,7 @@ async def test_config_flow( "description": usb_data.description, } - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == title assert result["data"] == expected_data assert result["options"] == {} @@ -123,7 +123,7 @@ async def test_config_flow_multiple_entries( DOMAIN, context={"source": "usb"}, data=usb_data ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY @pytest.mark.parametrize( @@ -172,7 +172,7 @@ async def test_config_flow_update_device( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_unload_entry.mock_calls) == 1 @@ -221,7 +221,7 @@ async def test_option_flow_install_multi_pan_addon( side_effect=Mock(return_value=True), ): result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "addon_not_installed" result = await hass.config_entries.options.async_configure( @@ -230,7 +230,7 @@ async def test_option_flow_install_multi_pan_addon( "enable_multi_pan": True, }, ) - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["step_id"] == "install_addon" assert result["progress_action"] == "install_addon" @@ -238,7 +238,7 @@ async def test_option_flow_install_multi_pan_addon( install_addon.assert_called_once_with(hass, "core_silabs_multiprotocol") result = await hass.config_entries.options.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["step_id"] == "start_addon" set_addon_options.assert_called_once_with( hass, @@ -257,7 +257,7 @@ async def test_option_flow_install_multi_pan_addon( start_addon.assert_called_once_with(hass, "core_silabs_multiprotocol") result = await hass.config_entries.options.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY def mock_detect_radio_type(radio_type=RadioType.ezsp, ret=True): @@ -329,7 +329,7 @@ async def test_option_flow_install_multi_pan_addon_zha( side_effect=Mock(return_value=True), ): result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "addon_not_installed" result = await hass.config_entries.options.async_configure( @@ -338,7 +338,7 @@ async def test_option_flow_install_multi_pan_addon_zha( "enable_multi_pan": True, }, ) - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["step_id"] == "install_addon" assert result["progress_action"] == "install_addon" @@ -346,7 +346,7 @@ async def test_option_flow_install_multi_pan_addon_zha( install_addon.assert_called_once_with(hass, "core_silabs_multiprotocol") result = await hass.config_entries.options.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["step_id"] == "start_addon" set_addon_options.assert_called_once_with( hass, @@ -374,4 +374,4 @@ async def test_option_flow_install_multi_pan_addon_zha( start_addon.assert_called_once_with(hass, "core_silabs_multiprotocol") result = await hass.config_entries.options.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY diff --git a/tests/components/homeassistant_yellow/test_config_flow.py b/tests/components/homeassistant_yellow/test_config_flow.py index 821621d5e57..206ad4dce15 100644 --- a/tests/components/homeassistant_yellow/test_config_flow.py +++ b/tests/components/homeassistant_yellow/test_config_flow.py @@ -65,7 +65,7 @@ async def test_config_flow(hass: HomeAssistant) -> None: DOMAIN, context={"source": "system"} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Home Assistant Yellow" assert result["data"] == {} assert result["options"] == {} @@ -99,7 +99,7 @@ async def test_config_flow_single_entry(hass: HomeAssistant) -> None: DOMAIN, context={"source": "system"} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" mock_setup_entry.assert_not_called() @@ -126,7 +126,7 @@ async def test_option_flow_install_multi_pan_addon( config_entry.add_to_hass(hass) result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU with patch( "homeassistant.components.homeassistant_hardware.silabs_multiprotocol_addon.is_hassio", @@ -136,7 +136,7 @@ async def test_option_flow_install_multi_pan_addon( result["flow_id"], {"next_step_id": "multipan_settings"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "addon_not_installed" result = await hass.config_entries.options.async_configure( @@ -145,7 +145,7 @@ async def test_option_flow_install_multi_pan_addon( "enable_multi_pan": True, }, ) - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["step_id"] == "install_addon" assert result["progress_action"] == "install_addon" @@ -153,7 +153,7 @@ async def test_option_flow_install_multi_pan_addon( install_addon.assert_called_once_with(hass, "core_silabs_multiprotocol") result = await hass.config_entries.options.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["step_id"] == "start_addon" set_addon_options.assert_called_once_with( hass, @@ -172,7 +172,7 @@ async def test_option_flow_install_multi_pan_addon( start_addon.assert_called_once_with(hass, "core_silabs_multiprotocol") result = await hass.config_entries.options.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY async def test_option_flow_install_multi_pan_addon_zha( @@ -205,7 +205,7 @@ async def test_option_flow_install_multi_pan_addon_zha( zha_config_entry.add_to_hass(hass) result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU with patch( "homeassistant.components.homeassistant_hardware.silabs_multiprotocol_addon.is_hassio", @@ -215,7 +215,7 @@ async def test_option_flow_install_multi_pan_addon_zha( result["flow_id"], {"next_step_id": "multipan_settings"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "addon_not_installed" result = await hass.config_entries.options.async_configure( @@ -224,7 +224,7 @@ async def test_option_flow_install_multi_pan_addon_zha( "enable_multi_pan": True, }, ) - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["step_id"] == "install_addon" assert result["progress_action"] == "install_addon" @@ -232,7 +232,7 @@ async def test_option_flow_install_multi_pan_addon_zha( install_addon.assert_called_once_with(hass, "core_silabs_multiprotocol") result = await hass.config_entries.options.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["step_id"] == "start_addon" set_addon_options.assert_called_once_with( hass, @@ -260,7 +260,7 @@ async def test_option_flow_install_multi_pan_addon_zha( start_addon.assert_called_once_with(hass, "core_silabs_multiprotocol") result = await hass.config_entries.options.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY @pytest.mark.parametrize( @@ -289,20 +289,20 @@ async def test_option_flow_led_settings( config_entry.add_to_hass(hass) result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "main_menu" result = await hass.config_entries.options.async_configure( result["flow_id"], {"next_step_id": "hardware_settings"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.options.async_configure( result["flow_id"], {"disk_led": False, "heartbeat_led": False, "power_led": False}, ) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "reboot_menu" set_yellow_settings.assert_called_once_with( hass, {"disk_led": False, "heartbeat_led": False, "power_led": False} @@ -312,7 +312,7 @@ async def test_option_flow_led_settings( result["flow_id"], {"next_step_id": reboot_menu_choice}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert len(reboot_host.mock_calls) == reboot_calls @@ -335,20 +335,20 @@ async def test_option_flow_led_settings_unchanged( config_entry.add_to_hass(hass) result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "main_menu" result = await hass.config_entries.options.async_configure( result["flow_id"], {"next_step_id": "hardware_settings"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.options.async_configure( result["flow_id"], {"disk_led": True, "heartbeat_led": True, "power_led": True}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY set_yellow_settings.assert_not_called() @@ -367,7 +367,7 @@ async def test_option_flow_led_settings_fail_1(hass: HomeAssistant) -> None: config_entry.add_to_hass(hass) result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "main_menu" with patch( @@ -378,7 +378,7 @@ async def test_option_flow_led_settings_fail_1(hass: HomeAssistant) -> None: result["flow_id"], {"next_step_id": "hardware_settings"}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "read_hw_settings_error" @@ -399,14 +399,14 @@ async def test_option_flow_led_settings_fail_2( config_entry.add_to_hass(hass) result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "main_menu" result = await hass.config_entries.options.async_configure( result["flow_id"], {"next_step_id": "hardware_settings"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM with patch( "homeassistant.components.homeassistant_yellow.config_flow.async_set_yellow_settings", @@ -416,5 +416,5 @@ async def test_option_flow_led_settings_fail_2( result["flow_id"], {"disk_led": False, "heartbeat_led": False, "power_led": False}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "write_hw_settings_error" diff --git a/tests/components/homekit/test_config_flow.py b/tests/components/homekit/test_config_flow.py index b3b8a70b1a1..0cd8e3284db 100644 --- a/tests/components/homekit/test_config_flow.py +++ b/tests/components/homekit/test_config_flow.py @@ -5,7 +5,7 @@ from unittest.mock import AsyncMock, Mock, patch import pytest import voluptuous as vol -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.homekit.const import ( CONF_FILTER, DOMAIN, @@ -14,6 +14,7 @@ from homeassistant.components.homekit.const import ( from homeassistant.config_entries import SOURCE_IGNORE, SOURCE_IMPORT from homeassistant.const import CONF_NAME, CONF_PORT, EntityCategory from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from homeassistant.helpers import device_registry as dr, entity_registry as er from homeassistant.helpers.entityfilter import CONF_INCLUDE_DOMAINS from homeassistant.setup import async_setup_component @@ -57,7 +58,7 @@ async def test_setup_in_bridge_mode(hass: HomeAssistant, mock_get_source_ip) -> result["flow_id"], {"include_domains": ["light"]}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "pairing" with ( @@ -79,7 +80,7 @@ async def test_setup_in_bridge_mode(hass: HomeAssistant, mock_get_source_ip) -> ) await hass.async_block_till_done() - assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY bridge_name = (result3["title"].split(":"))[0] assert bridge_name == SHORT_BRIDGE_NAME assert result3["data"] == { @@ -119,7 +120,7 @@ async def test_setup_in_bridge_mode_name_taken( result["flow_id"], {"include_domains": ["light"]}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "pairing" with ( @@ -141,7 +142,7 @@ async def test_setup_in_bridge_mode_name_taken( ) await hass.async_block_till_done() - assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] != SHORT_BRIDGE_NAME assert result3["title"].startswith(SHORT_BRIDGE_NAME) bridge_name = (result3["title"].split(":"))[0] @@ -205,7 +206,7 @@ async def test_setup_creates_entries_for_accessory_mode_devices( result["flow_id"], {"include_domains": ["camera", "media_player", "light", "lock", "remote"]}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "pairing" with ( @@ -227,7 +228,7 @@ async def test_setup_creates_entries_for_accessory_mode_devices( ) await hass.async_block_till_done() - assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"][:11] == "HASS Bridge" bridge_name = (result3["title"].split(":"))[0] assert result3["data"] == { @@ -272,7 +273,7 @@ async def test_import(hass: HomeAssistant, mock_get_source_ip) -> None: context={"source": config_entries.SOURCE_IMPORT}, data={CONF_NAME: "mock_name", CONF_PORT: 12345}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "port_name_in_use" with ( @@ -291,7 +292,7 @@ async def test_import(hass: HomeAssistant, mock_get_source_ip) -> None: ) await hass.async_block_till_done() - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "othername:56789" assert result2["data"] == { "name": "othername", @@ -316,7 +317,7 @@ async def test_options_flow_exclude_mode_advanced( config_entry.entry_id, context={"show_advanced_options": True} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -327,14 +328,14 @@ async def test_options_flow_exclude_mode_advanced( }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "exclude" result2 = await hass.config_entries.options.async_configure( result["flow_id"], user_input={"entities": ["climate.old"]}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "advanced" with patch("homeassistant.components.homekit.async_setup_entry", return_value=True): @@ -343,7 +344,7 @@ async def test_options_flow_exclude_mode_advanced( user_input={}, ) - assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { "devices": [], "mode": "bridge", @@ -373,7 +374,7 @@ async def test_options_flow_exclude_mode_basic( config_entry.entry_id, context={"show_advanced_options": False} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -384,7 +385,7 @@ async def test_options_flow_exclude_mode_basic( }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "exclude" entities = result["data_schema"]({})["entities"] assert entities == ["climate.front_gate"] @@ -397,7 +398,7 @@ async def test_options_flow_exclude_mode_basic( result["flow_id"], user_input={"entities": ["climate.old"]}, ) - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { "mode": "bridge", "filter": { @@ -458,7 +459,7 @@ async def test_options_flow_devices( config_entry.entry_id, context={"show_advanced_options": True} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -469,7 +470,7 @@ async def test_options_flow_devices( }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "exclude" entry = entity_registry.async_get("light.ceiling_lights") @@ -491,7 +492,7 @@ async def test_options_flow_devices( user_input={"devices": [device_id]}, ) - assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { "devices": [device_id], "mode": "bridge", @@ -547,7 +548,7 @@ async def test_options_flow_devices_preserved_when_advanced_off( config_entry.entry_id, context={"show_advanced_options": False} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -558,7 +559,7 @@ async def test_options_flow_devices_preserved_when_advanced_off( }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "exclude" result2 = await hass.config_entries.options.async_configure( @@ -568,7 +569,7 @@ async def test_options_flow_devices_preserved_when_advanced_off( }, ) - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { "devices": ["1fabcabcabcabcabcabcabcabcabc"], "mode": "bridge", @@ -607,7 +608,7 @@ async def test_options_flow_include_mode_with_non_existant_entity( config_entry.entry_id, context={"show_advanced_options": False} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -618,7 +619,7 @@ async def test_options_flow_include_mode_with_non_existant_entity( }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "include" entities = result["data_schema"]({})["entities"] @@ -630,7 +631,7 @@ async def test_options_flow_include_mode_with_non_existant_entity( "entities": ["climate.new", "climate.front_gate"], }, ) - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { "mode": "bridge", "filter": { @@ -668,7 +669,7 @@ async def test_options_flow_exclude_mode_with_non_existant_entity( config_entry.entry_id, context={"show_advanced_options": False} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -679,7 +680,7 @@ async def test_options_flow_exclude_mode_with_non_existant_entity( }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "exclude" entities = result["data_schema"]({})["entities"] @@ -691,7 +692,7 @@ async def test_options_flow_exclude_mode_with_non_existant_entity( "entities": ["climate.new", "climate.front_gate"], }, ) - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { "mode": "bridge", "filter": { @@ -722,7 +723,7 @@ async def test_options_flow_include_mode_basic( config_entry.entry_id, context={"show_advanced_options": False} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -733,14 +734,14 @@ async def test_options_flow_include_mode_basic( }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "include" result2 = await hass.config_entries.options.async_configure( result["flow_id"], user_input={"entities": ["climate.new"]}, ) - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { "mode": "bridge", "filter": { @@ -772,7 +773,7 @@ async def test_options_flow_exclude_mode_with_cameras( config_entry.entry_id, context={"show_advanced_options": False} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -783,7 +784,7 @@ async def test_options_flow_exclude_mode_with_cameras( }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "exclude" result2 = await hass.config_entries.options.async_configure( @@ -792,7 +793,7 @@ async def test_options_flow_exclude_mode_with_cameras( "entities": ["climate.old", "camera.excluded"], }, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "cameras" result3 = await hass.config_entries.options.async_configure( @@ -800,7 +801,7 @@ async def test_options_flow_exclude_mode_with_cameras( user_input={"camera_copy": ["camera.native_h264"]}, ) - assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { "mode": "bridge", "filter": { @@ -818,7 +819,7 @@ async def test_options_flow_exclude_mode_with_cameras( config_entry.entry_id, context={"show_advanced_options": False} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -829,7 +830,7 @@ async def test_options_flow_exclude_mode_with_cameras( }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "exclude" result2 = await hass.config_entries.options.async_configure( @@ -838,7 +839,7 @@ async def test_options_flow_exclude_mode_with_cameras( "entities": ["climate.old", "camera.excluded"], }, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "cameras" result3 = await hass.config_entries.options.async_configure( @@ -846,7 +847,7 @@ async def test_options_flow_exclude_mode_with_cameras( user_input={"camera_copy": ["camera.native_h264"]}, ) - assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { "mode": "bridge", @@ -881,7 +882,7 @@ async def test_options_flow_include_mode_with_cameras( config_entry.entry_id, context={"show_advanced_options": False} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -892,7 +893,7 @@ async def test_options_flow_include_mode_with_cameras( }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "include" result2 = await hass.config_entries.options.async_configure( @@ -901,7 +902,7 @@ async def test_options_flow_include_mode_with_cameras( "entities": ["camera.native_h264", "camera.transcode_h264"], }, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "cameras" result3 = await hass.config_entries.options.async_configure( @@ -909,7 +910,7 @@ async def test_options_flow_include_mode_with_cameras( user_input={"camera_copy": ["camera.native_h264"]}, ) - assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { "mode": "bridge", "filter": { @@ -927,7 +928,7 @@ async def test_options_flow_include_mode_with_cameras( config_entry.entry_id, context={"show_advanced_options": False} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" assert result["data_schema"]({}) == { "domains": ["climate", "fan", "vacuum", "camera"], @@ -952,7 +953,7 @@ async def test_options_flow_include_mode_with_cameras( }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "exclude" assert result["data_schema"]({}) == { "entities": ["camera.native_h264", "camera.transcode_h264"], @@ -969,7 +970,7 @@ async def test_options_flow_include_mode_with_cameras( "entities": ["climate.old", "camera.excluded"], }, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "cameras" assert result2["data_schema"]({}) == { "camera_copy": ["camera.native_h264"], @@ -983,7 +984,7 @@ async def test_options_flow_include_mode_with_cameras( user_input={"camera_copy": []}, ) - assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { "entity_config": {}, "filter": { @@ -1017,7 +1018,7 @@ async def test_options_flow_with_camera_audio( config_entry.entry_id, context={"show_advanced_options": False} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -1028,7 +1029,7 @@ async def test_options_flow_with_camera_audio( }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "include" result2 = await hass.config_entries.options.async_configure( @@ -1037,7 +1038,7 @@ async def test_options_flow_with_camera_audio( "entities": ["camera.audio", "camera.no_audio"], }, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "cameras" result3 = await hass.config_entries.options.async_configure( @@ -1045,7 +1046,7 @@ async def test_options_flow_with_camera_audio( user_input={"camera_audio": ["camera.audio"]}, ) - assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { "mode": "bridge", "filter": { @@ -1063,7 +1064,7 @@ async def test_options_flow_with_camera_audio( config_entry.entry_id, context={"show_advanced_options": False} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" assert result["data_schema"]({}) == { "domains": ["climate", "fan", "vacuum", "camera"], @@ -1088,7 +1089,7 @@ async def test_options_flow_with_camera_audio( }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "exclude" assert result["data_schema"]({}) == { "entities": ["camera.audio", "camera.no_audio"], @@ -1105,7 +1106,7 @@ async def test_options_flow_with_camera_audio( "entities": ["climate.old", "camera.excluded"], }, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "cameras" assert result2["data_schema"]({}) == { "camera_copy": [], @@ -1119,7 +1120,7 @@ async def test_options_flow_with_camera_audio( user_input={"camera_audio": []}, ) - assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { "entity_config": {}, "filter": { @@ -1164,7 +1165,7 @@ async def test_options_flow_blocked_when_from_yaml( result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "yaml" with patch("homeassistant.components.homekit.async_setup_entry", return_value=True): @@ -1172,7 +1173,7 @@ async def test_options_flow_blocked_when_from_yaml( result["flow_id"], user_input={}, ) - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY await hass.config_entries.async_unload(config_entry.entry_id) @@ -1197,7 +1198,7 @@ async def test_options_flow_include_mode_basic_accessory( config_entry.entry_id, context={"show_advanced_options": False} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" assert result["data_schema"]({}) == { "domains": [ @@ -1217,7 +1218,7 @@ async def test_options_flow_include_mode_basic_accessory( user_input={"domains": ["media_player"], "mode": "accessory"}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "accessory" assert _get_schema_default(result2["data_schema"].schema, "entities") is None @@ -1225,7 +1226,7 @@ async def test_options_flow_include_mode_basic_accessory( result2["flow_id"], user_input={"entities": "media_player.tv"}, ) - assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { "mode": "accessory", "filter": { @@ -1243,7 +1244,7 @@ async def test_options_flow_include_mode_basic_accessory( config_entry.entry_id, context={"show_advanced_options": False} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" assert result["data_schema"]({}) == { "domains": ["media_player"], @@ -1256,7 +1257,7 @@ async def test_options_flow_include_mode_basic_accessory( user_input={"domains": ["media_player"], "mode": "accessory"}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "accessory" assert ( _get_schema_default(result2["data_schema"].schema, "entities") @@ -1267,7 +1268,7 @@ async def test_options_flow_include_mode_basic_accessory( result2["flow_id"], user_input={"entities": "media_player.tv"}, ) - assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { "mode": "accessory", "filter": { @@ -1296,7 +1297,7 @@ async def test_converting_bridge_to_accessory_mode( result["flow_id"], {"include_domains": ["light"]}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "pairing" # We need to actually setup the config entry or the data @@ -1317,7 +1318,7 @@ async def test_converting_bridge_to_accessory_mode( ) await hass.async_block_till_done() - assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"][:11] == "HASS Bridge" bridge_name = (result3["title"].split(":"))[0] assert result3["data"] == { @@ -1345,7 +1346,7 @@ async def test_converting_bridge_to_accessory_mode( config_entry.entry_id, context={"show_advanced_options": False} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" schema = result["data_schema"].schema assert _get_schema_default(schema, "mode") == "bridge" @@ -1356,14 +1357,14 @@ async def test_converting_bridge_to_accessory_mode( user_input={"domains": ["camera"], "mode": "accessory"}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "accessory" result2 = await hass.config_entries.options.async_configure( result["flow_id"], user_input={"entities": "camera.tv"}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "cameras" with ( @@ -1379,7 +1380,7 @@ async def test_converting_bridge_to_accessory_mode( ) await hass.async_block_till_done() - assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { "entity_config": {"camera.tv": {"video_codec": "copy"}}, "mode": "accessory", @@ -1444,7 +1445,7 @@ async def test_options_flow_exclude_mode_skips_category_entities( config_entry.entry_id, context={"show_advanced_options": False} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" assert result["data_schema"]({}) == { "domains": [ @@ -1468,7 +1469,7 @@ async def test_options_flow_exclude_mode_skips_category_entities( }, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "exclude" assert _get_schema_default(result2["data_schema"].schema, "entities") == [] @@ -1490,7 +1491,7 @@ async def test_options_flow_exclude_mode_skips_category_entities( ] }, ) - assert result4["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result4["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { "mode": "bridge", "filter": { @@ -1539,7 +1540,7 @@ async def test_options_flow_exclude_mode_skips_hidden_entities( config_entry.entry_id, context={"show_advanced_options": False} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" assert result["data_schema"]({}) == { "domains": [ @@ -1563,7 +1564,7 @@ async def test_options_flow_exclude_mode_skips_hidden_entities( }, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "exclude" assert _get_schema_default(result2["data_schema"].schema, "entities") == [] @@ -1579,7 +1580,7 @@ async def test_options_flow_exclude_mode_skips_hidden_entities( result2["flow_id"], user_input={"entities": ["media_player.tv", "switch.other"]}, ) - assert result4["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result4["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { "mode": "bridge", "filter": { @@ -1624,7 +1625,7 @@ async def test_options_flow_include_mode_allows_hidden_entities( config_entry.entry_id, context={"show_advanced_options": False} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" assert result["data_schema"]({}) == { "domains": [ @@ -1648,7 +1649,7 @@ async def test_options_flow_include_mode_allows_hidden_entities( }, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "include" assert _get_schema_default(result2["data_schema"].schema, "entities") == [] @@ -1664,7 +1665,7 @@ async def test_options_flow_include_mode_allows_hidden_entities( ] }, ) - assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { "mode": "bridge", "filter": { diff --git a/tests/components/homekit_controller/test_config_flow.py b/tests/components/homekit_controller/test_config_flow.py index 6b658e9eef4..fbbd945b987 100644 --- a/tests/components/homekit_controller/test_config_flow.py +++ b/tests/components/homekit_controller/test_config_flow.py @@ -13,7 +13,7 @@ from aiohomekit.model.services import ServicesTypes from bleak.exc import BleakError import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components import zeroconf from homeassistant.components.homekit_controller import config_flow from homeassistant.components.homekit_controller.const import KNOWN_DEVICES @@ -520,7 +520,7 @@ async def test_discovery_ignored_config_entry(hass: HomeAssistant, controller) - assert config_entry_count == 1 # We should abort since there is no accessory id in the data - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -1110,11 +1110,11 @@ async def test_mdns_update_to_paired_during_pairing( context={"source": config_entries.SOURCE_ZEROCONF}, data=discovery_info_paired, ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_paired" mdns_update_to_paired.set() result = await task - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Koogeek-LS1-20833F" assert result["data"] == {} @@ -1130,7 +1130,7 @@ async def test_discovery_no_bluetooth_support(hass: HomeAssistant, controller) - context={"source": config_entries.SOURCE_BLUETOOTH}, data=HK_BLUETOOTH_SERVICE_INFO_NOT_DISCOVERED, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "ignored_model" @@ -1145,7 +1145,7 @@ async def test_bluetooth_not_homekit(hass: HomeAssistant, controller) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=NOT_HK_BLUETOOTH_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "ignored_model" @@ -1162,7 +1162,7 @@ async def test_bluetooth_valid_device_no_discovery( context={"source": config_entries.SOURCE_BLUETOOTH}, data=HK_BLUETOOTH_SERVICE_INFO_NOT_DISCOVERED, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "accessory_not_found_error" @@ -1182,7 +1182,7 @@ async def test_bluetooth_valid_device_discovery_paired( data=HK_BLUETOOTH_SERVICE_INFO_DISCOVERED_PAIRED, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_paired" @@ -1203,7 +1203,7 @@ async def test_bluetooth_valid_device_discovery_unpaired( data=HK_BLUETOOTH_SERVICE_INFO_DISCOVERED_UNPAIRED, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "pair" assert storage.get_map("00:00:00:00:00:00") is None @@ -1214,11 +1214,11 @@ async def test_bluetooth_valid_device_discovery_unpaired( } result2 = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM result3 = await hass.config_entries.flow.async_configure( result2["flow_id"], user_input={"pairing_code": "111-22-333"} ) - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == "Koogeek-LS1-20833F" assert result3["data"] == {} @@ -1256,7 +1256,7 @@ async def test_discovery_updates_ip_when_config_entry_set_up( context={"source": config_entries.SOURCE_ZEROCONF}, data=discovery_info, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" await hass.async_block_till_done() @@ -1294,7 +1294,7 @@ async def test_discovery_updates_ip_config_entry_not_set_up( context={"source": config_entries.SOURCE_ZEROCONF}, data=discovery_info, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" await hass.async_block_till_done() diff --git a/tests/components/homewizard/test_config_flow.py b/tests/components/homewizard/test_config_flow.py index f0776877aec..08f1436c03a 100644 --- a/tests/components/homewizard/test_config_flow.py +++ b/tests/components/homewizard/test_config_flow.py @@ -29,14 +29,14 @@ async def test_manual_flow_works( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_IP_ADDRESS: "2.2.2.2"} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result == snapshot assert len(hass.config_entries.async_entries(DOMAIN)) == 1 @@ -71,21 +71,21 @@ async def test_discovery_flow_works( ), ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "discovery_confirm" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=None ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "discovery_confirm" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={"ip_address": "127.0.0.1"} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result == snapshot @@ -117,7 +117,7 @@ async def test_discovery_flow_during_onboarding( ), ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result == snapshot assert len(mock_setup_entry.mock_calls) == 1 @@ -154,7 +154,7 @@ async def test_discovery_flow_during_onboarding_disabled_api( ), ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "discovery_confirm" assert result["errors"] == {"base": "api_not_enabled"} @@ -166,7 +166,7 @@ async def test_discovery_flow_during_onboarding_disabled_api( result["flow_id"], user_input={"ip_address": "127.0.0.1"} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result == snapshot assert len(mock_setup_entry.mock_calls) == 1 @@ -198,7 +198,7 @@ async def test_discovery_disabled_api( ), ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "discovery_confirm" mock_homewizardenergy.device.side_effect = DisabledError @@ -207,7 +207,7 @@ async def test_discovery_disabled_api( result["flow_id"], user_input={"ip_address": "127.0.0.1"} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "api_not_enabled"} @@ -233,7 +233,7 @@ async def test_discovery_missing_data_in_service_info(hass: HomeAssistant) -> No ), ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "invalid_discovery_parameters" @@ -259,7 +259,7 @@ async def test_discovery_invalid_api(hass: HomeAssistant) -> None: ), ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "unsupported_api_version" @@ -281,14 +281,14 @@ async def test_error_flow( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_IP_ADDRESS: "127.0.0.1"} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": reason} assert result["data_schema"]({}) == {CONF_IP_ADDRESS: "127.0.0.1"} @@ -299,7 +299,7 @@ async def test_error_flow( result["flow_id"], {CONF_IP_ADDRESS: "127.0.0.1"} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY @pytest.mark.parametrize( @@ -329,7 +329,7 @@ async def test_abort_flow( result["flow_id"], {CONF_IP_ADDRESS: "2.2.2.2"} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == reason @@ -354,7 +354,7 @@ async def test_reauth_flow( result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" @@ -375,10 +375,10 @@ async def test_reauth_error( }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "api_not_enabled"} diff --git a/tests/components/homeworks/test_config_flow.py b/tests/components/homeworks/test_config_flow.py index 4bdb5938f1c..53128c4cd65 100644 --- a/tests/components/homeworks/test_config_flow.py +++ b/tests/components/homeworks/test_config_flow.py @@ -48,7 +48,7 @@ async def test_user_flow( CONF_PORT: 1234, }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Main controller" assert result["data"] == {} assert result["options"] == { @@ -82,7 +82,7 @@ async def test_user_flow_already_exists( CONF_PORT: 1234, }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "duplicated_host_port"} @@ -94,7 +94,7 @@ async def test_user_flow_already_exists( CONF_PORT: 1234, }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "duplicated_controller_id"} @@ -125,7 +125,7 @@ async def test_user_flow_cannot_connect( CONF_PORT: 1234, }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": error} assert result["step_id"] == "user" @@ -185,19 +185,19 @@ async def test_import_flow( ], }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "import_controller_name" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_NAME: "Main controller"} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "import_finish" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Main controller" assert result["data"] == {} assert result["options"] == { @@ -241,7 +241,7 @@ async def test_import_flow_already_exists( context={"source": SOURCE_IMPORT}, data={"host": "192.168.0.1", "port": 1234, CONF_DIMMERS: [], CONF_KEYPADS: []}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert len(issue_registry.issues) == 1 @@ -256,13 +256,13 @@ async def test_import_flow_controller_id_exists( context={"source": SOURCE_IMPORT}, data={"host": "192.168.0.2", "port": 1234, CONF_DIMMERS: [], CONF_KEYPADS: []}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "import_controller_name" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_NAME: "Main controller"} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "import_controller_name" assert result["errors"] == {"base": "duplicated_controller_id"} @@ -277,7 +277,7 @@ async def test_reconfigure_flow( DOMAIN, context={"source": SOURCE_RECONFIGURE, "entry_id": mock_config_entry.entry_id}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reconfigure" result = await hass.config_entries.flow.async_configure( @@ -288,7 +288,7 @@ async def test_reconfigure_flow( }, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reconfigure_successful" assert mock_config_entry.options == { "controller_id": "main_controller", @@ -345,7 +345,7 @@ async def test_reconfigure_flow_flow_duplicate( DOMAIN, context={"source": SOURCE_RECONFIGURE, "entry_id": entry1.entry_id}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reconfigure" result = await hass.config_entries.flow.async_configure( @@ -355,7 +355,7 @@ async def test_reconfigure_flow_flow_duplicate( CONF_PORT: 1234, }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reconfigure" assert result["errors"] == {"base": "duplicated_host_port"} @@ -370,7 +370,7 @@ async def test_reconfigure_flow_flow_no_change( DOMAIN, context={"source": SOURCE_RECONFIGURE, "entry_id": mock_config_entry.entry_id}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reconfigure" result = await hass.config_entries.flow.async_configure( @@ -380,7 +380,7 @@ async def test_reconfigure_flow_flow_no_change( CONF_PORT: 1234, }, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reconfigure_successful" assert mock_config_entry.options == { "controller_id": "main_controller", @@ -422,14 +422,14 @@ async def test_options_add_light_flow( result = await hass.config_entries.options.async_init( mock_empty_config_entry.entry_id ) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( result["flow_id"], {"next_step_id": "add_light"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "add_light" result = await hass.config_entries.options.async_configure( @@ -440,7 +440,7 @@ async def test_options_add_light_flow( CONF_RATE: 2.0, }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "controller_id": "main_controller", "dimmers": [ @@ -469,14 +469,14 @@ async def test_options_add_remove_light_flow( assert hass.states.async_entity_ids("light") == unordered(["light.foyer_sconces"]) result = await hass.config_entries.options.async_init(mock_config_entry.entry_id) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( result["flow_id"], {"next_step_id": "add_light"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "add_light" result = await hass.config_entries.options.async_configure( @@ -487,7 +487,7 @@ async def test_options_add_remove_light_flow( CONF_RATE: 2.0, }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "controller_id": "main_controller", "dimmers": [ @@ -523,14 +523,14 @@ async def test_options_add_remove_light_flow( # Now remove the original light result = await hass.config_entries.options.async_init(mock_config_entry.entry_id) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( result["flow_id"], {"next_step_id": "remove_light"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "remove_light" assert result["data_schema"].schema["index"].options == { "0": "Foyer Sconces ([02:08:01:01])", @@ -540,7 +540,7 @@ async def test_options_add_remove_light_flow( result = await hass.config_entries.options.async_configure( result["flow_id"], user_input={CONF_INDEX: ["0"]} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "controller_id": "main_controller", "dimmers": [ @@ -583,14 +583,14 @@ async def test_options_add_remove_keypad_flow( await hass.async_block_till_done() result = await hass.config_entries.options.async_init(mock_config_entry.entry_id) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( result["flow_id"], {"next_step_id": "add_keypad"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "add_keypad" result = await hass.config_entries.options.async_configure( @@ -600,7 +600,7 @@ async def test_options_add_remove_keypad_flow( CONF_NAME: "Hall Keypad", }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "controller_id": "main_controller", "dimmers": [ @@ -631,14 +631,14 @@ async def test_options_add_remove_keypad_flow( # Now remove the original keypad result = await hass.config_entries.options.async_init(mock_config_entry.entry_id) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( result["flow_id"], {"next_step_id": "remove_keypad"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "remove_keypad" assert result["data_schema"].schema["index"].options == { "0": "Foyer Keypad ([02:08:02:01])", @@ -648,7 +648,7 @@ async def test_options_add_remove_keypad_flow( result = await hass.config_entries.options.async_configure( result["flow_id"], user_input={CONF_INDEX: ["0"]} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "controller_id": "main_controller", "dimmers": [ @@ -670,14 +670,14 @@ async def test_options_add_keypad_with_error( await hass.async_block_till_done() result = await hass.config_entries.options.async_init(mock_config_entry.entry_id) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( result["flow_id"], {"next_step_id": "add_keypad"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "add_keypad" # Try an invalid address @@ -688,7 +688,7 @@ async def test_options_add_keypad_with_error( CONF_NAME: "Hall Keypad", }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "add_keypad" assert result["errors"] == {"base": "invalid_addr"} @@ -700,7 +700,7 @@ async def test_options_add_keypad_with_error( CONF_NAME: "Hall Keypad", }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "add_keypad" assert result["errors"] == {"base": "duplicated_addr"} @@ -712,7 +712,7 @@ async def test_options_add_keypad_with_error( CONF_NAME: "Hall Keypad", }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "add_keypad" assert result["errors"] == {"base": "duplicated_addr"} @@ -727,13 +727,13 @@ async def test_options_edit_light_no_lights_flow( assert hass.states.async_entity_ids("light") == unordered(["light.foyer_sconces"]) result = await hass.config_entries.options.async_init(mock_config_entry.entry_id) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( result["flow_id"], {"next_step_id": "select_edit_light"} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "select_edit_light" assert result["data_schema"].schema["index"].container == { "0": "Foyer Sconces ([02:08:01:01])" @@ -743,7 +743,7 @@ async def test_options_edit_light_no_lights_flow( result["flow_id"], {"index": "0"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "edit_light" result = await hass.config_entries.options.async_configure( @@ -751,7 +751,7 @@ async def test_options_edit_light_no_lights_flow( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "controller_id": "main_controller", "dimmers": [{"addr": "[02:08:01:01]", "name": "Foyer Sconces", "rate": 3.0}], @@ -795,13 +795,13 @@ async def test_options_edit_light_flow_empty( result = await hass.config_entries.options.async_init( mock_empty_config_entry.entry_id ) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( result["flow_id"], {"next_step_id": "select_edit_light"} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "select_edit_light" assert result["data_schema"].schema["index"].container == {} @@ -817,13 +817,13 @@ async def test_options_add_button_flow( assert len(hass.states.async_entity_ids(BUTTON_DOMAIN)) == 3 result = await hass.config_entries.options.async_init(mock_config_entry.entry_id) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( result["flow_id"], {"next_step_id": "select_edit_keypad"} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "select_edit_keypad" assert result["data_schema"].schema["index"].container == { "0": "Foyer Keypad ([02:08:02:01])" @@ -833,14 +833,14 @@ async def test_options_add_button_flow( result["flow_id"], {"index": "0"}, ) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "edit_keypad" result = await hass.config_entries.options.async_configure( result["flow_id"], {"next_step_id": "add_button"} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "add_button" result = await hass.config_entries.options.async_configure( @@ -854,7 +854,7 @@ async def test_options_add_button_flow( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "controller_id": "main_controller", "dimmers": [{"addr": "[02:08:01:01]", "name": "Foyer Sconces", "rate": 1.0}], @@ -902,13 +902,13 @@ async def test_options_add_button_flow_duplicate( assert len(hass.states.async_entity_ids(BUTTON_DOMAIN)) == 3 result = await hass.config_entries.options.async_init(mock_config_entry.entry_id) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( result["flow_id"], {"next_step_id": "select_edit_keypad"} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "select_edit_keypad" assert result["data_schema"].schema["index"].container == { "0": "Foyer Keypad ([02:08:02:01])" @@ -918,14 +918,14 @@ async def test_options_add_button_flow_duplicate( result["flow_id"], {"index": "0"}, ) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "edit_keypad" result = await hass.config_entries.options.async_configure( result["flow_id"], {"next_step_id": "add_button"} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "add_button" result = await hass.config_entries.options.async_configure( @@ -937,7 +937,7 @@ async def test_options_add_button_flow_duplicate( }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "duplicated_number"} @@ -952,13 +952,13 @@ async def test_options_edit_button_flow( assert len(hass.states.async_entity_ids(BUTTON_DOMAIN)) == 3 result = await hass.config_entries.options.async_init(mock_config_entry.entry_id) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( result["flow_id"], {"next_step_id": "select_edit_keypad"} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "select_edit_keypad" assert result["data_schema"].schema["index"].container == { "0": "Foyer Keypad ([02:08:02:01])" @@ -968,13 +968,13 @@ async def test_options_edit_button_flow( result["flow_id"], {"index": "0"}, ) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "edit_keypad" result = await hass.config_entries.options.async_configure( result["flow_id"], {"next_step_id": "select_edit_button"} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "select_edit_button" assert result["data_schema"].schema["index"].container == { "0": "Morning (1)", @@ -986,7 +986,7 @@ async def test_options_edit_button_flow( result["flow_id"], {"index": "0"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "edit_button" result = await hass.config_entries.options.async_configure( @@ -998,7 +998,7 @@ async def test_options_edit_button_flow( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "controller_id": "main_controller", "dimmers": [{"addr": "[02:08:01:01]", "name": "Foyer Sconces", "rate": 1.0}], @@ -1039,13 +1039,13 @@ async def test_options_remove_button_flow( assert len(hass.states.async_entity_ids(BUTTON_DOMAIN)) == 3 result = await hass.config_entries.options.async_init(mock_config_entry.entry_id) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( result["flow_id"], {"next_step_id": "select_edit_keypad"} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "select_edit_keypad" assert result["data_schema"].schema["index"].container == { "0": "Foyer Keypad ([02:08:02:01])" @@ -1055,14 +1055,14 @@ async def test_options_remove_button_flow( result["flow_id"], {"index": "0"}, ) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "edit_keypad" result = await hass.config_entries.options.async_configure( result["flow_id"], {"next_step_id": "remove_button"} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "remove_button" assert result["data_schema"].schema["index"].options == { "0": "Morning (1)", @@ -1074,7 +1074,7 @@ async def test_options_remove_button_flow( result["flow_id"], user_input={CONF_INDEX: ["0"]} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "controller_id": "main_controller", "dimmers": [{"addr": "[02:08:01:01]", "name": "Foyer Sconces", "rate": 1.0}], diff --git a/tests/components/honeywell/test_config_flow.py b/tests/components/honeywell/test_config_flow.py index a978a14daa1..7cd987f0d83 100644 --- a/tests/components/honeywell/test_config_flow.py +++ b/tests/components/honeywell/test_config_flow.py @@ -5,7 +5,6 @@ from unittest.mock import MagicMock, patch import aiosomecomfort import pytest -from homeassistant import data_entry_flow from homeassistant.components.honeywell.const import ( CONF_COOL_AWAY_TEMPERATURE, CONF_HEAT_AWAY_TEMPERATURE, @@ -33,7 +32,7 @@ async def test_show_authenticate_form(hass: HomeAssistant) -> None: context={"source": SOURCE_USER}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" @@ -67,7 +66,7 @@ async def test_create_entry(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == FAKE_CONFIG @@ -87,7 +86,7 @@ async def test_show_option_form( ): result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" @@ -114,7 +113,7 @@ async def test_create_option_entry( ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { CONF_COOL_AWAY_TEMPERATURE: 1, CONF_HEAT_AWAY_TEMPERATURE: 2, @@ -147,7 +146,7 @@ async def test_reauth_flow(hass: HomeAssistant) -> None: await hass.async_block_till_done() assert result["step_id"] == "reauth_confirm" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with patch( @@ -160,7 +159,7 @@ async def test_reauth_flow(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "reauth_successful" assert mock_entry.data == { CONF_USERNAME: "new-username", @@ -190,7 +189,7 @@ async def test_reauth_flow_auth_error(hass: HomeAssistant, client: MagicMock) -> await hass.async_block_till_done() assert result["step_id"] == "reauth_confirm" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} client.login.side_effect = aiosomecomfort.device.AuthError @@ -204,7 +203,7 @@ async def test_reauth_flow_auth_error(hass: HomeAssistant, client: MagicMock) -> ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "invalid_auth"} @@ -239,7 +238,7 @@ async def test_reauth_flow_connnection_error( await hass.async_block_till_done() assert result["step_id"] == "reauth_confirm" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} client.login.side_effect = error @@ -250,5 +249,5 @@ async def test_reauth_flow_connnection_error( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} diff --git a/tests/components/huawei_lte/test_config_flow.py b/tests/components/huawei_lte/test_config_flow.py index f8ddaa42ac1..200796c87e7 100644 --- a/tests/components/huawei_lte/test_config_flow.py +++ b/tests/components/huawei_lte/test_config_flow.py @@ -12,7 +12,7 @@ from requests.exceptions import ConnectionError import requests_mock from requests_mock import ANY -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components import ssdp from homeassistant.components.huawei_lte.const import CONF_UNAUTHENTICATED_MODE, DOMAIN from homeassistant.const import ( @@ -24,6 +24,7 @@ from homeassistant.const import ( CONF_VERIFY_SSL, ) from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -48,7 +49,7 @@ async def test_show_set_form(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER}, data=None ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" @@ -63,7 +64,7 @@ async def test_urlize_plain_host( DOMAIN, context={"source": config_entries.SOURCE_USER}, data=user_input ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert user_input[CONF_URL] == f"http://{host}/" @@ -96,7 +97,7 @@ async def test_already_configured( data=FIXTURE_USER_INPUT, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -127,7 +128,7 @@ async def test_connection_errors( data=FIXTURE_USER_INPUT | data_patch, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == errors @@ -219,7 +220,7 @@ async def test_login_error( data={**FIXTURE_USER_INPUT, **fixture_override}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == errors @@ -250,7 +251,7 @@ async def test_success(hass: HomeAssistant, login_requests_mock, scheme: str) -> ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_URL] == user_input[CONF_URL] assert result["data"][CONF_USERNAME] == user_input[CONF_USERNAME] assert result["data"][CONF_PASSWORD] == user_input[CONF_PASSWORD] @@ -270,7 +271,7 @@ async def test_success(hass: HomeAssistant, login_requests_mock, scheme: str) -> ssdp.ATTR_UPNP_SERIAL: "00000000", }, { - "type": data_entry_flow.FlowResultType.FORM, + "type": FlowResultType.FORM, "step_id": "user", "errors": {}, }, @@ -286,7 +287,7 @@ async def test_success(hass: HomeAssistant, login_requests_mock, scheme: str) -> # No ssdp.ATTR_UPNP_SERIAL }, { - "type": data_entry_flow.FlowResultType.FORM, + "type": FlowResultType.FORM, "step_id": "user", "errors": {}, }, @@ -301,7 +302,7 @@ async def test_success(hass: HomeAssistant, login_requests_mock, scheme: str) -> # Does not matter }, { - "type": data_entry_flow.FlowResultType.ABORT, + "type": FlowResultType.ABORT, "reason": "unsupported_device", }, ), @@ -351,7 +352,7 @@ async def test_ssdp( ( "OK", { - "type": data_entry_flow.FlowResultType.ABORT, + "type": FlowResultType.ABORT, "reason": "reauth_successful", }, FIXTURE_USER_INPUT, @@ -359,7 +360,7 @@ async def test_ssdp( ( f"{LoginErrorEnum.PASSWORD_WRONG}", { - "type": data_entry_flow.FlowResultType.FORM, + "type": FlowResultType.FORM, "errors": {CONF_PASSWORD: "incorrect_password"}, "step_id": "reauth_confirm", }, @@ -393,7 +394,7 @@ async def test_reauth( DOMAIN, context=context, data=entry.data ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["data_schema"] is not None assert result["data_schema"]({}) == { @@ -431,7 +432,7 @@ async def test_options(hass: HomeAssistant) -> None: config_entry.add_to_hass(hass) result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" recipient = "+15555550000" diff --git a/tests/components/huisbaasje/test_config_flow.py b/tests/components/huisbaasje/test_config_flow.py index 0c65d425d4d..cca5c572712 100644 --- a/tests/components/huisbaasje/test_config_flow.py +++ b/tests/components/huisbaasje/test_config_flow.py @@ -8,9 +8,10 @@ from energyflip import ( EnergyFlipUnauthenticatedException, ) -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.huisbaasje.const import DOMAIN from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -21,7 +22,7 @@ async def test_form(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with ( @@ -80,7 +81,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None: }, ) - assert form_result["type"] == data_entry_flow.FlowResultType.FORM + assert form_result["type"] is FlowResultType.FORM assert form_result["errors"] == {"base": "invalid_auth"} @@ -102,7 +103,7 @@ async def test_form_authenticate_cannot_connect(hass: HomeAssistant) -> None: }, ) - assert form_result["type"] == data_entry_flow.FlowResultType.FORM + assert form_result["type"] is FlowResultType.FORM assert form_result["errors"] == {"base": "cannot_connect"} @@ -124,7 +125,7 @@ async def test_form_authenticate_unknown_error(hass: HomeAssistant) -> None: }, ) - assert form_result["type"] == data_entry_flow.FlowResultType.FORM + assert form_result["type"] is FlowResultType.FORM assert form_result["errors"] == {"base": "unknown"} @@ -149,7 +150,7 @@ async def test_form_customer_overview_cannot_connect(hass: HomeAssistant) -> Non }, ) - assert form_result["type"] == data_entry_flow.FlowResultType.FORM + assert form_result["type"] is FlowResultType.FORM assert form_result["errors"] == {"base": "cannot_connect"} @@ -174,7 +175,7 @@ async def test_form_customer_overview_authentication_error(hass: HomeAssistant) }, ) - assert form_result["type"] == data_entry_flow.FlowResultType.FORM + assert form_result["type"] is FlowResultType.FORM assert form_result["errors"] == {"base": "invalid_auth"} @@ -199,7 +200,7 @@ async def test_form_customer_overview_unknown_error(hass: HomeAssistant) -> None }, ) - assert form_result["type"] == data_entry_flow.FlowResultType.FORM + assert form_result["type"] is FlowResultType.FORM assert form_result["errors"] == {"base": "unknown"} @@ -240,5 +241,5 @@ async def test_form_entry_exists(hass: HomeAssistant) -> None: }, ) - assert form_result["type"] == data_entry_flow.FlowResultType.ABORT + assert form_result["type"] is FlowResultType.ABORT assert form_result["reason"] == "already_configured" diff --git a/tests/components/hunterdouglas_powerview/test_config_flow.py b/tests/components/hunterdouglas_powerview/test_config_flow.py index ac4f6368f38..b9721f4adb1 100644 --- a/tests/components/hunterdouglas_powerview/test_config_flow.py +++ b/tests/components/hunterdouglas_powerview/test_config_flow.py @@ -28,7 +28,7 @@ async def test_user_form( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} result2 = await hass.config_entries.flow.async_configure( @@ -37,7 +37,7 @@ async def test_user_form( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == f"Powerview Generation {api_version}" assert result2["data"] == {CONF_HOST: "1.2.3.4", CONF_API_VERSION: api_version} assert result2["result"].unique_id == "A1B2C3D4E5G6H7" @@ -47,14 +47,14 @@ async def test_user_form( result3 = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result3["type"] == FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["errors"] == {} result4 = await hass.config_entries.flow.async_configure( result3["flow_id"], {CONF_HOST: "1.2.3.4"}, ) - assert result4["type"] == FlowResultType.ABORT + assert result4["type"] is FlowResultType.ABORT assert result4["reason"] == "already_configured" @@ -84,7 +84,7 @@ async def test_form_homekit_and_dhcp_cannot_connect( data=discovery_info, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" # test we can recover from the failed entry @@ -97,7 +97,7 @@ async def test_form_homekit_and_dhcp_cannot_connect( result3 = await hass.config_entries.flow.async_configure(result2["flow_id"], {}) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == f"Powerview Generation {api_version}" assert result3["data"] == {CONF_HOST: "1.2.3.4", CONF_API_VERSION: api_version} assert result3["result"].unique_id == "A1B2C3D4E5G6H7" @@ -127,7 +127,7 @@ async def test_form_homekit_and_dhcp( data=discovery_info, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "link" assert result["errors"] is None assert result["description_placeholders"] == { @@ -139,7 +139,7 @@ async def test_form_homekit_and_dhcp( result2 = await hass.config_entries.flow.async_configure(result["flow_id"], {}) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == f"Powerview Generation {api_version}" assert result2["data"] == {CONF_HOST: "1.2.3.4", CONF_API_VERSION: api_version} assert result2["result"].unique_id == "A1B2C3D4E5G6H7" @@ -151,7 +151,7 @@ async def test_form_homekit_and_dhcp( context={"source": source}, data=discovery_info, ) - assert result3["type"] == FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT @pytest.mark.usefixtures("mock_hunterdouglas_hub") @@ -178,7 +178,7 @@ async def test_discovered_by_homekit_and_dhcp( data=homekit_discovery, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "link" result2 = await hass.config_entries.flow.async_init( @@ -187,7 +187,7 @@ async def test_discovered_by_homekit_and_dhcp( data=dhcp_discovery, ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_in_progress" @@ -213,7 +213,7 @@ async def test_form_cannot_connect( {CONF_HOST: "1.2.3.4"}, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} # Now try again without the patch in place to make sure we can recover @@ -222,7 +222,7 @@ async def test_form_cannot_connect( {CONF_HOST: "1.2.3.4"}, ) - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == f"Powerview Generation {api_version}" assert result3["data"] == {CONF_HOST: "1.2.3.4", CONF_API_VERSION: api_version} assert result3["result"].unique_id == "A1B2C3D4E5G6H7" @@ -257,7 +257,7 @@ async def test_form_no_data( {CONF_HOST: "1.2.3.4"}, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} # Now try again without the patch in place to make sure we can recover @@ -266,7 +266,7 @@ async def test_form_no_data( {CONF_HOST: "1.2.3.4"}, ) - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == f"Powerview Generation {api_version}" assert result3["data"] == {CONF_HOST: "1.2.3.4", CONF_API_VERSION: api_version} assert result3["result"].unique_id == "A1B2C3D4E5G6H7" @@ -296,7 +296,7 @@ async def test_form_unknown_exception( {CONF_HOST: "1.2.3.4"}, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} # Now try again without the patch in place to make sure we can recover @@ -305,7 +305,7 @@ async def test_form_unknown_exception( {CONF_HOST: "1.2.3.4"}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == f"Powerview Generation {api_version}" assert result2["data"] == {CONF_HOST: "1.2.3.4", CONF_API_VERSION: api_version} assert result2["result"].unique_id == "A1B2C3D4E5G6H7" @@ -335,7 +335,7 @@ async def test_form_unsupported_device( {CONF_HOST: "1.2.3.4"}, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unsupported_device"} # Now try again without the patch in place to make sure we can recover @@ -344,7 +344,7 @@ async def test_form_unsupported_device( {CONF_HOST: "1.2.3.4"}, ) - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == f"Powerview Generation {api_version}" assert result3["data"] == {CONF_HOST: "1.2.3.4", CONF_API_VERSION: api_version} assert result3["result"].unique_id == "A1B2C3D4E5G6H7" diff --git a/tests/components/husqvarna_automower/test_config_flow.py b/tests/components/husqvarna_automower/test_config_flow.py index e22ab7718ec..ce986c4c724 100644 --- a/tests/components/husqvarna_automower/test_config_flow.py +++ b/tests/components/husqvarna_automower/test_config_flow.py @@ -98,7 +98,7 @@ async def test_config_non_unique_profile( }, ) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP assert result["url"] == ( f"{OAUTH2_AUTHORIZE}?response_type=code&client_id={CLIENT_ID}" "&redirect_uri=https://example.com/auth/external/callback" @@ -125,7 +125,7 @@ async def test_config_non_unique_profile( }, ) result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/huum/test_config_flow.py b/tests/components/huum/test_config_flow.py index 219783079e3..9917f71fc08 100644 --- a/tests/components/huum/test_config_flow.py +++ b/tests/components/huum/test_config_flow.py @@ -23,7 +23,7 @@ async def test_form(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with ( @@ -45,7 +45,7 @@ async def test_form(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == TEST_USERNAME assert result2["data"] == { CONF_USERNAME: TEST_USERNAME, @@ -89,7 +89,7 @@ async def test_signup_flow_already_set_up(hass: HomeAssistant) -> None: }, ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT @pytest.mark.parametrize( @@ -122,7 +122,7 @@ async def test_huum_errors( }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": error_base} with ( @@ -142,4 +142,4 @@ async def test_huum_errors( CONF_PASSWORD: TEST_PASSWORD, }, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY diff --git a/tests/components/hvv_departures/test_config_flow.py b/tests/components/hvv_departures/test_config_flow.py index 2712e1bbca9..5a7aa8f8dde 100644 --- a/tests/components/hvv_departures/test_config_flow.py +++ b/tests/components/hvv_departures/test_config_flow.py @@ -5,7 +5,6 @@ from unittest.mock import patch from pygti.exceptions import CannotConnect, InvalidAuth -from homeassistant import data_entry_flow from homeassistant.components.hvv_departures.const import ( CONF_FILTER, CONF_REAL_TIME, @@ -15,6 +14,7 @@ from homeassistant.components.hvv_departures.const import ( from homeassistant.config_entries import SOURCE_USER from homeassistant.const import CONF_HOST, CONF_OFFSET, CONF_PASSWORD, CONF_USERNAME from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry, load_fixture @@ -289,7 +289,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -297,7 +297,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: user_input={CONF_FILTER: ["0"], CONF_OFFSET: 15, CONF_REAL_TIME: False}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { CONF_FILTER: [ { @@ -349,7 +349,7 @@ async def test_options_flow_invalid_auth(hass: HomeAssistant) -> None: ): result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" assert result["errors"] == {"base": "invalid_auth"} @@ -388,7 +388,7 @@ async def test_options_flow_cannot_connect(hass: HomeAssistant) -> None: ): result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" assert result["errors"] == {"base": "cannot_connect"} diff --git a/tests/components/hydrawise/test_config_flow.py b/tests/components/hydrawise/test_config_flow.py index 17c3eda1699..b0d5b098309 100644 --- a/tests/components/hydrawise/test_config_flow.py +++ b/tests/components/hydrawise/test_config_flow.py @@ -28,7 +28,7 @@ async def test_form( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -38,7 +38,7 @@ async def test_form( mock_pydrawise.get_user.return_value = user await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Hydrawise" assert result2["data"] == {"api_key": "abc123"} assert len(mock_setup_entry.mock_calls) == 1 @@ -58,13 +58,13 @@ async def test_form_api_error( result = await hass.config_entries.flow.async_configure( init_result["flow_id"], data ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} mock_pydrawise.get_user.reset_mock(side_effect=True) mock_pydrawise.get_user.return_value = user result2 = await hass.config_entries.flow.async_configure(result["flow_id"], data) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY async def test_form_connect_timeout( @@ -80,13 +80,13 @@ async def test_form_connect_timeout( init_result["flow_id"], data ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "timeout_connect"} mock_pydrawise.get_user.reset_mock(side_effect=True) mock_pydrawise.get_user.return_value = user result2 = await hass.config_entries.flow.async_configure(result["flow_id"], data) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY async def test_flow_import_success( @@ -104,7 +104,7 @@ async def test_flow_import_success( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Hydrawise" assert result["data"] == { CONF_API_KEY: "__api_key__", @@ -131,7 +131,7 @@ async def test_flow_import_api_error( }, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" issue_registry = ir.async_get(hass) @@ -155,7 +155,7 @@ async def test_flow_import_connect_timeout( }, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "timeout_connect" issue_registry = ir.async_get(hass) @@ -191,7 +191,7 @@ async def test_flow_import_already_imported( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result.get("reason") == "already_configured" issue_registry = ir.async_get(hass) diff --git a/tests/components/hyperion/test_config_flow.py b/tests/components/hyperion/test_config_flow.py index 86dc4c5c39d..a05316a4bc9 100644 --- a/tests/components/hyperion/test_config_flow.py +++ b/tests/components/hyperion/test_config_flow.py @@ -10,7 +10,6 @@ from unittest.mock import AsyncMock, Mock, patch from hyperion import const -from homeassistant import data_entry_flow from homeassistant.components import ssdp from homeassistant.components.hyperion.const import ( CONF_AUTH_ID, @@ -30,7 +29,7 @@ from homeassistant.const import ( SERVICE_TURN_ON, ) from homeassistant.core import HomeAssistant -from homeassistant.data_entry_flow import FlowResult +from homeassistant.data_entry_flow import FlowResult, FlowResultType from . import ( TEST_AUTH_REQUIRED_RESP, @@ -165,7 +164,7 @@ async def test_user_if_no_configuration(hass: HomeAssistant) -> None: """Check flow behavior when no configuration is present.""" result = await _init_flow(hass) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["handler"] == DOMAIN @@ -180,7 +179,7 @@ async def test_user_existing_id_abort(hass: HomeAssistant) -> None: "homeassistant.components.hyperion.client.HyperionClient", return_value=client ): result = await _configure_flow(hass, result, user_input=TEST_HOST_PORT) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -196,7 +195,7 @@ async def test_user_client_errors(hass: HomeAssistant) -> None: "homeassistant.components.hyperion.client.HyperionClient", return_value=client ): result = await _configure_flow(hass, result, user_input=TEST_HOST_PORT) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"]["base"] == "cannot_connect" # Fail the auth check call. @@ -206,7 +205,7 @@ async def test_user_client_errors(hass: HomeAssistant) -> None: "homeassistant.components.hyperion.client.HyperionClient", return_value=client ): result = await _configure_flow(hass, result, user_input=TEST_HOST_PORT) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "auth_required_error" @@ -225,7 +224,7 @@ async def test_user_confirm_cannot_connect(hass: HomeAssistant) -> None: side_effect=[good_client, bad_client], ): result = await _configure_flow(hass, result, user_input=TEST_HOST_PORT) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -241,7 +240,7 @@ async def test_user_confirm_id_error(hass: HomeAssistant) -> None: "homeassistant.components.hyperion.client.HyperionClient", return_value=client ): result = await _configure_flow(hass, result, user_input=TEST_HOST_PORT) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_id" @@ -255,7 +254,7 @@ async def test_user_noauth_flow_success(hass: HomeAssistant) -> None: ): result = await _configure_flow(hass, result, user_input=TEST_HOST_PORT) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["handler"] == DOMAIN assert result["title"] == TEST_TITLE assert result["data"] == { @@ -274,7 +273,7 @@ async def test_user_auth_required(hass: HomeAssistant) -> None: "homeassistant.components.hyperion.client.HyperionClient", return_value=client ): result = await _configure_flow(hass, result, user_input=TEST_HOST_PORT) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "auth" @@ -288,7 +287,7 @@ async def test_auth_static_token_auth_required_fail(hass: HomeAssistant) -> None "homeassistant.components.hyperion.client.HyperionClient", return_value=client ): result = await _configure_flow(hass, result, user_input=TEST_HOST_PORT) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "auth_required_error" @@ -308,7 +307,7 @@ async def test_auth_static_token_success(hass: HomeAssistant) -> None: hass, result, user_input={CONF_CREATE_TOKEN: False, CONF_TOKEN: TEST_TOKEN} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["handler"] == DOMAIN assert result["title"] == TEST_TITLE assert result["data"] == { @@ -334,7 +333,7 @@ async def test_auth_static_token_login_connect_fail(hass: HomeAssistant) -> None hass, result, user_input={CONF_CREATE_TOKEN: False, CONF_TOKEN: TEST_TOKEN} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -357,7 +356,7 @@ async def test_auth_static_token_login_fail(hass: HomeAssistant) -> None: hass, result, user_input={CONF_CREATE_TOKEN: False, CONF_TOKEN: TEST_TOKEN} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"]["base"] == "invalid_access_token" @@ -372,7 +371,7 @@ async def test_auth_create_token_approval_declined(hass: HomeAssistant) -> None: "homeassistant.components.hyperion.client.HyperionClient", return_value=client ): result = await _configure_flow(hass, result, user_input=TEST_HOST_PORT) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "auth" client.async_request_token = AsyncMock(return_value=TEST_REQUEST_TOKEN_FAIL) @@ -390,7 +389,7 @@ async def test_auth_create_token_approval_declined(hass: HomeAssistant) -> None: hass, result, user_input={CONF_CREATE_TOKEN: True} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "create_token" assert result["description_placeholders"] == { CONF_AUTH_ID: TEST_AUTH_ID, @@ -398,13 +397,13 @@ async def test_auth_create_token_approval_declined(hass: HomeAssistant) -> None: result = await _configure_flow(hass, result) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP assert result["step_id"] == "create_token_external" # The flow will be automatically advanced by the auth token response. result = await _configure_flow(hass, result) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "auth_new_token_not_granted_error" @@ -486,7 +485,7 @@ async def test_auth_create_token_when_issued_token_fails( "homeassistant.components.hyperion.client.HyperionClient", return_value=client ): result = await _configure_flow(hass, result, user_input=TEST_HOST_PORT) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "auth" client.async_request_token = AsyncMock(return_value=TEST_REQUEST_TOKEN_SUCCESS) @@ -503,14 +502,14 @@ async def test_auth_create_token_when_issued_token_fails( result = await _configure_flow( hass, result, user_input={CONF_CREATE_TOKEN: True} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "create_token" assert result["description_placeholders"] == { CONF_AUTH_ID: TEST_AUTH_ID, } result = await _configure_flow(hass, result) - assert result["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP assert result["step_id"] == "create_token_external" # The flow will be automatically advanced by the auth token response. @@ -519,7 +518,7 @@ async def test_auth_create_token_when_issued_token_fails( client.async_client_connect = AsyncMock(return_value=False) result = await _configure_flow(hass, result) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -534,7 +533,7 @@ async def test_auth_create_token_success(hass: HomeAssistant) -> None: "homeassistant.components.hyperion.client.HyperionClient", return_value=client ): result = await _configure_flow(hass, result, user_input=TEST_HOST_PORT) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "auth" client.async_request_token = AsyncMock(return_value=TEST_REQUEST_TOKEN_SUCCESS) @@ -551,19 +550,19 @@ async def test_auth_create_token_success(hass: HomeAssistant) -> None: result = await _configure_flow( hass, result, user_input={CONF_CREATE_TOKEN: True} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "create_token" assert result["description_placeholders"] == { CONF_AUTH_ID: TEST_AUTH_ID, } result = await _configure_flow(hass, result) - assert result["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP assert result["step_id"] == "create_token_external" # The flow will be automatically advanced by the auth token response. result = await _configure_flow(hass, result) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["handler"] == DOMAIN assert result["title"] == TEST_TITLE assert result["data"] == { @@ -613,7 +612,7 @@ async def test_auth_create_token_success_but_login_fail( # The flow will be automatically advanced by the auth token response. result = await _configure_flow(hass, result) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "auth_new_token_not_work_error" @@ -633,7 +632,7 @@ async def test_ssdp_success(hass: HomeAssistant) -> None: ): result = await _configure_flow(hass, result) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["handler"] == DOMAIN assert result["title"] == TEST_TITLE assert result["data"] == { @@ -654,7 +653,7 @@ async def test_ssdp_cannot_connect(hass: HomeAssistant) -> None: result = await _init_flow(hass, source=SOURCE_SSDP, data=TEST_SSDP_SERVICE_INFO) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -672,7 +671,7 @@ async def test_ssdp_missing_serial(hass: HomeAssistant) -> None: result = await _init_flow(hass, source=SOURCE_SSDP, data=bad_data) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_id" @@ -691,7 +690,7 @@ async def test_ssdp_failure_bad_port_json(hass: HomeAssistant) -> None: result = await _configure_flow(hass, result) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_PORT] == const.DEFAULT_PORT_JSON @@ -716,7 +715,7 @@ async def test_ssdp_failure_bad_port_ui(hass: HomeAssistant) -> None: ): result = await _init_flow(hass, source=SOURCE_SSDP, data=bad_data) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "auth" client.async_request_token = AsyncMock(return_value=TEST_REQUEST_TOKEN_FAIL) @@ -725,7 +724,7 @@ async def test_ssdp_failure_bad_port_ui(hass: HomeAssistant) -> None: hass, result, user_input={CONF_CREATE_TOKEN: True} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "create_token" # Verify a working URL is used despite the bad port number @@ -749,8 +748,8 @@ async def test_ssdp_abort_duplicates(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result_1["type"] == data_entry_flow.FlowResultType.FORM - assert result_2["type"] == data_entry_flow.FlowResultType.ABORT + assert result_1["type"] is FlowResultType.FORM + assert result_2["type"] is FlowResultType.ABORT assert result_2["reason"] == "already_in_progress" @@ -768,7 +767,7 @@ async def test_options_priority(hass: HomeAssistant) -> None: assert hass.states.get(TEST_ENTITY_ID_1) is not None result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" new_priority = 1 @@ -777,7 +776,7 @@ async def test_options_priority(hass: HomeAssistant) -> None: user_input={CONF_PRIORITY: new_priority}, ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_PRIORITY] == new_priority # Turn the light on and ensure the new priority is used. @@ -810,14 +809,14 @@ async def test_options_effect_show_list(hass: HomeAssistant) -> None: await hass.async_block_till_done() result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.options.async_configure( result["flow_id"], user_input={CONF_EFFECT_SHOW_LIST: ["effect1", "effect3"]}, ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY # effect1 and effect3 only, so effect2 is hidden. assert result["data"][CONF_EFFECT_HIDE_LIST] == ["effect2"] @@ -838,7 +837,7 @@ async def test_options_effect_hide_list_cannot_connect(hass: HomeAssistant) -> N client.async_client_connect = AsyncMock(return_value=False) result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -867,13 +866,13 @@ async def test_reauth_success(hass: HomeAssistant) -> None: data=config_data, ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await _configure_flow( hass, result, user_input={CONF_CREATE_TOKEN: False, CONF_TOKEN: TEST_TOKEN} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert CONF_TOKEN in config_entry.data @@ -899,5 +898,5 @@ async def test_reauth_cannot_connect(hass: HomeAssistant) -> None: data=config_data, ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" diff --git a/tests/components/ialarm/test_config_flow.py b/tests/components/ialarm/test_config_flow.py index 816f03efa9e..d20200a1457 100644 --- a/tests/components/ialarm/test_config_flow.py +++ b/tests/components/ialarm/test_config_flow.py @@ -2,10 +2,11 @@ from unittest.mock import patch -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.ialarm.const import DOMAIN from homeassistant.const import CONF_HOST, CONF_PORT from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -20,7 +21,7 @@ async def test_form(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None with ( @@ -42,7 +43,7 @@ async def test_form(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == TEST_DATA["host"] assert result2["data"] == TEST_DATA assert len(mock_setup_entry.mock_calls) == 1 @@ -62,7 +63,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None: result["flow_id"], TEST_DATA ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -80,7 +81,7 @@ async def test_form_exception(hass: HomeAssistant) -> None: result["flow_id"], TEST_DATA ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} @@ -106,5 +107,5 @@ async def test_form_already_exists(hass: HomeAssistant) -> None: result["flow_id"], TEST_DATA ) - assert result2["type"] == data_entry_flow.FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" diff --git a/tests/components/ibeacon/test_config_flow.py b/tests/components/ibeacon/test_config_flow.py index 3a3e1d90d91..0833508d03f 100644 --- a/tests/components/ibeacon/test_config_flow.py +++ b/tests/components/ibeacon/test_config_flow.py @@ -18,7 +18,7 @@ async def test_setup_user_no_bluetooth( DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "bluetooth_not_available" @@ -28,13 +28,13 @@ async def test_setup_user(hass: HomeAssistant, enable_bluetooth: None) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with patch("homeassistant.components.ibeacon.async_setup_entry", return_value=True): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "iBeacon Tracker" assert result2["data"] == {} @@ -48,7 +48,7 @@ async def test_setup_user_already_setup( DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" @@ -62,7 +62,7 @@ async def test_options_flow(hass: HomeAssistant, enable_bluetooth: None) -> None result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" # test save invalid uuid @@ -72,7 +72,7 @@ async def test_options_flow(hass: HomeAssistant, enable_bluetooth: None) -> None "new_uuid": "invalid", }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" assert result["errors"] == {"new_uuid": "invalid_uuid_format"} @@ -84,13 +84,13 @@ async def test_options_flow(hass: HomeAssistant, enable_bluetooth: None) -> None "new_uuid": uuid, }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == {CONF_ALLOW_NAMELESS_UUIDS: [uuid]} # test save duplicate uuid result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -100,13 +100,13 @@ async def test_options_flow(hass: HomeAssistant, enable_bluetooth: None) -> None "new_uuid": uuid, }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == {CONF_ALLOW_NAMELESS_UUIDS: [uuid]} # delete result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -115,5 +115,5 @@ async def test_options_flow(hass: HomeAssistant, enable_bluetooth: None) -> None CONF_ALLOW_NAMELESS_UUIDS: [], }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == {CONF_ALLOW_NAMELESS_UUIDS: []} diff --git a/tests/components/icloud/test_config_flow.py b/tests/components/icloud/test_config_flow.py index f13a0e14595..ec8d11f1135 100644 --- a/tests/components/icloud/test_config_flow.py +++ b/tests/components/icloud/test_config_flow.py @@ -5,7 +5,6 @@ from unittest.mock import MagicMock, Mock, patch from pyicloud.exceptions import PyiCloudFailedLoginException import pytest -from homeassistant import data_entry_flow from homeassistant.components.icloud.config_flow import ( CONF_TRUSTED_DEVICE, CONF_VERIFICATION_CODE, @@ -22,6 +21,7 @@ from homeassistant.components.icloud.const import ( from homeassistant.config_entries import SOURCE_REAUTH, SOURCE_USER from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from .const import ( MOCK_CONFIG, @@ -159,7 +159,7 @@ async def test_user(hass: HomeAssistant, service: MagicMock) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=None ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" # test with required @@ -168,7 +168,7 @@ async def test_user(hass: HomeAssistant, service: MagicMock) -> None: context={"source": SOURCE_USER}, data={CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == CONF_TRUSTED_DEVICE @@ -186,7 +186,7 @@ async def test_user_with_cookie( CONF_WITH_FAMILY: WITH_FAMILY, }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["result"].unique_id == USERNAME assert result["title"] == USERNAME assert result["data"][CONF_USERNAME] == USERNAME @@ -207,7 +207,7 @@ async def test_login_failed(hass: HomeAssistant) -> None: context={"source": SOURCE_USER}, data={CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {CONF_PASSWORD: "invalid_auth"} @@ -220,7 +220,7 @@ async def test_no_device( context={"source": SOURCE_USER}, data={CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_device" @@ -233,7 +233,7 @@ async def test_trusted_device(hass: HomeAssistant, service: MagicMock) -> None: ) result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == CONF_TRUSTED_DEVICE @@ -248,7 +248,7 @@ async def test_trusted_device_success(hass: HomeAssistant, service: MagicMock) - result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_TRUSTED_DEVICE: 0} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == CONF_VERIFICATION_CODE @@ -265,7 +265,7 @@ async def test_send_verification_code_failed( result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_TRUSTED_DEVICE: 0} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == CONF_TRUSTED_DEVICE assert result["errors"] == {CONF_TRUSTED_DEVICE: "send_verification_code"} @@ -282,7 +282,7 @@ async def test_verification_code(hass: HomeAssistant, service: MagicMock) -> Non ) result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == CONF_VERIFICATION_CODE @@ -303,7 +303,7 @@ async def test_verification_code_success( result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_VERIFICATION_CODE: "0"} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["result"].unique_id == USERNAME assert result["title"] == USERNAME assert result["data"][CONF_USERNAME] == USERNAME @@ -329,7 +329,7 @@ async def test_validate_verification_code_failed( result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_VERIFICATION_CODE: "0"} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == CONF_TRUSTED_DEVICE assert result["errors"] == {"base": "validate_verification_code"} @@ -348,7 +348,7 @@ async def test_2fa_code_success(hass: HomeAssistant, service_2fa: MagicMock) -> result["flow_id"], {CONF_VERIFICATION_CODE: "0"} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["result"].unique_id == USERNAME assert result["title"] == USERNAME assert result["data"][CONF_USERNAME] == USERNAME @@ -372,7 +372,7 @@ async def test_validate_2fa_code_failed( result["flow_id"], {CONF_VERIFICATION_CODE: "0"} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == CONF_VERIFICATION_CODE assert result["errors"] == {"base": "validate_verification_code"} @@ -392,13 +392,13 @@ async def test_password_update( data={**MOCK_CONFIG}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_PASSWORD: PASSWORD_2} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert config_entry.data[CONF_PASSWORD] == PASSWORD_2 @@ -416,7 +416,7 @@ async def test_password_update_wrong_password(hass: HomeAssistant) -> None: data={**MOCK_CONFIG}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM with patch( "homeassistant.components.icloud.config_flow.PyiCloudService.authenticate", @@ -426,5 +426,5 @@ async def test_password_update_wrong_password(hass: HomeAssistant) -> None: result["flow_id"], {CONF_PASSWORD: PASSWORD_2} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {CONF_PASSWORD: "invalid_auth"} diff --git a/tests/components/idasen_desk/test_config_flow.py b/tests/components/idasen_desk/test_config_flow.py index 78eacfb6942..a861dc5f5e2 100644 --- a/tests/components/idasen_desk/test_config_flow.py +++ b/tests/components/idasen_desk/test_config_flow.py @@ -26,7 +26,7 @@ async def test_user_step_success(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -46,7 +46,7 @@ async def test_user_step_success(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == IDASEN_DISCOVERY_INFO.name assert result2["data"] == { CONF_ADDRESS: IDASEN_DISCOVERY_INFO.address, @@ -64,7 +64,7 @@ async def test_user_step_no_devices_found(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -85,7 +85,7 @@ async def test_user_step_no_new_devices_found(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -101,7 +101,7 @@ async def test_user_step_cannot_connect( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -120,7 +120,7 @@ async def test_user_step_cannot_connect( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "user" assert result2["errors"] == {"base": "cannot_connect"} @@ -140,7 +140,7 @@ async def test_user_step_cannot_connect( ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == IDASEN_DISCOVERY_INFO.name assert result3["data"] == { CONF_ADDRESS: IDASEN_DISCOVERY_INFO.address, @@ -158,7 +158,7 @@ async def test_user_step_auth_failed(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -177,7 +177,7 @@ async def test_user_step_auth_failed(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "user" assert result2["errors"] == {"base": "auth_failed"} @@ -197,7 +197,7 @@ async def test_user_step_auth_failed(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == IDASEN_DISCOVERY_INFO.name assert result3["data"] == { CONF_ADDRESS: IDASEN_DISCOVERY_INFO.address, @@ -215,7 +215,7 @@ async def test_user_step_unknown_exception(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -236,7 +236,7 @@ async def test_user_step_unknown_exception(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "user" assert result2["errors"] == {"base": "unknown"} @@ -260,7 +260,7 @@ async def test_user_step_unknown_exception(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == IDASEN_DISCOVERY_INFO.name assert result3["data"] == { CONF_ADDRESS: IDASEN_DISCOVERY_INFO.address, @@ -276,7 +276,7 @@ async def test_bluetooth_step_success(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=IDASEN_DISCOVERY_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -298,7 +298,7 @@ async def test_bluetooth_step_success(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == IDASEN_DISCOVERY_INFO.name assert result2["data"] == { CONF_ADDRESS: IDASEN_DISCOVERY_INFO.address, diff --git a/tests/components/imap/test_config_flow.py b/tests/components/imap/test_config_flow.py index 9d9edae5b14..2354c5fc9b9 100644 --- a/tests/components/imap/test_config_flow.py +++ b/tests/components/imap/test_config_flow.py @@ -7,7 +7,7 @@ from aioimaplib import AioImapException import pytest import voluptuous as vol -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.imap.const import ( CONF_CHARSET, CONF_FOLDER, @@ -44,7 +44,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None with patch( @@ -59,7 +59,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "email@email.com" assert result2["data"] == MOCK_CONFIG assert len(mock_setup_entry.mock_calls) == 1 @@ -73,7 +73,7 @@ async def test_entry_already_configured(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result2 = await hass.config_entries.flow.async_configure( result["flow_id"], @@ -89,7 +89,7 @@ async def test_entry_already_configured(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" @@ -107,7 +107,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None: result["flow_id"], MOCK_CONFIG ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == { CONF_USERNAME: "invalid_auth", CONF_PASSWORD: "invalid_auth", @@ -138,7 +138,7 @@ async def test_form_cannot_connect( result["flow_id"], MOCK_CONFIG ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": error} # make sure we do not lose the user input if somethings gets wrong @@ -165,7 +165,7 @@ async def test_form_invalid_charset(hass: HomeAssistant) -> None: result["flow_id"], MOCK_CONFIG ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {CONF_CHARSET: "invalid_charset"} @@ -183,7 +183,7 @@ async def test_form_invalid_folder(hass: HomeAssistant) -> None: result["flow_id"], MOCK_CONFIG ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {CONF_FOLDER: "invalid_folder"} @@ -201,7 +201,7 @@ async def test_form_invalid_search(hass: HomeAssistant) -> None: result["flow_id"], MOCK_CONFIG ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {CONF_SEARCH: "invalid_search"} @@ -222,7 +222,7 @@ async def test_reauth_success(hass: HomeAssistant, mock_setup_entry: AsyncMock) data=MOCK_CONFIG, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["description_placeholders"] == {CONF_USERNAME: "email@email.com"} @@ -241,7 +241,7 @@ async def test_reauth_success(hass: HomeAssistant, mock_setup_entry: AsyncMock) ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "reauth_successful" assert len(mock_setup_entry.mock_calls) == 1 @@ -263,7 +263,7 @@ async def test_reauth_failed(hass: HomeAssistant) -> None: data=MOCK_CONFIG, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" with patch( @@ -277,7 +277,7 @@ async def test_reauth_failed(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == { CONF_USERNAME: "invalid_auth", CONF_PASSWORD: "invalid_auth", @@ -301,7 +301,7 @@ async def test_reauth_failed_conn_error(hass: HomeAssistant) -> None: data=MOCK_CONFIG, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" with patch( @@ -315,7 +315,7 @@ async def test_reauth_failed_conn_error(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -328,7 +328,7 @@ async def test_options_form(hass: HomeAssistant) -> None: result = await hass.config_entries.options.async_init(entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" new_config = MOCK_OPTIONS.copy() @@ -344,7 +344,7 @@ async def test_options_form(hass: HomeAssistant) -> None: result["flow_id"], new_config ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {CONF_SEARCH: "invalid_search"} new_config["search"] = "UnSeen UnDeleted" @@ -358,7 +358,7 @@ async def test_options_form(hass: HomeAssistant) -> None: new_config, ) await hass.async_block_till_done() - assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["data"] == {} for key, value in new_config.items(): assert entry.data[key] == value @@ -381,7 +381,7 @@ async def test_key_options_in_options_form(hass: HomeAssistant) -> None: # so that it conflicts with that of entry1 result = await hass.config_entries.options.async_init(entry2.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" new_config = MOCK_OPTIONS.copy() @@ -395,26 +395,26 @@ async def test_key_options_in_options_form(hass: HomeAssistant) -> None: new_config, ) await hass.async_block_till_done() - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "already_configured"} @pytest.mark.parametrize( ("advanced_options", "assert_result"), [ - ({"max_message_size": 8192}, data_entry_flow.FlowResultType.CREATE_ENTRY), - ({"max_message_size": 1024}, data_entry_flow.FlowResultType.FORM), - ({"max_message_size": 65536}, data_entry_flow.FlowResultType.FORM), + ({"max_message_size": 8192}, FlowResultType.CREATE_ENTRY), + ({"max_message_size": 1024}, FlowResultType.FORM), + ({"max_message_size": 65536}, FlowResultType.FORM), ( {"custom_event_data_template": "{{ subject }}"}, - data_entry_flow.FlowResultType.CREATE_ENTRY, + FlowResultType.CREATE_ENTRY, ), ( {"custom_event_data_template": "{{ invalid_syntax"}, - data_entry_flow.FlowResultType.FORM, + FlowResultType.FORM, ), - ({"enable_push": True}, data_entry_flow.FlowResultType.CREATE_ENTRY), - ({"enable_push": False}, data_entry_flow.FlowResultType.CREATE_ENTRY), + ({"enable_push": True}, FlowResultType.CREATE_ENTRY), + ({"enable_push": False}, FlowResultType.CREATE_ENTRY), ], ids=[ "valid_message_size", @@ -429,7 +429,7 @@ async def test_key_options_in_options_form(hass: HomeAssistant) -> None: async def test_advanced_options_form( hass: HomeAssistant, advanced_options: dict[str, str], - assert_result: data_entry_flow.FlowResultType, + assert_result: FlowResultType, ) -> None: """Test we show the advanced options.""" @@ -442,7 +442,7 @@ async def test_advanced_options_form( context={"source": config_entries.SOURCE_USER, "show_advanced_options": True}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" new_config = MOCK_OPTIONS.copy() @@ -460,14 +460,14 @@ async def test_advanced_options_form( assert result2["type"] == assert_result if result2.get("errors") is not None: - assert assert_result == data_entry_flow.FlowResultType.FORM + assert assert_result is FlowResultType.FORM else: # Check if entry was updated for key, value in new_config.items(): assert entry.data[key] == value except vol.Invalid: # Check if form was expected with these options - assert assert_result == data_entry_flow.FlowResultType.FORM + assert assert_result is FlowResultType.FORM @pytest.mark.parametrize("cipher_list", ["python_default", "modern", "intermediate"]) @@ -483,7 +483,7 @@ async def test_config_flow_with_cipherlist_and_ssl_verify( DOMAIN, context={"source": config_entries.SOURCE_USER, "show_advanced_options": True}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None with patch( @@ -498,7 +498,7 @@ async def test_config_flow_with_cipherlist_and_ssl_verify( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "email@email.com" assert result2["data"] == config assert len(mock_setup_entry.mock_calls) == 1 @@ -515,7 +515,7 @@ async def test_config_flow_from_with_advanced_settings( DOMAIN, context={"source": config_entries.SOURCE_USER, "show_advanced_options": True}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None with patch( @@ -527,7 +527,7 @@ async def test_config_flow_from_with_advanced_settings( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"]["base"] == "cannot_connect" assert "ssl_cipher_list" in result2["data_schema"].schema @@ -544,7 +544,7 @@ async def test_config_flow_from_with_advanced_settings( ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == "email@email.com" assert result3["data"] == config assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/improv_ble/test_config_flow.py b/tests/components/improv_ble/test_config_flow.py index bafc32907ab..53da1f28425 100644 --- a/tests/components/improv_ble/test_config_flow.py +++ b/tests/components/improv_ble/test_config_flow.py @@ -44,7 +44,7 @@ async def test_user_step_success( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -62,7 +62,7 @@ async def test_user_step_success_authorize(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -83,7 +83,7 @@ async def test_user_step_no_devices_found(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -96,7 +96,7 @@ async def test_async_step_user_takes_precedence_over_discovery( context={"source": config_entries.SOURCE_BLUETOOTH}, data=IMPROV_BLE_DISCOVERY_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch( @@ -107,7 +107,7 @@ async def test_async_step_user_takes_precedence_over_discovery( DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM await _test_common_success_wo_identify( hass, result, IMPROV_BLE_DISCOVERY_INFO.address @@ -124,7 +124,7 @@ async def test_bluetooth_step_provisioned_device(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=PROVISIONED_IMPROV_BLE_DISCOVERY_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_provisioned" @@ -138,7 +138,7 @@ async def test_bluetooth_step_provisioned_device_2(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=IMPROV_BLE_DISCOVERY_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" assert len(hass.config_entries.flow.async_progress_by_handler("improv_ble")) == 1 @@ -156,7 +156,7 @@ async def test_bluetooth_step_success(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=IMPROV_BLE_DISCOVERY_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" assert result["errors"] is None @@ -172,7 +172,7 @@ async def test_bluetooth_step_success_identify(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=IMPROV_BLE_DISCOVERY_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" assert result["errors"] is None @@ -192,7 +192,7 @@ async def _test_common_success_with_identify( result["flow_id"], {CONF_ADDRESS: address}, ) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["menu_options"] == ["identify", "provision"] assert result["step_id"] == "main_menu" @@ -201,12 +201,12 @@ async def _test_common_success_with_identify( result["flow_id"], {"next_step_id": "identify"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "identify" assert result["errors"] is None result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["menu_options"] == ["identify", "provision"] assert result["step_id"] == "main_menu" @@ -214,7 +214,7 @@ async def _test_common_success_with_identify( result["flow_id"], {"next_step_id": "provision"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "provision" assert result["errors"] is None @@ -237,7 +237,7 @@ async def _test_common_success_wo_identify( result["flow_id"], {CONF_ADDRESS: address}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "provision" assert result["errors"] is None @@ -266,14 +266,14 @@ async def _test_common_success( result = await hass.config_entries.flow.async_configure( result["flow_id"], {"ssid": "MyWIFI", "password": "secret"} ) - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["progress_action"] == "provisioning" assert result["step_id"] == "do_provision" await hass.async_block_till_done() result = await hass.config_entries.flow.async_configure(result["flow_id"]) assert result.get("description_placeholders") == placeholders - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == abort_reason mock_provision.assert_awaited_once_with("MyWIFI", "secret", None) @@ -290,7 +290,7 @@ async def _test_common_success_wo_identify_w_authorize( result["flow_id"], {CONF_ADDRESS: address}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "provision" assert result["errors"] is None @@ -321,7 +321,7 @@ async def _test_common_success_w_authorize( result = await hass.config_entries.flow.async_configure( result["flow_id"], {"ssid": "MyWIFI", "password": "secret"} ) - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["progress_action"] == "authorize" assert result["step_id"] == "authorize" mock_subscribe_state_updates.assert_awaited_once() @@ -338,14 +338,14 @@ async def _test_common_success_w_authorize( ) as mock_provision, ): result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["progress_action"] == "provisioning" assert result["step_id"] == "do_provision" await hass.async_block_till_done() result = await hass.config_entries.flow.async_configure(result["flow_id"]) assert result["description_placeholders"] == {"url": "http://blabla.local"} - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "provision_successful_url" mock_provision.assert_awaited_once_with("MyWIFI", "secret", None) @@ -358,7 +358,7 @@ async def test_bluetooth_step_already_in_progress(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=IMPROV_BLE_DISCOVERY_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" result = await hass.config_entries.flow.async_init( @@ -366,7 +366,7 @@ async def test_bluetooth_step_already_in_progress(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=IMPROV_BLE_DISCOVERY_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_in_progress" @@ -385,12 +385,12 @@ async def test_can_identify_fails(hass: HomeAssistant, exc, error) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=IMPROV_BLE_DISCOVERY_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" assert result["errors"] is None result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" assert result["errors"] is None @@ -401,7 +401,7 @@ async def test_can_identify_fails(hass: HomeAssistant, exc, error) -> None: result["flow_id"], {CONF_ADDRESS: IMPROV_BLE_DISCOVERY_INFO.address}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == error @@ -420,12 +420,12 @@ async def test_identify_fails(hass: HomeAssistant, exc, error) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=IMPROV_BLE_DISCOVERY_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" assert result["errors"] is None result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" assert result["errors"] is None @@ -436,7 +436,7 @@ async def test_identify_fails(hass: HomeAssistant, exc, error) -> None: result["flow_id"], {CONF_ADDRESS: IMPROV_BLE_DISCOVERY_INFO.address}, ) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "main_menu" with patch(f"{IMPROV_BLE}.config_flow.ImprovBLEClient.identify", side_effect=exc): @@ -444,7 +444,7 @@ async def test_identify_fails(hass: HomeAssistant, exc, error) -> None: result["flow_id"], {"next_step_id": "identify"}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == error @@ -463,12 +463,12 @@ async def test_need_authorization_fails(hass: HomeAssistant, exc, error) -> None context={"source": config_entries.SOURCE_BLUETOOTH}, data=IMPROV_BLE_DISCOVERY_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" assert result["errors"] is None result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" assert result["errors"] is None @@ -479,7 +479,7 @@ async def test_need_authorization_fails(hass: HomeAssistant, exc, error) -> None result["flow_id"], {CONF_ADDRESS: IMPROV_BLE_DISCOVERY_INFO.address}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "provision" with patch( @@ -488,7 +488,7 @@ async def test_need_authorization_fails(hass: HomeAssistant, exc, error) -> None result = await hass.config_entries.flow.async_configure( result["flow_id"], {"ssid": "MyWIFI", "password": "secret"} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == error @@ -507,12 +507,12 @@ async def test_authorize_fails(hass: HomeAssistant, exc, error) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=IMPROV_BLE_DISCOVERY_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" assert result["errors"] is None result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" assert result["errors"] is None @@ -523,7 +523,7 @@ async def test_authorize_fails(hass: HomeAssistant, exc, error) -> None: result["flow_id"], {CONF_ADDRESS: IMPROV_BLE_DISCOVERY_INFO.address}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "provision" with ( @@ -539,7 +539,7 @@ async def test_authorize_fails(hass: HomeAssistant, exc, error) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], {"ssid": "MyWIFI", "password": "secret"} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == error @@ -550,12 +550,12 @@ async def _test_provision_error(hass: HomeAssistant, exc) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=IMPROV_BLE_DISCOVERY_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" assert result["errors"] is None result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" assert result["errors"] is None @@ -566,7 +566,7 @@ async def _test_provision_error(hass: HomeAssistant, exc) -> None: result["flow_id"], {CONF_ADDRESS: IMPROV_BLE_DISCOVERY_INFO.address}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "provision" with ( @@ -582,7 +582,7 @@ async def _test_provision_error(hass: HomeAssistant, exc) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], {"ssid": "MyWIFI", "password": "secret"} ) - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["progress_action"] == "provisioning" assert result["step_id"] == "do_provision" await hass.async_block_till_done() @@ -604,7 +604,7 @@ async def test_provision_fails(hass: HomeAssistant, exc, error) -> None: flow_id = await _test_provision_error(hass, exc) result = await hass.config_entries.flow.async_configure(flow_id) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == error @@ -627,7 +627,7 @@ async def test_provision_not_authorized(hass: HomeAssistant, exc, error) -> None ): flow_id = await _test_provision_error(hass, exc) result = await hass.config_entries.flow.async_configure(flow_id) - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["progress_action"] == "authorize" assert result["step_id"] == "authorize" @@ -646,6 +646,6 @@ async def test_provision_retry(hass: HomeAssistant, exc, error) -> None: flow_id = await _test_provision_error(hass, exc) result = await hass.config_entries.flow.async_configure(flow_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "provision" assert result["errors"] == {"base": error} diff --git a/tests/components/inkbird/test_config_flow.py b/tests/components/inkbird/test_config_flow.py index ffb25ebd093..154132c34fc 100644 --- a/tests/components/inkbird/test_config_flow.py +++ b/tests/components/inkbird/test_config_flow.py @@ -19,13 +19,13 @@ async def test_async_step_bluetooth_valid_device(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=IBBQ_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch("homeassistant.components.inkbird.async_setup_entry", return_value=True): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "iBBQ AC3D" assert result2["data"] == {} assert result2["result"].unique_id == "4125DDBA-2774-4851-9889-6AADDD4CAC3D" @@ -38,7 +38,7 @@ async def test_async_step_bluetooth_not_inkbird(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=NOT_INKBIRD_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_supported" @@ -48,7 +48,7 @@ async def test_async_step_user_no_devices_found(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -62,14 +62,14 @@ async def test_async_step_user_with_found_devices(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with patch("homeassistant.components.inkbird.async_setup_entry", return_value=True): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={"address": "61DE521B-F0BF-9F44-64D4-75BBE1738105"}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "IBS-TH 8105" assert result2["data"] == {} assert result2["result"].unique_id == "61DE521B-F0BF-9F44-64D4-75BBE1738105" @@ -85,7 +85,7 @@ async def test_async_step_user_device_added_between_steps(hass: HomeAssistant) - DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" entry = MockConfigEntry( @@ -99,7 +99,7 @@ async def test_async_step_user_device_added_between_steps(hass: HomeAssistant) - result["flow_id"], user_input={"address": "61DE521B-F0BF-9F44-64D4-75BBE1738105"}, ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" @@ -121,7 +121,7 @@ async def test_async_step_user_with_found_devices_already_setup( DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -138,7 +138,7 @@ async def test_async_step_bluetooth_devices_already_setup(hass: HomeAssistant) - context={"source": config_entries.SOURCE_BLUETOOTH}, data=SPS_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -149,7 +149,7 @@ async def test_async_step_bluetooth_already_in_progress(hass: HomeAssistant) -> context={"source": config_entries.SOURCE_BLUETOOTH}, data=SPS_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" result = await hass.config_entries.flow.async_init( @@ -157,7 +157,7 @@ async def test_async_step_bluetooth_already_in_progress(hass: HomeAssistant) -> context={"source": config_entries.SOURCE_BLUETOOTH}, data=SPS_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_in_progress" @@ -170,7 +170,7 @@ async def test_async_step_user_takes_precedence_over_discovery( context={"source": config_entries.SOURCE_BLUETOOTH}, data=SPS_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch( @@ -181,14 +181,14 @@ async def test_async_step_user_takes_precedence_over_discovery( DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM with patch("homeassistant.components.inkbird.async_setup_entry", return_value=True): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={"address": "61DE521B-F0BF-9F44-64D4-75BBE1738105"}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "IBS-TH 8105" assert result2["data"] == {} assert result2["result"].unique_id == "61DE521B-F0BF-9F44-64D4-75BBE1738105" diff --git a/tests/components/insteon/test_config_flow.py b/tests/components/insteon/test_config_flow.py index df7430bc254..35ebfb62b77 100644 --- a/tests/components/insteon/test_config_flow.py +++ b/tests/components/insteon/test_config_flow.py @@ -5,7 +5,7 @@ from unittest.mock import patch import pytest from voluptuous_serialize import convert -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components import dhcp, usb from homeassistant.components.insteon.config_flow import ( STEP_ADD_OVERRIDE, @@ -40,6 +40,7 @@ from homeassistant.const import ( CONF_USERNAME, ) from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from .const import ( MOCK_DEVICE, @@ -91,7 +92,7 @@ async def _init_form(hass, modem_type): result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.MENU + assert result["type"] is FlowResultType.MENU result2 = await hass.config_entries.flow.async_configure( result["flow_id"], @@ -142,7 +143,7 @@ async def test_fail_on_existing(hass: HomeAssistant) -> None: data={**MOCK_USER_INPUT_HUB_V2, CONF_HUB_VERSION: 2}, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" @@ -238,13 +239,13 @@ async def test_form_discovery_dhcp(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_DHCP}, data=discovery_info ) - assert result["type"] == data_entry_flow.FlowResultType.MENU + assert result["type"] is FlowResultType.MENU result2 = await hass.config_entries.flow.async_configure( result["flow_id"], {"next_step_id": STEP_HUB_V2}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM schema = convert(result2["data_schema"]) found_host = False for field in schema: @@ -298,7 +299,7 @@ async def _options_init_form(hass, entry_id, step): with patch(PATCH_ASYNC_SETUP_ENTRY, return_value=True): result = await hass.config_entries.options.async_init(entry_id) - assert result["type"] == data_entry_flow.FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "init" result2 = await hass.config_entries.options.async_configure( @@ -346,7 +347,7 @@ async def test_options_change_hub_config(hass: HomeAssistant) -> None: CONF_PASSWORD: "new password", } result, _ = await _options_form(hass, result["flow_id"], user_input) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == {} assert config_entry.data == {**user_input, CONF_HUB_VERSION: 2} @@ -375,7 +376,7 @@ async def test_options_change_hub_bad_config(hass: HomeAssistant) -> None: hass, result["flow_id"], user_input, mock_failed_connection ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"]["base"] == "cannot_connect" @@ -396,7 +397,7 @@ async def test_options_change_plm_config(hass: HomeAssistant) -> None: user_input = {CONF_DEVICE: "/dev/ttyUSB0"} result, _ = await _options_form(hass, result["flow_id"], user_input) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == {} assert config_entry.data == user_input @@ -420,9 +421,9 @@ async def test_options_change_plm_bad_config(hass: HomeAssistant) -> None: hass, result["flow_id"], user_input, mock_failed_connection ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"]["base"] == "cannot_connect" @@ -445,7 +446,7 @@ async def test_options_add_device_override(hass: HomeAssistant) -> None: } result, _ = await _options_form(hass, result["flow_id"], user_input) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert len(config_entry.options[CONF_OVERRIDE]) == 1 assert config_entry.options[CONF_OVERRIDE][0][CONF_ADDRESS] == "1A.2B.3C" assert config_entry.options[CONF_OVERRIDE][0][CONF_CAT] == 4 @@ -489,7 +490,7 @@ async def test_options_remove_device_override(hass: HomeAssistant) -> None: user_input = {CONF_ADDRESS: "1A.2B.3C"} result, _ = await _options_form(hass, result["flow_id"], user_input) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert len(config_entry.options[CONF_OVERRIDE]) == 1 @@ -521,7 +522,7 @@ async def test_options_remove_device_override_with_x10(hass: HomeAssistant) -> N user_input = {CONF_ADDRESS: "1A.2B.3C"} result, _ = await _options_form(hass, result["flow_id"], user_input) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert len(config_entry.options[CONF_OVERRIDE]) == 1 assert len(config_entry.options[CONF_X10]) == 1 @@ -546,7 +547,7 @@ async def test_options_add_x10_device(hass: HomeAssistant) -> None: } result2, _ = await _options_form(hass, result["flow_id"], user_input) - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert len(config_entry.options[CONF_X10]) == 1 assert config_entry.options[CONF_X10][0][CONF_HOUSECODE] == "c" assert config_entry.options[CONF_X10][0][CONF_UNITCODE] == 12 @@ -562,7 +563,7 @@ async def test_options_add_x10_device(hass: HomeAssistant) -> None: } result3, _ = await _options_form(hass, result["flow_id"], user_input) - assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert len(config_entry.options[CONF_X10]) == 2 assert config_entry.options[CONF_X10][1][CONF_HOUSECODE] == "d" assert config_entry.options[CONF_X10][1][CONF_UNITCODE] == 10 @@ -603,7 +604,7 @@ async def test_options_remove_x10_device(hass: HomeAssistant) -> None: user_input = {CONF_DEVICE: "Housecode: C, Unitcode: 4"} result, _ = await _options_form(hass, result["flow_id"], user_input) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert len(config_entry.options[CONF_X10]) == 1 @@ -638,7 +639,7 @@ async def test_options_remove_x10_device_with_override(hass: HomeAssistant) -> N user_input = {CONF_DEVICE: "Housecode: C, Unitcode: 4"} result, _ = await _options_form(hass, result["flow_id"], user_input) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert len(config_entry.options[CONF_X10]) == 1 assert len(config_entry.options[CONF_OVERRIDE]) == 1 @@ -663,7 +664,7 @@ async def test_options_override_bad_data(hass: HomeAssistant) -> None: } result, _ = await _options_form(hass, result["flow_id"], user_input) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "input_error"} @@ -681,7 +682,7 @@ async def test_discovery_via_usb(hass: HomeAssistant) -> None: "insteon", context={"source": config_entries.SOURCE_USB}, data=discovery_info ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm_usb" with patch(PATCH_CONNECTION), patch(PATCH_ASYNC_SETUP, return_value=True): @@ -690,7 +691,7 @@ async def test_discovery_via_usb(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["data"] == {"device": "/dev/ttyINSTEON"} @@ -714,5 +715,5 @@ async def test_discovery_via_usb_already_setup(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" diff --git a/tests/components/integration/test_config_flow.py b/tests/components/integration/test_config_flow.py index 4f811e98de2..179984f20f2 100644 --- a/tests/components/integration/test_config_flow.py +++ b/tests/components/integration/test_config_flow.py @@ -20,7 +20,7 @@ async def test_config_flow(hass: HomeAssistant, platform) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None with patch( @@ -39,7 +39,7 @@ async def test_config_flow(hass: HomeAssistant, platform) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "My integration" assert result["data"] == {} assert result["options"] == { @@ -96,7 +96,7 @@ async def test_options(hass: HomeAssistant, platform) -> None: await hass.async_block_till_done() result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" schema = result["data_schema"].schema assert get_suggested(schema, "round") == 1.0 @@ -107,7 +107,7 @@ async def test_options(hass: HomeAssistant, platform) -> None: "round": 2.0, }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "method": "left", "name": "My integration", diff --git a/tests/components/intellifire/test_config_flow.py b/tests/components/intellifire/test_config_flow.py index 7f6f509a3a3..6c5e082ba13 100644 --- a/tests/components/intellifire/test_config_flow.py +++ b/tests/components/intellifire/test_config_flow.py @@ -36,7 +36,7 @@ async def test_no_discovery( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} assert result["step_id"] == "manual_device_entry" @@ -48,7 +48,7 @@ async def test_no_discovery( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "api_config" result3 = await hass.config_entries.flow.async_configure( @@ -57,7 +57,7 @@ async def test_no_discovery( ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == "Fireplace 12345" assert result3["data"] == { CONF_HOST: "1.1.1.1", @@ -98,7 +98,7 @@ async def test_single_discovery( {CONF_USERNAME: "test", CONF_PASSWORD: "AROONIE"}, ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["errors"] == {"base": "iftapi_connect"} @@ -131,7 +131,7 @@ async def test_single_discovery_loign_error( {CONF_USERNAME: "test", CONF_PASSWORD: "AROONIE"}, ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["errors"] == {"base": "api_error"} @@ -195,14 +195,14 @@ async def test_multi_discovery_cannot_connect( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "pick_device" result2 = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_HOST: "192.168.1.33"} ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -217,7 +217,7 @@ async def test_form_cannot_connect_manual_entry( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "manual_device_entry" result2 = await hass.config_entries.flow.async_configure( @@ -227,7 +227,7 @@ async def test_form_cannot_connect_manual_entry( }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -262,7 +262,7 @@ async def test_picker_already_discovered( CONF_HOST: "192.168.1.4", }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert len(mock_setup_entry.mock_calls) == 0 @@ -299,7 +299,7 @@ async def test_reauth_flow( }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "api_config" result3 = await hass.config_entries.flow.async_configure( @@ -307,7 +307,7 @@ async def test_reauth_flow( {CONF_USERNAME: "test", CONF_PASSWORD: "AROONIE"}, ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert entry.data[CONF_PASSWORD] == "AROONIE" assert entry.data[CONF_USERNAME] == "test" @@ -327,10 +327,10 @@ async def test_dhcp_discovery_intellifire_device( hostname="zentrios-Test", ), ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "dhcp_confirm" result2 = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "dhcp_confirm" result3 = await hass.config_entries.flow.async_configure( result2["flow_id"], user_input={} diff --git a/tests/components/iotawatt/test_config_flow.py b/tests/components/iotawatt/test_config_flow.py index d4980ba978e..a14d833c044 100644 --- a/tests/components/iotawatt/test_config_flow.py +++ b/tests/components/iotawatt/test_config_flow.py @@ -16,7 +16,7 @@ async def test_form(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == config_entries.SOURCE_USER with ( @@ -38,7 +38,7 @@ async def test_form(hass: HomeAssistant) -> None: await hass.async_block_till_done() assert len(mock_setup_entry.mock_calls) == 1 - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["data"] == { "host": "1.1.1.1", } @@ -50,7 +50,7 @@ async def test_form_auth(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with patch( @@ -63,7 +63,7 @@ async def test_form_auth(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "auth" with patch( @@ -79,7 +79,7 @@ async def test_form_auth(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["step_id"] == "auth" assert result3["errors"] == {"base": "invalid_auth"} @@ -102,7 +102,7 @@ async def test_form_auth(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result4["type"] == FlowResultType.CREATE_ENTRY + assert result4["type"] is FlowResultType.CREATE_ENTRY assert len(mock_setup_entry.mock_calls) == 1 assert result4["data"] == { "host": "1.1.1.1", @@ -126,7 +126,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None: {"host": "1.1.1.1"}, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -145,5 +145,5 @@ async def test_form_setup_exception(hass: HomeAssistant) -> None: {"host": "1.1.1.1"}, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} diff --git a/tests/components/ipp/test_config_flow.py b/tests/components/ipp/test_config_flow.py index 1ea75ecf167..57e229a995b 100644 --- a/tests/components/ipp/test_config_flow.py +++ b/tests/components/ipp/test_config_flow.py @@ -40,7 +40,7 @@ async def test_show_user_form(hass: HomeAssistant) -> None: ) assert result["step_id"] == "user" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM async def test_show_zeroconf_form( @@ -56,7 +56,7 @@ async def test_show_zeroconf_form( ) assert result["step_id"] == "zeroconf_confirm" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["description_placeholders"] == {CONF_NAME: "EPSON XP-6000 Series"} @@ -75,7 +75,7 @@ async def test_connection_error( ) assert result["step_id"] == "user" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} @@ -93,7 +93,7 @@ async def test_zeroconf_connection_error( data=discovery_info, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -109,7 +109,7 @@ async def test_zeroconf_confirm_connection_error( DOMAIN, context={"source": SOURCE_ZEROCONF}, data=discovery_info ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -128,7 +128,7 @@ async def test_user_connection_upgrade_required( ) assert result["step_id"] == "user" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "connection_upgrade"} @@ -146,7 +146,7 @@ async def test_zeroconf_connection_upgrade_required( data=discovery_info, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "connection_upgrade" @@ -164,7 +164,7 @@ async def test_user_parse_error( data=user_input, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "parse_error" @@ -182,7 +182,7 @@ async def test_zeroconf_parse_error( data=discovery_info, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "parse_error" @@ -200,7 +200,7 @@ async def test_user_ipp_error( data=user_input, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "ipp_error" @@ -218,7 +218,7 @@ async def test_zeroconf_ipp_error( data=discovery_info, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "ipp_error" @@ -236,7 +236,7 @@ async def test_user_ipp_version_error( data=user_input, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "ipp_version_error" @@ -254,7 +254,7 @@ async def test_zeroconf_ipp_version_error( data=discovery_info, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "ipp_version_error" @@ -273,7 +273,7 @@ async def test_user_device_exists_abort( data=user_input, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -292,7 +292,7 @@ async def test_zeroconf_device_exists_abort( data=discovery_info, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -316,7 +316,7 @@ async def test_zeroconf_with_uuid_device_exists_abort( data=discovery_info, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -342,7 +342,7 @@ async def test_zeroconf_with_uuid_device_exists_abort_new_host( data=discovery_info, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert mock_config_entry.data[CONF_HOST] == "1.2.3.9" @@ -366,14 +366,14 @@ async def test_zeroconf_empty_unique_id( data=discovery_info, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_HOST: "192.168.1.31", CONF_BASE_PATH: "/ipp/print"}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "EPSON XP-6000 Series" assert result["data"] @@ -399,14 +399,14 @@ async def test_zeroconf_no_unique_id( data=discovery_info, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_HOST: "192.168.1.31", CONF_BASE_PATH: "/ipp/print"}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "EPSON XP-6000 Series" assert result["data"] @@ -428,14 +428,14 @@ async def test_full_user_flow_implementation( ) assert result["step_id"] == "user" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_HOST: "192.168.1.31", CONF_BASE_PATH: "/ipp/print"}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "192.168.1.31" assert result["data"] @@ -459,13 +459,13 @@ async def test_full_zeroconf_flow_implementation( ) assert result["step_id"] == "zeroconf_confirm" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "EPSON XP-6000 Series" assert result["data"] @@ -491,14 +491,14 @@ async def test_full_zeroconf_tls_flow_implementation( ) assert result["step_id"] == "zeroconf_confirm" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["description_placeholders"] == {CONF_NAME: "EPSON XP-6000 Series"} result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "EPSON XP-6000 Series" assert result["data"] @@ -535,14 +535,14 @@ async def test_zeroconf_empty_unique_id_uses_serial(hass: HomeAssistant) -> None data=discovery_info, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_HOST: "192.168.1.31", CONF_BASE_PATH: "/ipp/print"}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "EPSON XP-6000 Series" assert result["data"] diff --git a/tests/components/iqvia/test_config_flow.py b/tests/components/iqvia/test_config_flow.py index a75eed8ecd0..17c977a6b4c 100644 --- a/tests/components/iqvia/test_config_flow.py +++ b/tests/components/iqvia/test_config_flow.py @@ -1,9 +1,9 @@ """Define tests for the IQVIA config flow.""" -from homeassistant import data_entry_flow from homeassistant.components.iqvia import CONF_ZIP_CODE, DOMAIN from homeassistant.config_entries import SOURCE_USER from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType async def test_duplicate_error(hass: HomeAssistant, config, config_entry) -> None: @@ -11,7 +11,7 @@ async def test_duplicate_error(hass: HomeAssistant, config, config_entry) -> Non result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=config ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -20,7 +20,7 @@ async def test_invalid_zip_code(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data={CONF_ZIP_CODE: "bad"} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {CONF_ZIP_CODE: "invalid_zip_code"} @@ -29,7 +29,7 @@ async def test_show_form(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" @@ -38,6 +38,6 @@ async def test_step_user(hass: HomeAssistant, config, setup_iqvia) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=config ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "12345" assert result["data"] == {CONF_ZIP_CODE: "12345"} diff --git a/tests/components/islamic_prayer_times/test_config_flow.py b/tests/components/islamic_prayer_times/test_config_flow.py index 41a5c3df0ac..be8eca210d3 100644 --- a/tests/components/islamic_prayer_times/test_config_flow.py +++ b/tests/components/islamic_prayer_times/test_config_flow.py @@ -6,7 +6,7 @@ from prayer_times_calculator import InvalidResponseError import pytest from requests.exceptions import ConnectionError as ConnError -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components import islamic_prayer_times from homeassistant.components.islamic_prayer_times.const import ( CONF_CALC_METHOD, @@ -16,6 +16,7 @@ from homeassistant.components.islamic_prayer_times.const import ( DOMAIN, ) from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from . import MOCK_CONFIG, MOCK_USER_INPUT @@ -29,7 +30,7 @@ async def test_flow_works(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( islamic_prayer_times.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with patch( @@ -41,7 +42,7 @@ async def test_flow_works(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Home" @@ -59,7 +60,7 @@ async def test_flow_error( result = await hass.config_entries.flow.async_init( islamic_prayer_times.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with patch( @@ -71,7 +72,7 @@ async def test_flow_error( ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"]["base"] == error @@ -87,7 +88,7 @@ async def test_options(hass: HomeAssistant) -> None: result = await hass.config_entries.options.async_init(entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -99,7 +100,7 @@ async def test_options(hass: HomeAssistant) -> None: }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_CALC_METHOD] == "makkah" assert result["data"][CONF_LAT_ADJ_METHOD] == "one_seventh" assert result["data"][CONF_MIDNIGHT_MODE] == "standard" @@ -115,7 +116,7 @@ async def test_integration_already_configured(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( islamic_prayer_times.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" result = await hass.config_entries.flow.async_configure( @@ -123,5 +124,5 @@ async def test_integration_already_configured(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/iss/test_config_flow.py b/tests/components/iss/test_config_flow.py index 77a61eaa770..73261fbc2e7 100644 --- a/tests/components/iss/test_config_flow.py +++ b/tests/components/iss/test_config_flow.py @@ -2,11 +2,11 @@ from unittest.mock import patch -from homeassistant import data_entry_flow from homeassistant.components.iss.const import DOMAIN from homeassistant.config_entries import SOURCE_USER from homeassistant.const import CONF_SHOW_ON_MAP from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -18,7 +18,7 @@ async def test_create_entry(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER} ) - assert result.get("type") == data_entry_flow.FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "user" with patch("homeassistant.components.iss.async_setup_entry", return_value=True): @@ -27,7 +27,7 @@ async def test_create_entry(hass: HomeAssistant) -> None: {}, ) - assert result.get("type") == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result.get("type") is FlowResultType.CREATE_ENTRY assert result.get("result").data == {} @@ -43,7 +43,7 @@ async def test_integration_already_exists(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER}, data={} ) - assert result.get("type") == data_entry_flow.FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "single_instance_allowed" diff --git a/tests/components/isy994/test_config_flow.py b/tests/components/isy994/test_config_flow.py index b29b1dbc775..dc9c19e9e75 100644 --- a/tests/components/isy994/test_config_flow.py +++ b/tests/components/isy994/test_config_flow.py @@ -6,7 +6,7 @@ from unittest.mock import patch from pyisy import ISYConnectionError, ISYInvalidAuthError import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components import dhcp, ssdp from homeassistant.components.isy994.const import ( CONF_TLS_VER, @@ -17,6 +17,7 @@ from homeassistant.components.isy994.const import ( from homeassistant.config_entries import SOURCE_DHCP, SOURCE_IGNORE, SOURCE_SSDP from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -88,7 +89,7 @@ async def test_form(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with ( @@ -103,7 +104,7 @@ async def test_form(hass: HomeAssistant) -> None: MOCK_USER_INPUT, ) await hass.async_block_till_done() - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == f"{MOCK_DEVICE_NAME} ({MOCK_HOSTNAME})" assert result2["result"].unique_id == MOCK_UUID assert result2["data"] == MOCK_USER_INPUT @@ -126,7 +127,7 @@ async def test_form_invalid_host(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "invalid_host"} @@ -144,7 +145,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None: MOCK_USER_INPUT, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {CONF_PASSWORD: "invalid_auth"} @@ -162,7 +163,7 @@ async def test_form_unknown_exeption(hass: HomeAssistant) -> None: MOCK_USER_INPUT, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} @@ -180,7 +181,7 @@ async def test_form_isy_connection_error(hass: HomeAssistant) -> None: MOCK_USER_INPUT, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -200,7 +201,7 @@ async def test_form_isy_parse_response_error( MOCK_USER_INPUT, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert "ISY Could not parse response, poorly formatted XML." in caplog.text @@ -220,7 +221,7 @@ async def test_form_no_name_in_response(hass: HomeAssistant) -> None: MOCK_USER_INPUT, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -231,7 +232,7 @@ async def test_form_existing_config_entry(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with patch(PATCH_CONNECTION, return_value=MOCK_CONFIG_RESPONSE): @@ -239,7 +240,7 @@ async def test_form_existing_config_entry(hass: HomeAssistant) -> None: result["flow_id"], MOCK_USER_INPUT, ) - assert result2["type"] == data_entry_flow.FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT async def test_form_ssdp_already_configured(hass: HomeAssistant) -> None: @@ -264,7 +265,7 @@ async def test_form_ssdp_already_configured(hass: HomeAssistant) -> None: }, ), ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT async def test_form_ssdp(hass: HomeAssistant) -> None: @@ -283,7 +284,7 @@ async def test_form_ssdp(hass: HomeAssistant) -> None: }, ), ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -300,7 +301,7 @@ async def test_form_ssdp(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == f"{MOCK_DEVICE_NAME} ({MOCK_HOSTNAME})" assert result2["result"].unique_id == MOCK_UUID assert result2["data"] == MOCK_USER_INPUT @@ -333,7 +334,7 @@ async def test_form_ssdp_existing_entry(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert entry.data[CONF_HOST] == f"http://3.3.3.3:80{ISY_URL_POSTFIX}" @@ -364,7 +365,7 @@ async def test_form_ssdp_existing_entry_with_no_port(hass: HomeAssistant) -> Non ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert entry.data[CONF_HOST] == f"http://3.3.3.3:80/{ISY_URL_POSTFIX}" @@ -397,7 +398,7 @@ async def test_form_ssdp_existing_entry_with_alternate_port( ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert entry.data[CONF_HOST] == f"http://3.3.3.3:1443/{ISY_URL_POSTFIX}" @@ -428,7 +429,7 @@ async def test_form_ssdp_existing_entry_no_port_https(hass: HomeAssistant) -> No ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert entry.data[CONF_HOST] == f"https://3.3.3.3:443/{ISY_URL_POSTFIX}" @@ -445,7 +446,7 @@ async def test_form_dhcp(hass: HomeAssistant) -> None: macaddress=MOCK_MAC, ), ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -462,7 +463,7 @@ async def test_form_dhcp(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == f"{MOCK_DEVICE_NAME} ({MOCK_HOSTNAME})" assert result2["result"].unique_id == MOCK_UUID assert result2["data"] == MOCK_USER_INPUT @@ -481,7 +482,7 @@ async def test_form_dhcp_with_polisy(hass: HomeAssistant) -> None: macaddress=MOCK_POLISY_MAC, ), ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} assert ( @@ -502,7 +503,7 @@ async def test_form_dhcp_with_polisy(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == f"{MOCK_DEVICE_NAME} ({MOCK_HOSTNAME})" assert result2["result"].unique_id == MOCK_UUID assert result2["data"] == MOCK_IOX_USER_INPUT @@ -521,7 +522,7 @@ async def test_form_dhcp_with_eisy(hass: HomeAssistant) -> None: macaddress=MOCK_MAC, ), ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} assert ( @@ -542,7 +543,7 @@ async def test_form_dhcp_with_eisy(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == f"{MOCK_DEVICE_NAME} ({MOCK_HOSTNAME})" assert result2["result"].unique_id == MOCK_UUID assert result2["data"] == MOCK_IOX_USER_INPUT @@ -571,7 +572,7 @@ async def test_form_dhcp_existing_entry(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert entry.data[CONF_HOST] == f"http://1.2.3.4{ISY_URL_POSTFIX}" @@ -601,7 +602,7 @@ async def test_form_dhcp_existing_entry_preserves_port(hass: HomeAssistant) -> N ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert entry.data[CONF_HOST] == f"http://1.2.3.4:1443{ISY_URL_POSTFIX}" assert entry.data[CONF_USERNAME] == "bob" @@ -627,7 +628,7 @@ async def test_form_dhcp_existing_ignored_entry(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/izone/test_config_flow.py b/tests/components/izone/test_config_flow.py index 0988640d644..9f668e1ec62 100644 --- a/tests/components/izone/test_config_flow.py +++ b/tests/components/izone/test_config_flow.py @@ -4,9 +4,10 @@ from unittest.mock import Mock, patch import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.izone.const import DISPATCH_CONTROLLER_DISCOVERED, IZONE from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType @pytest.fixture @@ -46,10 +47,10 @@ async def test_not_found(hass: HomeAssistant, mock_disco) -> None: ) # Confirmation form - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT await hass.async_block_till_done() @@ -79,10 +80,10 @@ async def test_found(hass: HomeAssistant, mock_disco) -> None: ) # Confirmation form - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY await hass.async_block_till_done() diff --git a/tests/components/jellyfin/test_config_flow.py b/tests/components/jellyfin/test_config_flow.py index 23c530d7e4d..2256a3d5d89 100644 --- a/tests/components/jellyfin/test_config_flow.py +++ b/tests/components/jellyfin/test_config_flow.py @@ -4,10 +4,11 @@ from unittest.mock import MagicMock import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.jellyfin.const import CONF_CLIENT_DEVICE_ID, DOMAIN from homeassistant.const import CONF_PASSWORD, CONF_URL, CONF_USERNAME from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from . import async_load_json_fixture from .const import REAUTH_INPUT, TEST_PASSWORD, TEST_URL, TEST_USERNAME, USER_INPUT @@ -24,7 +25,7 @@ async def test_abort_if_existing_entry(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" @@ -225,7 +226,7 @@ async def test_reauth( data=USER_INPUT, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["errors"] == {} @@ -241,7 +242,7 @@ async def test_reauth( ) await hass.async_block_till_done() - assert result2["type"] == data_entry_flow.FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "reauth_successful" @@ -275,7 +276,7 @@ async def test_reauth_cannot_connect( data=USER_INPUT, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["errors"] == {} @@ -308,7 +309,7 @@ async def test_reauth_cannot_connect( result["flow_id"], user_input=REAUTH_INPUT, ) - assert result3["type"] == data_entry_flow.FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "reauth_successful" @@ -342,7 +343,7 @@ async def test_reauth_invalid( data=USER_INPUT, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["errors"] == {} @@ -369,7 +370,7 @@ async def test_reauth_invalid( result["flow_id"], user_input=REAUTH_INPUT, ) - assert result3["type"] == data_entry_flow.FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "reauth_successful" @@ -403,7 +404,7 @@ async def test_reauth_exception( data=USER_INPUT, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["errors"] == {} @@ -432,5 +433,5 @@ async def test_reauth_exception( result["flow_id"], user_input=REAUTH_INPUT, ) - assert result3["type"] == data_entry_flow.FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "reauth_successful" diff --git a/tests/components/justnimbus/test_config_flow.py b/tests/components/justnimbus/test_config_flow.py index b96b6c8aa5c..f66693a752c 100644 --- a/tests/components/justnimbus/test_config_flow.py +++ b/tests/components/justnimbus/test_config_flow.py @@ -5,7 +5,7 @@ from unittest.mock import patch from justnimbus.exceptions import InvalidClientID, JustNimbusError import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.justnimbus.const import DOMAIN from homeassistant.core import HomeAssistant from homeassistant.data_entry_flow import FlowResultType @@ -20,7 +20,7 @@ async def test_form(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None await _set_up_justnimbus(hass=hass, flow_id=result["flow_id"]) @@ -62,7 +62,7 @@ async def test_form_errors( user_input=FIXTURE_USER_INPUT, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == errors await _set_up_justnimbus(hass=hass, flow_id=result["flow_id"]) @@ -81,7 +81,7 @@ async def test_abort_already_configured(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("errors") is None result2 = await hass.config_entries.flow.async_configure( @@ -89,7 +89,7 @@ async def test_abort_already_configured(hass: HomeAssistant) -> None: user_input=FIXTURE_USER_INPUT, ) - assert result2.get("type") == FlowResultType.ABORT + assert result2.get("type") is FlowResultType.ABORT assert result2.get("reason") == "already_configured" @@ -108,7 +108,7 @@ async def _set_up_justnimbus(hass: HomeAssistant, flow_id: str) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "JustNimbus" assert result2["data"] == FIXTURE_USER_INPUT assert len(mock_setup_entry.mock_calls) == 1 @@ -134,7 +134,7 @@ async def test_reauth_flow(hass: HomeAssistant) -> None: data=FIXTURE_OLD_USER_INPUT, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with patch( @@ -147,6 +147,6 @@ async def test_reauth_flow(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == data_entry_flow.FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "reauth_successful" assert mock_config.data == FIXTURE_USER_INPUT diff --git a/tests/components/jvc_projector/test_config_flow.py b/tests/components/jvc_projector/test_config_flow.py index a35dcd1ca38..282411540a4 100644 --- a/tests/components/jvc_projector/test_config_flow.py +++ b/tests/components/jvc_projector/test_config_flow.py @@ -26,7 +26,7 @@ async def test_user_config_flow_success( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" result = await hass.config_entries.flow.async_configure( @@ -39,7 +39,7 @@ async def test_user_config_flow_success( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert "data" in result assert result["data"][CONF_HOST] == MOCK_HOST assert result["data"][CONF_PORT] == MOCK_PORT @@ -59,7 +59,7 @@ async def test_user_config_flow_bad_connect_errors( data={CONF_HOST: MOCK_HOST, CONF_PORT: MOCK_PORT, CONF_PASSWORD: MOCK_PASSWORD}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "cannot_connect"} @@ -73,7 +73,7 @@ async def test_user_config_flow_bad_connect_errors( data={CONF_HOST: MOCK_HOST, CONF_PORT: MOCK_PORT, CONF_PASSWORD: MOCK_PASSWORD}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert "data" in result assert result["data"][CONF_HOST] == MOCK_HOST assert result["data"][CONF_PORT] == MOCK_PORT @@ -90,7 +90,7 @@ async def test_user_config_flow_device_exists_abort( context={"source": SOURCE_USER}, data={CONF_HOST: MOCK_HOST, CONF_PORT: MOCK_PORT, CONF_PASSWORD: MOCK_PASSWORD}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -105,7 +105,7 @@ async def test_user_config_flow_bad_host_errors( data={CONF_HOST: "", CONF_PORT: MOCK_PORT, CONF_PASSWORD: MOCK_PASSWORD}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "invalid_host"} @@ -117,7 +117,7 @@ async def test_user_config_flow_bad_host_errors( data={CONF_HOST: MOCK_HOST, CONF_PORT: MOCK_PORT, CONF_PASSWORD: MOCK_PASSWORD}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert "data" in result assert result["data"][CONF_HOST] == MOCK_HOST assert result["data"][CONF_PORT] == MOCK_PORT @@ -137,7 +137,7 @@ async def test_user_config_flow_bad_auth_errors( data={CONF_HOST: MOCK_HOST, CONF_PORT: MOCK_PORT, CONF_PASSWORD: MOCK_PASSWORD}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "invalid_auth"} @@ -151,7 +151,7 @@ async def test_user_config_flow_bad_auth_errors( data={CONF_HOST: MOCK_HOST, CONF_PORT: MOCK_PORT, CONF_PASSWORD: MOCK_PASSWORD}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert "data" in result assert result["data"][CONF_HOST] == MOCK_HOST assert result["data"][CONF_PORT] == MOCK_PORT @@ -171,7 +171,7 @@ async def test_reauth_config_flow_success( }, data={CONF_HOST: MOCK_HOST, CONF_PORT: MOCK_PORT}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" result = await hass.config_entries.flow.async_configure( @@ -179,7 +179,7 @@ async def test_reauth_config_flow_success( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert mock_integration.data[CONF_HOST] == MOCK_HOST @@ -202,7 +202,7 @@ async def test_reauth_config_flow_auth_error( }, data={CONF_HOST: MOCK_HOST, CONF_PORT: MOCK_PORT}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" result = await hass.config_entries.flow.async_configure( @@ -210,7 +210,7 @@ async def test_reauth_config_flow_auth_error( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["errors"] == {"base": "invalid_auth"} @@ -226,7 +226,7 @@ async def test_reauth_config_flow_auth_error( }, data={CONF_HOST: MOCK_HOST, CONF_PORT: MOCK_PORT}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" result = await hass.config_entries.flow.async_configure( @@ -234,7 +234,7 @@ async def test_reauth_config_flow_auth_error( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert mock_integration.data[CONF_HOST] == MOCK_HOST @@ -257,7 +257,7 @@ async def test_reauth_config_flow_connect_error( }, data={CONF_HOST: MOCK_HOST, CONF_PORT: MOCK_PORT}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" result = await hass.config_entries.flow.async_configure( @@ -265,7 +265,7 @@ async def test_reauth_config_flow_connect_error( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["errors"] == {"base": "cannot_connect"} @@ -281,7 +281,7 @@ async def test_reauth_config_flow_connect_error( }, data={CONF_HOST: MOCK_HOST, CONF_PORT: MOCK_PORT}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" result = await hass.config_entries.flow.async_configure( @@ -289,7 +289,7 @@ async def test_reauth_config_flow_connect_error( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert mock_integration.data[CONF_HOST] == MOCK_HOST