diff --git a/tests/components/p1_monitor/test_config_flow.py b/tests/components/p1_monitor/test_config_flow.py index ec1af77a646..6f6c2c8f7ec 100644 --- a/tests/components/p1_monitor/test_config_flow.py +++ b/tests/components/p1_monitor/test_config_flow.py @@ -17,7 +17,7 @@ async def test_full_user_flow(hass: HomeAssistant) -> 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" with ( @@ -33,7 +33,7 @@ async def test_full_user_flow(hass: HomeAssistant) -> None: user_input={CONF_HOST: "example.com"}, ) - assert result2.get("type") == FlowResultType.CREATE_ENTRY + assert result2.get("type") is FlowResultType.CREATE_ENTRY assert result2.get("title") == "P1 Monitor" assert result2.get("data") == {CONF_HOST: "example.com"} @@ -53,5 +53,5 @@ async def test_api_error(hass: HomeAssistant) -> None: data={CONF_HOST: "example.com"}, ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("errors") == {"base": "cannot_connect"} diff --git a/tests/components/peco/test_config_flow.py b/tests/components/peco/test_config_flow.py index df178e125e1..112d160fa81 100644 --- a/tests/components/peco/test_config_flow.py +++ b/tests/components/peco/test_config_flow.py @@ -17,7 +17,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 assert result["step_id"] == "user" @@ -33,7 +33,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"] == "Philadelphia Outage Count" assert result2["data"] == { "county": "PHILADELPHIA", @@ -46,7 +46,7 @@ async def test_invalid_county(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 ( @@ -70,7 +70,7 @@ async def test_meter_value_error(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" result = await hass.config_entries.flow.async_configure( @@ -82,7 +82,7 @@ async def test_meter_value_error(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"phone_number": "invalid_phone_number"} @@ -92,7 +92,7 @@ async def test_incompatible_meter_error(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("peco.PecoOutageApi.meter_check", side_effect=IncompatibleMeterError()): @@ -105,7 +105,7 @@ async def test_incompatible_meter_error(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "incompatible_meter" @@ -114,7 +114,7 @@ async def test_unresponsive_meter_error(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("peco.PecoOutageApi.meter_check", side_effect=UnresponsiveMeterError()): @@ -127,7 +127,7 @@ async def test_unresponsive_meter_error(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"phone_number": "unresponsive_meter"} @@ -137,7 +137,7 @@ async def test_meter_http_error(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("peco.PecoOutageApi.meter_check", side_effect=HttpError): @@ -150,7 +150,7 @@ async def test_meter_http_error(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"phone_number": "http_error"} @@ -160,7 +160,7 @@ async def test_smart_meter(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("peco.PecoOutageApi.meter_check", return_value=True): @@ -173,7 +173,7 @@ async def test_smart_meter(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"] == "Philadelphia - 1234567890" assert result["data"]["phone_number"] == "1234567890" assert result["context"]["unique_id"] == "PHILADELPHIA-1234567890" diff --git a/tests/components/pegel_online/test_config_flow.py b/tests/components/pegel_online/test_config_flow.py index fedcba94616..45468917565 100644 --- a/tests/components/pegel_online/test_config_flow.py +++ b/tests/components/pegel_online/test_config_flow.py @@ -33,7 +33,7 @@ async def test_user(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" with ( @@ -48,13 +48,13 @@ async def test_user(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_USER_DATA_STEP1 ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "select_station" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_USER_DATA_STEP2 ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_STATION] == "70272185-xxxx-xxxx-xxxx-43bea330dcae" assert result["title"] == "DRESDEN ELBE" @@ -75,7 +75,7 @@ async def test_user_already_configured(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" with patch( @@ -85,13 +85,13 @@ async def test_user_already_configured(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_USER_DATA_STEP1 ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "select_station" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_USER_DATA_STEP2 ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -100,7 +100,7 @@ async def test_connection_error(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" with ( @@ -116,7 +116,7 @@ async def test_connection_error(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_USER_DATA_STEP1 ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"]["base"] == "cannot_connect" @@ -125,13 +125,13 @@ async def test_connection_error(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_USER_DATA_STEP1 ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "select_station" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_USER_DATA_STEP2 ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_STATION] == "70272185-xxxx-xxxx-xxxx-43bea330dcae" assert result["title"] == "DRESDEN ELBE" @@ -145,7 +145,7 @@ async def test_user_no_stations(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" with ( @@ -161,7 +161,7 @@ async def test_user_no_stations(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_USER_DATA_STEP1 ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"][CONF_RADIUS] == "no_stations" @@ -170,13 +170,13 @@ async def test_user_no_stations(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_USER_DATA_STEP1 ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "select_station" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_USER_DATA_STEP2 ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_STATION] == "70272185-xxxx-xxxx-xxxx-43bea330dcae" assert result["title"] == "DRESDEN ELBE" diff --git a/tests/components/permobil/test_config_flow.py b/tests/components/permobil/test_config_flow.py index 5968e247a95..ea39e678459 100644 --- a/tests/components/permobil/test_config_flow.py +++ b/tests/components/permobil/test_config_flow.py @@ -46,7 +46,7 @@ async def test_sucessful_config_flow(hass: HomeAssistant, my_permobil: Mock) -> data={CONF_EMAIL: MOCK_EMAIL}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "region" assert result["errors"] == {} @@ -56,7 +56,7 @@ async def test_sucessful_config_flow(hass: HomeAssistant, my_permobil: Mock) -> user_input={CONF_REGION: MOCK_REGION_NAME}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "email_code" assert result["errors"] == {} # request region code @@ -65,7 +65,7 @@ async def test_sucessful_config_flow(hass: HomeAssistant, my_permobil: Mock) -> user_input={CONF_CODE: MOCK_CODE}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == VALID_DATA @@ -89,7 +89,7 @@ async def test_config_flow_incorrect_code( data={CONF_EMAIL: MOCK_EMAIL}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "region" assert result["errors"] == {} @@ -99,7 +99,7 @@ async def test_config_flow_incorrect_code( user_input={CONF_REGION: MOCK_REGION_NAME}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "email_code" assert result["errors"] == {} @@ -109,7 +109,7 @@ async def test_config_flow_incorrect_code( result["flow_id"], user_input={CONF_CODE: MOCK_CODE}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "email_code" assert result["errors"]["base"] == "invalid_code" @@ -134,7 +134,7 @@ async def test_config_flow_unsigned_eula( data={CONF_EMAIL: MOCK_EMAIL}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "region" assert result["errors"] == {} @@ -144,7 +144,7 @@ async def test_config_flow_unsigned_eula( user_input={CONF_REGION: MOCK_REGION_NAME}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "email_code" assert result["errors"] == {} @@ -154,7 +154,7 @@ async def test_config_flow_unsigned_eula( result["flow_id"], user_input={CONF_CODE: MOCK_CODE}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "email_code" assert result["errors"]["base"] == "unsigned_eula" @@ -170,7 +170,7 @@ async def test_config_flow_unsigned_eula( ) # Now the method should not raise an exception, and you can proceed with your assertions - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == VALID_DATA @@ -195,7 +195,7 @@ async def test_config_flow_incorrect_region( data={CONF_EMAIL: MOCK_EMAIL}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "region" assert result["errors"] == {} @@ -206,7 +206,7 @@ async def test_config_flow_incorrect_region( user_input={CONF_REGION: MOCK_REGION_NAME}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "region" assert result["errors"]["base"] == "code_request_error" @@ -232,7 +232,7 @@ async def test_config_flow_region_request_error( data={CONF_EMAIL: MOCK_EMAIL}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "region" assert result["errors"]["base"] == "region_fetch_error" @@ -260,7 +260,7 @@ async def test_config_flow_invalid_email( data={CONF_EMAIL: INVALID_EMAIL}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == config_entries.SOURCE_USER assert result["errors"]["base"] == "invalid_email" @@ -289,7 +289,7 @@ async def test_config_flow_reauth_success( context={"source": "reauth", "entry_id": mock_entry.entry_id}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "email_code" assert result["errors"] == {} @@ -299,7 +299,7 @@ async def test_config_flow_reauth_success( user_input={CONF_CODE: reauth_code}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { CONF_EMAIL: MOCK_EMAIL, CONF_REGION: MOCK_URL, @@ -331,7 +331,7 @@ async def test_config_flow_reauth_fail_invalid_code( context={"source": "reauth", "entry_id": mock_entry.entry_id}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "email_code" assert result["errors"] == {} @@ -341,7 +341,7 @@ async def test_config_flow_reauth_fail_invalid_code( user_input={CONF_CODE: reauth_invalid_code}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "email_code" assert result["errors"]["base"] == "invalid_code" @@ -368,5 +368,5 @@ async def test_config_flow_reauth_fail_code_request( context={"source": "reauth", "entry_id": reauth_entry.entry_id}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "unknown" diff --git a/tests/components/philips_js/test_config_flow.py b/tests/components/philips_js/test_config_flow.py index 07f1f2be933..fdf4825b116 100644 --- a/tests/components/philips_js/test_config_flow.py +++ b/tests/components/philips_js/test_config_flow.py @@ -5,9 +5,10 @@ from unittest.mock import ANY from haphilipsjs import PairingFailure import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.philips_js.const import CONF_ALLOW_NOTIFY, DOMAIN from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from . import ( MOCK_CONFIG, @@ -78,7 +79,7 @@ async def test_reauth( data=mock_config_entry.data, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -88,7 +89,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" assert mock_config_entry.data == MOCK_CONFIG | {"system": mock_tv.system} assert len(mock_setup_entry.mock_calls) == 2 @@ -255,12 +256,12 @@ 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( result["flow_id"], user_input={CONF_ALLOW_NOTIFY: True} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == {CONF_ALLOW_NOTIFY: True} diff --git a/tests/components/pi_hole/test_config_flow.py b/tests/components/pi_hole/test_config_flow.py index 350b8b899d8..3b56305e0fc 100644 --- a/tests/components/pi_hole/test_config_flow.py +++ b/tests/components/pi_hole/test_config_flow.py @@ -32,7 +32,7 @@ async def test_flow_user_with_api_key(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -40,7 +40,7 @@ async def test_flow_user_with_api_key(hass: HomeAssistant) -> None: result["flow_id"], user_input=CONFIG_FLOW_USER, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "api_key" assert result["errors"] == {} @@ -48,7 +48,7 @@ async def test_flow_user_with_api_key(hass: HomeAssistant) -> None: result["flow_id"], user_input={CONF_API_KEY: "some_key"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "api_key" assert result["errors"] == {CONF_API_KEY: "invalid_auth"} @@ -57,7 +57,7 @@ async def test_flow_user_with_api_key(hass: HomeAssistant) -> None: result["flow_id"], user_input=CONFIG_FLOW_API_KEY, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == NAME assert result["data"] == CONFIG_ENTRY_WITH_API_KEY mock_setup.assert_called_once() @@ -68,7 +68,7 @@ async def test_flow_user_with_api_key(hass: HomeAssistant) -> None: context={"source": SOURCE_USER}, data=CONFIG_FLOW_USER, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -80,7 +80,7 @@ async def test_flow_user_without_api_key(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -88,7 +88,7 @@ async def test_flow_user_without_api_key(hass: HomeAssistant) -> None: result["flow_id"], user_input=CONFIG_FLOW_USER, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == NAME assert result["data"] == CONFIG_ENTRY_WITHOUT_API_KEY mock_setup.assert_called_once() @@ -101,7 +101,7 @@ async def test_flow_user_invalid(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=CONFIG_FLOW_USER ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "cannot_connect"} @@ -129,6 +129,6 @@ async def test_flow_reauth(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert entry.data[CONF_API_KEY] == "newkey" diff --git a/tests/components/picnic/test_config_flow.py b/tests/components/picnic/test_config_flow.py index ec103e9f3a3..694ca0df31f 100644 --- a/tests/components/picnic/test_config_flow.py +++ b/tests/components/picnic/test_config_flow.py @@ -6,10 +6,11 @@ import pytest from python_picnic_api.session import PicnicAuthError import requests -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.picnic.const import DOMAIN from homeassistant.const import CONF_ACCESS_TOKEN, CONF_COUNTRY_CODE from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -41,7 +42,7 @@ async def test_form(hass: HomeAssistant, picnic_api) -> 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" assert result["errors"] is None @@ -87,7 +88,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "invalid_auth"} @@ -110,7 +111,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -133,7 +134,7 @@ async def test_form_exception(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} @@ -160,7 +161,7 @@ async def test_form_already_configured(hass: HomeAssistant, picnic_api) -> None: ) await hass.async_block_till_done() - assert result_configure["type"] == data_entry_flow.FlowResultType.ABORT + assert result_configure["type"] is FlowResultType.ABORT assert result_configure["reason"] == "already_configured" @@ -179,7 +180,7 @@ async def test_step_reauth(hass: HomeAssistant, picnic_api) -> None: result_init = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_REAUTH}, data=conf ) - assert result_init["type"] == data_entry_flow.FlowResultType.FORM + assert result_init["type"] is FlowResultType.FORM assert result_init["step_id"] == "user" with patch( @@ -197,7 +198,7 @@ async def test_step_reauth(hass: HomeAssistant, picnic_api) -> None: await hass.async_block_till_done() # Check that the returned flow has type abort because of successful re-authentication - assert result_configure["type"] == data_entry_flow.FlowResultType.ABORT + assert result_configure["type"] is FlowResultType.ABORT assert result_configure["reason"] == "reauth_successful" assert len(hass.config_entries.async_entries()) == 1 @@ -219,7 +220,7 @@ async def test_step_reauth_failed(hass: HomeAssistant) -> None: result_init = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_REAUTH}, data=conf ) - assert result_init["type"] == data_entry_flow.FlowResultType.FORM + assert result_init["type"] is FlowResultType.FORM assert result_init["step_id"] == "user" with patch( @@ -258,7 +259,7 @@ async def test_step_reauth_different_account(hass: HomeAssistant, picnic_api) -> result_init = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_REAUTH}, data=conf ) - assert result_init["type"] == data_entry_flow.FlowResultType.FORM + assert result_init["type"] is FlowResultType.FORM assert result_init["step_id"] == "user" with patch( diff --git a/tests/components/ping/test_config_flow.py b/tests/components/ping/test_config_flow.py index 541bdca8b1e..1f55957410d 100644 --- a/tests/components/ping/test_config_flow.py +++ b/tests/components/ping/test_config_flow.py @@ -27,7 +27,7 @@ async def test_form(hass: HomeAssistant, host, expected_title) -> 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"], @@ -37,7 +37,7 @@ async def test_form(hass: HomeAssistant, host, expected_title) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == expected_title assert result["data"] == {} assert result["options"] == { @@ -69,7 +69,7 @@ async def test_options(hass: HomeAssistant, host, count, expected_title) -> 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" result = await hass.config_entries.options.async_configure( @@ -81,7 +81,7 @@ async def test_options(hass: HomeAssistant, host, count, expected_title) -> None ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "count": count, "host": "10.10.10.1", @@ -100,7 +100,7 @@ async def test_step_import(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"] == "test2" assert result["data"] == {CONF_IMPORTED_BY: "binary_sensor"} assert result["options"] == { @@ -117,7 +117,7 @@ async def test_step_import(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"] == "10.10.10.10" assert result["data"] == {CONF_IMPORTED_BY: "binary_sensor"} assert result["options"] == { diff --git a/tests/components/plaato/test_config_flow.py b/tests/components/plaato/test_config_flow.py index 7088b672f69..f87b2db7fef 100644 --- a/tests/components/plaato/test_config_flow.py +++ b/tests/components/plaato/test_config_flow.py @@ -5,7 +5,7 @@ from unittest.mock import patch from pyplaato.models.device import PlaatoDeviceType import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.plaato.const import ( CONF_DEVICE_NAME, CONF_DEVICE_TYPE, @@ -62,7 +62,7 @@ async def test_show_config_form_device_type_airlock(hass: HomeAssistant) -> None }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "api_method" assert result["data_schema"].schema.get(CONF_TOKEN) == str assert result["data_schema"].schema.get(CONF_USE_WEBHOOK) == bool @@ -76,7 +76,7 @@ async def test_show_config_form_device_type_keg(hass: HomeAssistant) -> None: data={CONF_DEVICE_TYPE: PlaatoDeviceType.Keg, CONF_DEVICE_NAME: "device_name"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "api_method" assert result["data_schema"].schema.get(CONF_TOKEN) == str assert result["data_schema"].schema.get(CONF_USE_WEBHOOK) is None @@ -91,7 +91,7 @@ async def test_show_config_form_validate_webhook( 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( @@ -102,7 +102,7 @@ async def test_show_config_form_validate_webhook( }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "api_method" assert await async_setup_component(hass, "cloud", {}) @@ -126,7 +126,7 @@ async def test_show_config_form_validate_webhook( }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "webhook" @@ -139,7 +139,7 @@ async def test_show_config_form_validate_webhook_not_connected( 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( @@ -150,7 +150,7 @@ async def test_show_config_form_validate_webhook_not_connected( }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "api_method" assert await async_setup_component(hass, "cloud", {}) @@ -174,7 +174,7 @@ async def test_show_config_form_validate_webhook_not_connected( }, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cloud_not_connected" @@ -193,7 +193,7 @@ async def test_show_config_form_validate_token(hass: HomeAssistant) -> None: }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "api_method" with patch("homeassistant.components.plaato.async_setup_entry", return_value=True): @@ -201,7 +201,7 @@ async def test_show_config_form_validate_token(hass: HomeAssistant) -> None: result["flow_id"], user_input={CONF_TOKEN: "valid_token"} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == PlaatoDeviceType.Keg.name assert result["data"] == { CONF_USE_WEBHOOK: False, @@ -228,7 +228,7 @@ async def test_show_config_form_no_cloud_webhook( }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "api_method" result = await hass.config_entries.flow.async_configure( @@ -239,7 +239,7 @@ async def test_show_config_form_no_cloud_webhook( }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "webhook" assert result["errors"] is None @@ -262,14 +262,14 @@ async def test_show_config_form_api_method_no_auth_token( }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "api_method" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_TOKEN: ""} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "api_method" assert len(result["errors"]) == 1 assert result["errors"]["base"] == "no_auth_token" @@ -287,14 +287,14 @@ async def test_show_config_form_api_method_no_auth_token( }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "api_method" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_TOKEN: ""} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "api_method" assert len(result["errors"]) == 1 assert result["errors"]["base"] == "no_api_method" @@ -318,7 +318,7 @@ async def test_options(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"] == "user" result = await hass.config_entries.options.async_configure( @@ -328,7 +328,7 @@ async def test_options(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_SCAN_INTERVAL] == 10 assert len(mock_setup_entry.mock_calls) == 1 @@ -352,7 +352,7 @@ async def test_options_webhook(hass: HomeAssistant, webhook_id) -> 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"] == "webhook" assert result["description_placeholders"] == {"webhook_url": ""} @@ -363,7 +363,7 @@ async def test_options_webhook(hass: HomeAssistant, webhook_id) -> 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_WEBHOOK_ID] == CONF_WEBHOOK_ID assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/plex/test_config_flow.py b/tests/components/plex/test_config_flow.py index 9cfcda1b29d..33e1b3637d8 100644 --- a/tests/components/plex/test_config_flow.py +++ b/tests/components/plex/test_config_flow.py @@ -56,7 +56,7 @@ async def test_bad_credentials( 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 ( @@ -69,14 +69,14 @@ async def test_bad_credentials( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.EXTERNAL_STEP_DONE + assert result["type"] is FlowResultType.EXTERNAL_STEP_DONE 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"] == "user" assert result["errors"][CONF_TOKEN] == "faulty_credentials" @@ -88,7 +88,7 @@ async def test_bad_hostname( 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 ( @@ -102,14 +102,14 @@ async def test_bad_hostname( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.EXTERNAL_STEP_DONE + assert result["type"] is FlowResultType.EXTERNAL_STEP_DONE 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"] == "user" assert result["errors"][CONF_HOST] == "not_found" @@ -121,7 +121,7 @@ async def test_unknown_exception( 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 ( @@ -132,13 +132,13 @@ async def test_unknown_exception( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.EXTERNAL_STEP_DONE + assert result["type"] is FlowResultType.EXTERNAL_STEP_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"] == "unknown" @@ -155,7 +155,7 @@ async def test_no_servers_found( 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 ( @@ -165,13 +165,13 @@ async def test_no_servers_found( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.EXTERNAL_STEP_DONE + assert result["type"] is FlowResultType.EXTERNAL_STEP_DONE 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"] == "user" assert result["errors"]["base"] == "no_servers" @@ -186,7 +186,7 @@ async def test_single_available_server( 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 ( @@ -196,13 +196,13 @@ async def test_single_available_server( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.EXTERNAL_STEP_DONE + assert result["type"] is FlowResultType.EXTERNAL_STEP_DONE 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"] == "https://1-2-3-4.123456789001234567890.plex.direct:32400" @@ -230,7 +230,7 @@ async def test_multiple_servers_with_selection( 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" requests_mock.get( @@ -244,13 +244,13 @@ async def test_multiple_servers_with_selection( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.EXTERNAL_STEP_DONE + assert result["type"] is FlowResultType.EXTERNAL_STEP_DONE 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"] == "select_server" result = await hass.config_entries.flow.async_configure( @@ -259,7 +259,7 @@ async def test_multiple_servers_with_selection( CONF_SERVER_IDENTIFIER: MOCK_SERVERS[0][CONF_SERVER_IDENTIFIER] }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert ( result["title"] == "https://1-2-3-4.123456789001234567890.plex.direct:32400" @@ -295,7 +295,7 @@ async def test_adding_last_unconfigured_server( 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" requests_mock.get( @@ -310,13 +310,13 @@ async def test_adding_last_unconfigured_server( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.EXTERNAL_STEP_DONE + assert result["type"] is FlowResultType.EXTERNAL_STEP_DONE 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"] == "https://1-2-3-4.123456789001234567890.plex.direct:32400" @@ -354,7 +354,7 @@ async def test_all_available_servers_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" requests_mock.get("https://plex.tv/api/v2/user", text=plextv_account) @@ -370,13 +370,13 @@ async def test_all_available_servers_configured( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.EXTERNAL_STEP_DONE + assert result["type"] is FlowResultType.EXTERNAL_STEP_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"] == "all_configured" @@ -388,7 +388,7 @@ async def test_option_flow(hass: HomeAssistant, entry, mock_plex_server) -> None result = await hass.config_entries.options.async_init( entry.entry_id, context={"source": "test"}, data=None ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "plex_mp_settings" result = await hass.config_entries.options.async_configure( @@ -399,7 +399,7 @@ async def test_option_flow(hass: HomeAssistant, entry, mock_plex_server) -> None CONF_MONITORED_USERS: list(mock_plex_server.accounts), }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { Platform.MEDIA_PLAYER: { CONF_USE_EPISODE_ART: True, @@ -422,7 +422,7 @@ async def test_missing_option_flow( result = await hass.config_entries.options.async_init( entry.entry_id, context={"source": "test"}, data=None ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "plex_mp_settings" result = await hass.config_entries.options.async_configure( @@ -433,7 +433,7 @@ async def test_missing_option_flow( CONF_MONITORED_USERS: list(mock_plex_server.accounts), }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { Platform.MEDIA_PLAYER: { CONF_USE_EPISODE_ART: True, @@ -470,7 +470,7 @@ async def test_option_flow_new_users_available( result = await hass.config_entries.options.async_init( entry.entry_id, context={"source": "test"}, data=None ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "plex_mp_settings" multiselect_defaults = result["data_schema"].schema["monitored_users"].options @@ -486,7 +486,7 @@ async def test_external_timed_out( 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 ( @@ -496,13 +496,13 @@ async def test_external_timed_out( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.EXTERNAL_STEP_DONE + assert result["type"] is FlowResultType.EXTERNAL_STEP_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"] == "token_request_timeout" @@ -515,7 +515,7 @@ async def test_callback_view( 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 ( @@ -525,7 +525,7 @@ async def test_callback_view( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP client = await hass_client_no_auth() forward_url = f'{config_flow.AUTH_CALLBACK_PATH}?flow_id={result["flow_id"]}' @@ -552,7 +552,7 @@ async def test_manual_config( config_flow.DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["data_schema"] is None hass.config_entries.flow.async_abort(result["flow_id"]) @@ -564,7 +564,7 @@ async def test_manual_config( ) assert result["data_schema"] is not None - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user_advanced" with patch("plexauth.PlexAuth.initiate_auth"): @@ -572,7 +572,7 @@ async def test_manual_config( result["flow_id"], user_input={"setup_method": AUTOMATIC_SETUP_STRING} ) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP hass.config_entries.flow.async_abort(result["flow_id"]) # Advanced manual @@ -582,14 +582,14 @@ async def test_manual_config( ) assert result["data_schema"] is not None - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user_advanced" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={"setup_method": MANUAL_SETUP_STRING} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "manual_setup" MANUAL_SERVER = { @@ -610,7 +610,7 @@ async def test_manual_config( result["flow_id"], user_input=MANUAL_SERVER_NO_HOST_OR_TOKEN ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "manual_setup" assert result["errors"]["base"] == "host_or_token" @@ -622,7 +622,7 @@ async def test_manual_config( result["flow_id"], user_input=MANUAL_SERVER ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "manual_setup" assert result["errors"]["base"] == "ssl_error" @@ -634,7 +634,7 @@ async def test_manual_config( result["flow_id"], user_input=MANUAL_SERVER ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "manual_setup" assert result["errors"]["base"] == "ssl_error" @@ -646,7 +646,7 @@ async def test_manual_config( result["flow_id"], user_input=MANUAL_SERVER ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "manual_setup" assert result["errors"]["base"] == "ssl_error" @@ -659,7 +659,7 @@ async def test_manual_config( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "http://1.2.3.4:32400" assert result["data"][CONF_SERVER] == "Plex Server 1" @@ -682,14 +682,14 @@ async def test_manual_config_with_token( context={"source": SOURCE_USER, "show_advanced_options": True}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user_advanced" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={"setup_method": MANUAL_SETUP_STRING} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "manual_setup" with ( @@ -700,7 +700,7 @@ async def test_manual_config_with_token( result["flow_id"], user_input={CONF_TOKEN: MOCK_TOKEN} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY mock_url = "https://1-2-3-4.123456789001234567890.plex.direct:32400" @@ -761,13 +761,13 @@ async def test_reauth( patch("plexauth.PlexAuth.token", return_value="BRAND_NEW_TOKEN"), ): result = await hass.config_entries.flow.async_configure(flow_id, user_input={}) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.EXTERNAL_STEP_DONE + assert result["type"] is FlowResultType.EXTERNAL_STEP_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"] == "reauth_successful" assert result["flow_id"] == flow_id @@ -813,13 +813,13 @@ async def test_reauth_multiple_servers_available( patch("plexauth.PlexAuth.token", return_value="BRAND_NEW_TOKEN"), ): result = await hass.config_entries.flow.async_configure(flow_id, user_input={}) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.EXTERNAL_STEP_DONE + assert result["type"] is FlowResultType.EXTERNAL_STEP_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["flow_id"] == flow_id assert result["reason"] == "reauth_successful" @@ -840,7 +840,7 @@ async def test_client_request_missing(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" with ( @@ -864,7 +864,7 @@ async def test_client_header_issues( 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 ( diff --git a/tests/components/plugwise/test_config_flow.py b/tests/components/plugwise/test_config_flow.py index 6e2f4e63d85..4b7c567baa8 100644 --- a/tests/components/plugwise/test_config_flow.py +++ b/tests/components/plugwise/test_config_flow.py @@ -120,7 +120,7 @@ async def test_form( result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_USER} ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("errors") == {} assert result.get("step_id") == "user" @@ -133,7 +133,7 @@ async def test_form( ) 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") == "Test Smile Name" assert result2.get("data") == { CONF_HOST: TEST_HOST, @@ -167,7 +167,7 @@ async def test_zeroconf_flow( context={CONF_SOURCE: SOURCE_ZEROCONF}, data=discovery, ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("errors") == {} assert result.get("step_id") == "user" @@ -177,7 +177,7 @@ async def test_zeroconf_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("title") == "Test Smile Name" assert result2.get("data") == { CONF_HOST: TEST_HOST, @@ -202,7 +202,7 @@ async def test_zeroconf_flow_stretch( context={CONF_SOURCE: SOURCE_ZEROCONF}, data=TEST_DISCOVERY2, ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("errors") == {} assert result.get("step_id") == "user" @@ -212,7 +212,7 @@ async def test_zeroconf_flow_stretch( ) 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") == "Test Smile Name" assert result2.get("data") == { CONF_HOST: TEST_HOST, @@ -253,7 +253,7 @@ async def test_zercoconf_discovery_update_configuration( context={CONF_SOURCE: SOURCE_ZEROCONF}, data=TEST_DISCOVERY, ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "already_configured" assert entry.data[CONF_HOST] == "0.0.0.0" @@ -264,7 +264,7 @@ async def test_zercoconf_discovery_update_configuration( data=TEST_DISCOVERY, ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "already_configured" assert entry.data[CONF_HOST] == "1.1.1.1" @@ -293,7 +293,7 @@ async def test_flow_errors( DOMAIN, context={CONF_SOURCE: SOURCE_USER}, ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("errors") == {} assert result.get("step_id") == "user" @@ -303,7 +303,7 @@ async def test_flow_errors( user_input={CONF_HOST: TEST_HOST, CONF_PASSWORD: TEST_PASSWORD}, ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("errors") == {"base": reason} assert result2.get("step_id") == "user" @@ -316,7 +316,7 @@ async def test_flow_errors( user_input={CONF_HOST: TEST_HOST, CONF_PASSWORD: TEST_PASSWORD}, ) - assert result3.get("type") == FlowResultType.CREATE_ENTRY + assert result3.get("type") is FlowResultType.CREATE_ENTRY assert result3.get("title") == "Test Smile Name" assert result3.get("data") == { CONF_HOST: TEST_HOST, @@ -341,7 +341,7 @@ async def test_zeroconf_abort_anna_with_existing_config_entries( context={CONF_SOURCE: SOURCE_ZEROCONF}, data=TEST_DISCOVERY_ANNA, ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "anna_with_adam" @@ -352,7 +352,7 @@ async def test_zeroconf_abort_anna_with_adam(hass: HomeAssistant) -> None: context={CONF_SOURCE: SOURCE_ZEROCONF}, data=TEST_DISCOVERY_ANNA, ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "user" flows_in_progress = hass.config_entries.flow.async_progress() @@ -366,7 +366,7 @@ async def test_zeroconf_abort_anna_with_adam(hass: HomeAssistant) -> None: data=TEST_DISCOVERY_ADAM, ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "user" flows_in_progress = hass.config_entries.flow.async_progress() @@ -379,7 +379,7 @@ async def test_zeroconf_abort_anna_with_adam(hass: HomeAssistant) -> None: context={CONF_SOURCE: SOURCE_ZEROCONF}, data=TEST_DISCOVERY_ANNA, ) - assert result3.get("type") == FlowResultType.ABORT + assert result3.get("type") is FlowResultType.ABORT assert result3.get("reason") == "anna_with_adam" # Adam should still be there diff --git a/tests/components/point/test_config_flow.py b/tests/components/point/test_config_flow.py index 67745251bf9..ec71b04b84b 100644 --- a/tests/components/point/test_config_flow.py +++ b/tests/components/point/test_config_flow.py @@ -4,10 +4,10 @@ from unittest.mock import AsyncMock, patch import pytest -from homeassistant import data_entry_flow from homeassistant.components.point import DOMAIN, config_flow from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType def init_config_flow(hass, side_effect=None): @@ -49,7 +49,7 @@ async def test_abort_if_no_implementation_registered(hass: HomeAssistant) -> Non 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"] == "no_flows" @@ -59,12 +59,12 @@ async def test_abort_if_already_setup(hass: HomeAssistant) -> None: with patch.object(hass.config_entries, "async_entries", return_value=[{}]): result = await flow.async_step_user() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_setup" with patch.object(hass.config_entries, "async_entries", return_value=[{}]): result = await flow.async_step_import() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_setup" @@ -74,18 +74,18 @@ async def test_full_flow_implementation(hass: HomeAssistant, mock_pypoint) -> No flow = init_config_flow(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" result = await flow.async_step_user({"flow_impl": "test"}) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "auth" assert result["description_placeholders"] == { "authorization_url": "https://example.com" } result = await flow.async_step_code("123ABC") - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"]["refresh_args"] == { CONF_CLIENT_ID: "id", CONF_CLIENT_SECRET: "secret", @@ -99,7 +99,7 @@ async def test_step_import(hass: HomeAssistant, mock_pypoint) -> None: flow = init_config_flow(hass) result = await flow.async_step_import() - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "auth" @@ -111,7 +111,7 @@ async def test_wrong_code_flow_implementation( flow = init_config_flow(hass) result = await flow.async_step_code("123ABC") - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "auth_error" @@ -120,7 +120,7 @@ async def test_not_pick_implementation_if_only_one(hass: HomeAssistant) -> None: flow = init_config_flow(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"] == "auth" @@ -129,7 +129,7 @@ async def test_abort_if_timeout_generating_auth_url(hass: HomeAssistant) -> None flow = init_config_flow(hass, side_effect=TimeoutError) result = await flow.async_step_user() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "authorize_url_timeout" @@ -138,7 +138,7 @@ async def test_abort_if_exception_generating_auth_url(hass: HomeAssistant) -> No flow = init_config_flow(hass, side_effect=ValueError) result = await flow.async_step_user() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "unknown_authorize_url_generation" @@ -147,5 +147,5 @@ async def test_abort_no_code(hass: HomeAssistant) -> None: flow = init_config_flow(hass) result = await flow.async_step_code() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_code" diff --git a/tests/components/poolsense/test_config_flow.py b/tests/components/poolsense/test_config_flow.py index 7a91e546a59..7fbb42ea106 100644 --- a/tests/components/poolsense/test_config_flow.py +++ b/tests/components/poolsense/test_config_flow.py @@ -2,11 +2,11 @@ from unittest.mock import patch -from homeassistant import data_entry_flow from homeassistant.components.poolsense.const import DOMAIN from homeassistant.config_entries import SOURCE_USER from homeassistant.const import CONF_EMAIL, CONF_PASSWORD from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType async def test_show_form(hass: HomeAssistant) -> None: @@ -15,7 +15,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" @@ -50,7 +50,7 @@ async def test_valid_credentials(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"] == "test-email" assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/powerwall/test_config_flow.py b/tests/components/powerwall/test_config_flow.py index 83156ffb170..207c9b32d2f 100644 --- a/tests/components/powerwall/test_config_flow.py +++ b/tests/components/powerwall/test_config_flow.py @@ -321,7 +321,7 @@ async def test_dhcp_discovery_cannot_connect(hass: HomeAssistant) -> None: hostname="00GGX", ), ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -399,7 +399,7 @@ async def test_dhcp_discovery_update_ip_address(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" assert entry.data[CONF_IP_ADDRESS] == "1.1.1.1" @@ -436,7 +436,7 @@ async def test_dhcp_discovery_does_not_update_ip_when_auth_fails( ), ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert entry.data[CONF_IP_ADDRESS] == "1.2.3.4" @@ -473,7 +473,7 @@ async def test_dhcp_discovery_does_not_update_ip_when_auth_successful( ), ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert entry.data[CONF_IP_ADDRESS] == "1.2.3.4" @@ -508,7 +508,7 @@ async def test_dhcp_discovery_updates_unique_id(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" assert entry.data[CONF_IP_ADDRESS] == "1.2.3.4" assert entry.unique_id == MOCK_GATEWAY_DIN @@ -547,7 +547,7 @@ async def test_dhcp_discovery_updates_unique_id_when_entry_is_failed( ), ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert entry.data[CONF_IP_ADDRESS] == "1.2.3.4" assert entry.unique_id == MOCK_GATEWAY_DIN @@ -586,7 +586,7 @@ async def test_discovered_wifi_does_not_update_ip_if_is_still_online( ), ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert entry.data[CONF_IP_ADDRESS] == "1.2.3.4" @@ -635,6 +635,6 @@ async def test_discovered_wifi_does_not_update_ip_online_but_access_denied( ), ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert entry.data[CONF_IP_ADDRESS] == "1.2.3.4" diff --git a/tests/components/private_ble_device/test_config_flow.py b/tests/components/private_ble_device/test_config_flow.py index 2acb89240a1..64a3c9c1d2e 100644 --- a/tests/components/private_ble_device/test_config_flow.py +++ b/tests/components/private_ble_device/test_config_flow.py @@ -26,7 +26,7 @@ async def test_setup_user_no_bluetooth( const.DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "bluetooth_not_available" @@ -114,7 +114,7 @@ async def test_flow_works(hass: HomeAssistant, enable_bluetooth: None) -> None: user_input={"irk": "irk:00000000000000000000000000000000"}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Test Test Test" assert result["data"] == {"irk": "00000000000000000000000000000000"} assert result["result"].unique_id == "00000000000000000000000000000000" @@ -153,7 +153,7 @@ async def test_flow_works_by_base64( user_input={"irk": "AAAAAAAAAAAAAAAAAAAAAA=="}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Test Test Test" assert result["data"] == {"irk": "00000000000000000000000000000000"} assert result["result"].unique_id == "00000000000000000000000000000000" diff --git a/tests/components/progettihwsw/test_config_flow.py b/tests/components/progettihwsw/test_config_flow.py index 7774adb5208..8dcc6917346 100644 --- a/tests/components/progettihwsw/test_config_flow.py +++ b/tests/components/progettihwsw/test_config_flow.py @@ -24,7 +24,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"] == "user" assert result["errors"] == {} @@ -41,7 +41,7 @@ async def test_form(hass: HomeAssistant) -> None: {CONF_HOST: "", CONF_PORT: 80}, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "relay_modes" assert result2["errors"] == {} @@ -54,7 +54,7 @@ async def test_form(hass: HomeAssistant) -> None: mock_value_step_rm, ) - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["data"] assert result3["data"]["title"] == "1R & 1IN Board" assert result3["data"]["is_old"] is False @@ -78,7 +78,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None: {CONF_HOST: "", CONF_PORT: 80}, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "user" assert result2["errors"] == {"base": "cannot_connect"} @@ -105,7 +105,7 @@ async def test_form_existing_entry_exception(hass: HomeAssistant) -> None: {CONF_HOST: "", CONF_PORT: 80}, ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" @@ -126,6 +126,6 @@ async def test_form_user_exception(hass: HomeAssistant) -> None: {CONF_HOST: "", CONF_PORT: 80}, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "user" assert result2["errors"] == {"base": "unknown"} diff --git a/tests/components/prosegur/test_config_flow.py b/tests/components/prosegur/test_config_flow.py index 3c3c2468696..cd44c899824 100644 --- a/tests/components/prosegur/test_config_flow.py +++ b/tests/components/prosegur/test_config_flow.py @@ -153,7 +153,7 @@ async def test_reauth_flow(hass: HomeAssistant, mock_list_contracts) -> None: data=entry.data, ) assert result["step_id"] == "reauth_confirm" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with ( @@ -175,7 +175,7 @@ async def test_reauth_flow(hass: HomeAssistant, mock_list_contracts) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "reauth_successful" assert entry.data == { "country": "PT", @@ -231,5 +231,5 @@ async def test_reauth_flow_error(hass: HomeAssistant, exception, base_error) -> ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"]["base"] == base_error diff --git a/tests/components/proximity/test_config_flow.py b/tests/components/proximity/test_config_flow.py index 1841c10873c..3ed9f5cba27 100644 --- a/tests/components/proximity/test_config_flow.py +++ b/tests/components/proximity/test_config_flow.py @@ -56,7 +56,7 @@ async def test_user_flow( 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( @@ -66,7 +66,7 @@ async def test_user_flow( result["flow_id"], user_input=user_input, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == expected_result zone = hass.states.get(user_input[CONF_ZONE]) @@ -101,7 +101,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: assert mock_setup_entry.called result = await hass.config_entries.options.async_init(mock_config.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"], @@ -111,7 +111,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: CONF_TOLERANCE: 1, }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert mock_config.data == { CONF_ZONE: "zone.home", CONF_TRACKED_ENTITIES: ["device_tracker.test2"], @@ -138,7 +138,7 @@ async def test_import_flow(hass: HomeAssistant) -> None: }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { CONF_NAME: "home", CONF_ZONE: "zone.home", @@ -182,7 +182,7 @@ async def test_abort_duplicated_entry(hass: HomeAssistant) -> None: result["flow_id"], user_input=DATA, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" await hass.async_block_till_done() @@ -229,7 +229,7 @@ async def test_avoid_duplicated_title(hass: HomeAssistant) -> None: CONF_TOLERANCE: 10, }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "home 2" await hass.async_block_till_done() @@ -246,7 +246,7 @@ async def test_avoid_duplicated_title(hass: HomeAssistant) -> None: CONF_TOLERANCE: 10, }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "home 4" await hass.async_block_till_done() diff --git a/tests/components/prusalink/test_config_flow.py b/tests/components/prusalink/test_config_flow.py index e7db5b54dac..cc66d25b35d 100644 --- a/tests/components/prusalink/test_config_flow.py +++ b/tests/components/prusalink/test_config_flow.py @@ -14,7 +14,7 @@ async def test_form(hass: HomeAssistant, mock_version_api) -> 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( @@ -31,7 +31,7 @@ async def test_form(hass: HomeAssistant, mock_version_api) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "PrusaXL" assert result2["data"] == { "host": "http://1.1.1.1", @@ -65,7 +65,7 @@ async def test_form_mk3(hass: HomeAssistant, mock_version_api) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert len(mock_setup_entry.mock_calls) == 1 @@ -88,7 +88,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "invalid_auth"} @@ -111,7 +111,7 @@ async def test_form_unknown(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} @@ -132,7 +132,7 @@ async def test_form_too_low_version(hass: HomeAssistant, mock_version_api) -> No }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "not_supported"} @@ -153,7 +153,7 @@ async def test_form_invalid_version_2(hass: HomeAssistant, mock_version_api) -> }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "not_supported"} @@ -178,7 +178,7 @@ async def test_form_invalid_mk3_server_version( }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "not_supported"} @@ -201,5 +201,5 @@ 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"} diff --git a/tests/components/ps4/test_config_flow.py b/tests/components/ps4/test_config_flow.py index db478903d1e..4e0505a8644 100644 --- a/tests/components/ps4/test_config_flow.py +++ b/tests/components/ps4/test_config_flow.py @@ -5,7 +5,7 @@ from unittest.mock import patch from pyps4_2ndscreen.errors import CredentialTimeout import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components import ps4 from homeassistant.components.ps4.config_flow import LOCAL_UDP_PORT from homeassistant.components.ps4.const import ( @@ -23,6 +23,7 @@ from homeassistant.const import ( CONF_TOKEN, ) from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from homeassistant.util import location from tests.common import MockConfigEntry @@ -105,7 +106,7 @@ async def test_full_flow_implementation(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"] == "creds" # Step Creds results with form in Step Mode. @@ -113,7 +114,7 @@ async def test_full_flow_implementation(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"] == "mode" # Step Mode with User Input which is not manual, results in Step Link. @@ -123,7 +124,7 @@ async def test_full_flow_implementation(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_AUTO ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "link" # User Input results in created entry. @@ -136,7 +137,7 @@ async def test_full_flow_implementation(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_CONFIG ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_TOKEN] == MOCK_CREDS assert result["data"]["devices"] == [MOCK_DEVICE] assert result["title"] == MOCK_TITLE @@ -149,7 +150,7 @@ async def test_multiple_flow_implementation(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"] == "creds" # Step Creds results with form in Step Mode. @@ -157,7 +158,7 @@ async def test_multiple_flow_implementation(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"] == "mode" # Step Mode with User Input which is not manual, results in Step Link. @@ -168,7 +169,7 @@ async def test_multiple_flow_implementation(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_AUTO ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "link" # User Input results in created entry. @@ -182,7 +183,7 @@ async def test_multiple_flow_implementation(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_CONFIG ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_TOKEN] == MOCK_CREDS assert result["data"]["devices"] == [MOCK_DEVICE] assert result["title"] == MOCK_TITLE @@ -207,7 +208,7 @@ async def test_multiple_flow_implementation(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"] == "creds" # Step Creds results with form in Step Mode. @@ -215,7 +216,7 @@ async def test_multiple_flow_implementation(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"] == "mode" # Step Mode with User Input which is not manual, results in Step Link. @@ -226,7 +227,7 @@ async def test_multiple_flow_implementation(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_AUTO ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "link" # Step Link @@ -240,7 +241,7 @@ async def test_multiple_flow_implementation(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_CONFIG_ADDITIONAL ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_TOKEN] == MOCK_CREDS assert len(result["data"]["devices"]) == 1 assert result["title"] == MOCK_TITLE @@ -263,7 +264,7 @@ async def test_port_bind_abort(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"] == reason with patch("pyps4_2ndscreen.Helper.port_bind", return_value=MOCK_TCP_PORT): @@ -271,7 +272,7 @@ async def test_port_bind_abort(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"] == reason @@ -283,14 +284,14 @@ async def test_duplicate_abort(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"] == "creds" with patch("pyps4_2ndscreen.Helper.get_creds", return_value=MOCK_CREDS): 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"] == "mode" with patch( @@ -299,7 +300,7 @@ async def test_duplicate_abort(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_AUTO ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -313,14 +314,14 @@ async def test_additional_device(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"] == "creds" with patch("pyps4_2ndscreen.Helper.get_creds", return_value=MOCK_CREDS): 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"] == "mode" with patch( @@ -336,7 +337,7 @@ async def test_additional_device(hass: HomeAssistant) -> None: result["flow_id"], user_input=MOCK_CONFIG_ADDITIONAL ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_TOKEN] == MOCK_CREDS assert len(result["data"]["devices"]) == 1 assert result["title"] == MOCK_TITLE @@ -350,7 +351,7 @@ async def test_0_pin(hass: HomeAssistant) -> None: context={"source": "creds"}, data={}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "mode" with ( @@ -365,7 +366,7 @@ async def test_0_pin(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], MOCK_AUTO ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "link" mock_config = MOCK_CONFIG @@ -390,14 +391,14 @@ async def test_no_devices_found_abort(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"] == "creds" with patch("pyps4_2ndscreen.Helper.get_creds", return_value=MOCK_CREDS): 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"] == "mode" with patch("pyps4_2ndscreen.Helper.has_devices", return_value=[]): @@ -405,7 +406,7 @@ async def test_no_devices_found_abort(hass: HomeAssistant) -> None: result["flow_id"], user_input=MOCK_AUTO ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -415,14 +416,14 @@ async def test_manual_mode(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"] == "creds" with patch("pyps4_2ndscreen.Helper.get_creds", return_value=MOCK_CREDS): 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"] == "mode" # Step Mode with User Input: manual, results in Step Link. @@ -433,7 +434,7 @@ async def test_manual_mode(hass: HomeAssistant) -> None: result["flow_id"], user_input=MOCK_MANUAL ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "link" @@ -443,7 +444,7 @@ async def test_credential_abort(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"] == "creds" with patch("pyps4_2ndscreen.Helper.get_creds", return_value=None): @@ -451,7 +452,7 @@ async def test_credential_abort(hass: HomeAssistant) -> None: result["flow_id"], user_input={} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "credential_error" @@ -461,7 +462,7 @@ async def test_credential_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["step_id"] == "creds" with patch("pyps4_2ndscreen.Helper.get_creds", side_effect=CredentialTimeout): @@ -469,7 +470,7 @@ async def test_credential_timeout(hass: HomeAssistant) -> None: result["flow_id"], user_input={} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "creds" assert result["errors"] == {"base": "credential_timeout"} @@ -480,14 +481,14 @@ async def test_wrong_pin_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["step_id"] == "creds" with patch("pyps4_2ndscreen.Helper.get_creds", return_value=MOCK_CREDS): 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"] == "mode" with patch( @@ -501,7 +502,7 @@ async def test_wrong_pin_error(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_CONFIG ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "link" assert result["errors"] == {"base": "login_failed"} @@ -512,14 +513,14 @@ async def test_device_connection_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["step_id"] == "creds" with patch("pyps4_2ndscreen.Helper.get_creds", return_value=MOCK_CREDS): 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"] == "mode" with patch( @@ -533,7 +534,7 @@ async def test_device_connection_error(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_CONFIG ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "link" assert result["errors"] == {"base": "cannot_connect"} @@ -544,20 +545,20 @@ async def test_manual_mode_no_ip_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["step_id"] == "creds" with patch("pyps4_2ndscreen.Helper.get_creds", return_value=MOCK_CREDS): 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"] == "mode" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={"Config Mode": "Manual Entry"} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "mode" assert result["errors"] == {CONF_IP_ADDRESS: "no_ipaddress"} diff --git a/tests/components/pure_energie/test_config_flow.py b/tests/components/pure_energie/test_config_flow.py index 596853800aa..4305dab2236 100644 --- a/tests/components/pure_energie/test_config_flow.py +++ b/tests/components/pure_energie/test_config_flow.py @@ -25,14 +25,14 @@ async def test_full_user_flow_implementation( ) assert result.get("step_id") == "user" - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_HOST: "192.168.1.123"} ) assert result.get("title") == "Pure Energie Meter" - assert result.get("type") == FlowResultType.CREATE_ENTRY + assert result.get("type") is FlowResultType.CREATE_ENTRY assert "data" in result assert result["data"][CONF_HOST] == "192.168.1.123" assert "result" in result @@ -64,14 +64,14 @@ async def test_full_zeroconf_flow_implementationn( CONF_NAME: "Pure Energie Meter", } assert result.get("step_id") == "zeroconf_confirm" - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM result2 = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) assert result2.get("title") == "Pure Energie Meter" - assert result2.get("type") == FlowResultType.CREATE_ENTRY + assert result2.get("type") is FlowResultType.CREATE_ENTRY assert "data" in result2 assert result2["data"][CONF_HOST] == "192.168.1.123" @@ -90,7 +90,7 @@ async def test_connection_error( data={CONF_HOST: "example.com"}, ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "user" assert result.get("errors") == {"base": "cannot_connect"} @@ -115,5 +115,5 @@ async def test_zeroconf_connection_error( ), ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "cannot_connect" diff --git a/tests/components/purpleair/test_config_flow.py b/tests/components/purpleair/test_config_flow.py index efd0db6fd37..fbfc20fc632 100644 --- a/tests/components/purpleair/test_config_flow.py +++ b/tests/components/purpleair/test_config_flow.py @@ -5,10 +5,10 @@ from unittest.mock import AsyncMock, patch from aiopurpleair.errors import InvalidApiKeyError, PurpleAirError import pytest -from homeassistant import data_entry_flow from homeassistant.components.purpleair import DOMAIN from homeassistant.config_entries import SOURCE_REAUTH, SOURCE_USER from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from homeassistant.helpers import device_registry as dr from .conftest import TEST_API_KEY, TEST_SENSOR_INDEX1, TEST_SENSOR_INDEX2 @@ -46,7 +46,7 @@ async def test_create_entry_by_coordinates( 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 errors that can arise when checking the API key: @@ -54,13 +54,13 @@ async def test_create_entry_by_coordinates( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={"api_key": TEST_API_KEY} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == check_api_key_errors result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={"api_key": TEST_API_KEY} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "by_coordinates" # Test errors that can arise when searching for nearby sensors: @@ -73,7 +73,7 @@ async def test_create_entry_by_coordinates( "distance": 5, }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == get_nearby_sensors_errors result = await hass.config_entries.flow.async_configure( @@ -84,7 +84,7 @@ async def test_create_entry_by_coordinates( "distance": 5, }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "choose_sensor" result = await hass.config_entries.flow.async_configure( @@ -93,7 +93,7 @@ async def test_create_entry_by_coordinates( "sensor_index": str(TEST_SENSOR_INDEX1), }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "abcde" assert result["data"] == { "api_key": TEST_API_KEY, @@ -110,7 +110,7 @@ async def test_duplicate_error( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data={"api_key": TEST_API_KEY} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -140,7 +140,7 @@ async def test_reauth( }, data={"api_key": TEST_API_KEY}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" # Test errors that can arise when checking the API key: @@ -148,14 +148,14 @@ async def test_reauth( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={"api_key": "new_api_key"} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == check_api_key_errors result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={"api_key": "new_api_key"}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert len(hass.config_entries.async_entries()) == 1 # Unload to make sure the update does not run after the @@ -181,13 +181,13 @@ async def test_options_add_sensor( ) -> None: """Test adding a sensor via the options flow (including errors).""" result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( result["flow_id"], user_input={"next_step_id": "add_sensor"} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "add_sensor" # Test errors that can arise when searching for nearby sensors: @@ -202,7 +202,7 @@ async def test_options_add_sensor( "distance": 5, }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "add_sensor" result = await hass.config_entries.options.async_configure( @@ -213,7 +213,7 @@ async def test_options_add_sensor( "distance": 5, }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "choose_sensor" result = await hass.config_entries.options.async_configure( @@ -222,7 +222,7 @@ async def test_options_add_sensor( "sensor_index": str(TEST_SENSOR_INDEX2), }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "sensor_indices": [TEST_SENSOR_INDEX1, TEST_SENSOR_INDEX2], } @@ -241,13 +241,13 @@ async def test_options_add_sensor_duplicate( ) -> None: """Test adding a duplicate sensor via the options flow.""" result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( result["flow_id"], user_input={"next_step_id": "add_sensor"} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "add_sensor" result = await hass.config_entries.options.async_configure( @@ -258,7 +258,7 @@ async def test_options_add_sensor_duplicate( "distance": 5, }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "choose_sensor" result = await hass.config_entries.options.async_configure( @@ -267,7 +267,7 @@ async def test_options_add_sensor_duplicate( "sensor_index": str(TEST_SENSOR_INDEX1), }, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" # Unload to make sure the update does not run after the # mock is removed. @@ -279,13 +279,13 @@ async def test_options_remove_sensor( ) -> None: """Test removing a sensor via the options flow.""" result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( result["flow_id"], user_input={"next_step_id": "remove_sensor"} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "remove_sensor" device_registry = dr.async_get(hass) @@ -296,7 +296,7 @@ async def test_options_remove_sensor( result["flow_id"], user_input={"sensor_device_id": device_entry.id}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "sensor_indices": [], } @@ -312,19 +312,19 @@ async def test_options_settings( ) -> None: """Test setting settings via the options flow.""" result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( result["flow_id"], user_input={"next_step_id": "settings"} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "settings" result = await hass.config_entries.options.async_configure( result["flow_id"], user_input={"show_on_map": True} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "sensor_indices": [TEST_SENSOR_INDEX1], "show_on_map": True, diff --git a/tests/components/pushbullet/test_config_flow.py b/tests/components/pushbullet/test_config_flow.py index 01c946286b4..0b2efa1d556 100644 --- a/tests/components/pushbullet/test_config_flow.py +++ b/tests/components/pushbullet/test_config_flow.py @@ -35,7 +35,7 @@ async def test_flow_user(hass: HomeAssistant, requests_mock_fixture) -> None: result["flow_id"], user_input=MOCK_CONFIG, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "pushbullet" assert result["data"] == MOCK_CONFIG @@ -60,7 +60,7 @@ async def test_flow_user_already_configured( result["flow_id"], user_input=MOCK_CONFIG, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -85,7 +85,7 @@ async def test_flow_name_already_configured(hass: HomeAssistant) -> None: result["flow_id"], user_input=new_config, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -101,7 +101,7 @@ async def test_flow_invalid_key(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_USER}, data=MOCK_CONFIG, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {CONF_API_KEY: "invalid_api_key"} @@ -118,6 +118,6 @@ async def test_flow_conn_error(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_USER}, data=MOCK_CONFIG, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "cannot_connect"} diff --git a/tests/components/pushover/test_config_flow.py b/tests/components/pushover/test_config_flow.py index fcaedf2b5a6..9b92033414c 100644 --- a/tests/components/pushover/test_config_flow.py +++ b/tests/components/pushover/test_config_flow.py @@ -44,7 +44,7 @@ async def test_flow_user(hass: HomeAssistant) -> None: result["flow_id"], user_input=MOCK_CONFIG, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Pushover" assert result["data"] == MOCK_CONFIG @@ -66,7 +66,7 @@ async def test_flow_user_key_api_key_exists(hass: HomeAssistant) -> None: result["flow_id"], user_input=MOCK_CONFIG, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -91,7 +91,7 @@ async def test_flow_name_already_configured(hass: HomeAssistant) -> None: result["flow_id"], user_input=new_config, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -106,7 +106,7 @@ async def test_flow_invalid_user_key( context={"source": config_entries.SOURCE_USER}, data=MOCK_CONFIG, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {CONF_USER_KEY: "invalid_user_key"} @@ -122,7 +122,7 @@ async def test_flow_invalid_api_key( context={"source": config_entries.SOURCE_USER}, data=MOCK_CONFIG, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {CONF_API_KEY: "invalid_api_key"} @@ -136,7 +136,7 @@ async def test_flow_conn_err(hass: HomeAssistant, mock_pushover: MagicMock) -> N context={"source": config_entries.SOURCE_USER}, data=MOCK_CONFIG, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "cannot_connect"} @@ -158,7 +158,7 @@ async def test_reauth_success(hass: HomeAssistant) -> None: data=MOCK_CONFIG, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" result2 = await hass.config_entries.flow.async_configure( @@ -168,7 +168,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" @@ -200,7 +200,7 @@ async def test_reauth_failed(hass: HomeAssistant, mock_pushover: MagicMock) -> N }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == { CONF_API_KEY: "invalid_api_key", } @@ -232,7 +232,7 @@ async def test_reauth_with_existing_config(hass: HomeAssistant) -> None: data=MOCK_CONFIG, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" result2 = await hass.config_entries.flow.async_configure( @@ -242,5 +242,5 @@ async def test_reauth_with_existing_config(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" diff --git a/tests/components/pvoutput/test_config_flow.py b/tests/components/pvoutput/test_config_flow.py index 1839a7f51e0..20e99f8e497 100644 --- a/tests/components/pvoutput/test_config_flow.py +++ b/tests/components/pvoutput/test_config_flow.py @@ -23,7 +23,7 @@ async def test_full_user_flow( 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( @@ -34,7 +34,7 @@ async def test_full_user_flow( }, ) - assert result2.get("type") == FlowResultType.CREATE_ENTRY + assert result2.get("type") is FlowResultType.CREATE_ENTRY assert result2.get("title") == "12345" assert result2.get("data") == { CONF_SYSTEM_ID: 12345, @@ -59,7 +59,7 @@ async def test_full_flow_with_authentication_error( DOMAIN, context={"source": SOURCE_USER} ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "user" mock_pvoutput.system.side_effect = PVOutputAuthenticationError @@ -71,7 +71,7 @@ async def test_full_flow_with_authentication_error( }, ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "user" assert result2.get("errors") == {"base": "invalid_auth"} @@ -87,7 +87,7 @@ async def test_full_flow_with_authentication_error( }, ) - assert result3.get("type") == FlowResultType.CREATE_ENTRY + assert result3.get("type") is FlowResultType.CREATE_ENTRY assert result3.get("title") == "12345" assert result3.get("data") == { CONF_SYSTEM_ID: 12345, @@ -111,7 +111,7 @@ async def test_connection_error(hass: HomeAssistant, mock_pvoutput: MagicMock) - }, ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("errors") == {"base": "cannot_connect"} assert len(mock_pvoutput.system.mock_calls) == 1 @@ -137,7 +137,7 @@ async def test_already_configured( }, ) - assert result2.get("type") == FlowResultType.ABORT + assert result2.get("type") is FlowResultType.ABORT assert result2.get("reason") == "already_configured" @@ -159,7 +159,7 @@ async def test_reauth_flow( }, data=mock_config_entry.data, ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "reauth_confirm" result2 = await hass.config_entries.flow.async_configure( @@ -168,7 +168,7 @@ async def test_reauth_flow( ) await hass.async_block_till_done() - assert result2.get("type") == FlowResultType.ABORT + assert result2.get("type") is FlowResultType.ABORT assert result2.get("reason") == "reauth_successful" assert mock_config_entry.data == { CONF_SYSTEM_ID: 12345, @@ -201,7 +201,7 @@ async def test_reauth_with_authentication_error( }, data=mock_config_entry.data, ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "reauth_confirm" mock_pvoutput.system.side_effect = PVOutputAuthenticationError @@ -211,7 +211,7 @@ async def test_reauth_with_authentication_error( ) await hass.async_block_till_done() - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "reauth_confirm" assert result2.get("errors") == {"base": "invalid_auth"} @@ -225,7 +225,7 @@ async def test_reauth_with_authentication_error( ) await hass.async_block_till_done() - assert result3.get("type") == FlowResultType.ABORT + assert result3.get("type") is FlowResultType.ABORT assert result3.get("reason") == "reauth_successful" assert mock_config_entry.data == { CONF_SYSTEM_ID: 12345, @@ -253,7 +253,7 @@ async def test_reauth_api_error( }, data=mock_config_entry.data, ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "reauth_confirm" mock_pvoutput.system.side_effect = PVOutputConnectionError @@ -263,6 +263,6 @@ async def test_reauth_api_error( ) await hass.async_block_till_done() - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "reauth_confirm" assert result2.get("errors") == {"base": "cannot_connect"} diff --git a/tests/components/pvpc_hourly_pricing/test_config_flow.py b/tests/components/pvpc_hourly_pricing/test_config_flow.py index 2a4c5688b5f..70e25392bb6 100644 --- a/tests/components/pvpc_hourly_pricing/test_config_flow.py +++ b/tests/components/pvpc_hourly_pricing/test_config_flow.py @@ -4,7 +4,7 @@ from datetime import datetime, timedelta from freezegun.api import FrozenDateTimeFactory -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.pvpc_hourly_pricing.const import ( ATTR_POWER, ATTR_POWER_P3, @@ -15,6 +15,7 @@ from homeassistant.components.pvpc_hourly_pricing.const import ( ) from homeassistant.const import CONF_API_TOKEN, CONF_NAME from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from homeassistant.helpers import entity_registry as er from homeassistant.util import dt as dt_util @@ -53,12 +54,12 @@ async def test_config_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 result = await hass.config_entries.flow.async_configure( result["flow_id"], tst_config ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY await hass.async_block_till_done() state = hass.states.get("sensor.esios_pvpc") @@ -73,11 +74,11 @@ async def test_config_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 result = await hass.config_entries.flow.async_configure( result["flow_id"], tst_config ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert pvpc_aioclient_mock.call_count == 1 # Check removal @@ -89,12 +90,12 @@ async def test_config_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 result = await hass.config_entries.flow.async_configure( result["flow_id"], tst_config ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY await hass.async_block_till_done() state = hass.states.get("sensor.esios_pvpc") @@ -110,21 +111,21 @@ async def test_config_flow( config_entry = current_entries[0] 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( result["flow_id"], user_input={ATTR_POWER: 3.0, ATTR_POWER_P3: 4.6, CONF_USE_API_TOKEN: True}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "api_token" assert pvpc_aioclient_mock.call_count == 2 result = await hass.config_entries.options.async_configure( result["flow_id"], user_input={CONF_API_TOKEN: "test-token"} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert pvpc_aioclient_mock.call_count == 2 await hass.async_block_till_done() state = hass.states.get("sensor.esios_pvpc") @@ -154,14 +155,14 @@ async def test_config_flow( # disable api token in options 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( result["flow_id"], user_input={ATTR_POWER: 3.0, ATTR_POWER_P3: 4.6, CONF_USE_API_TOKEN: False}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert pvpc_aioclient_mock.call_count == 6 await hass.async_block_till_done() assert pvpc_aioclient_mock.call_count == 7 @@ -195,19 +196,19 @@ async def test_reauth( 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 result = await hass.config_entries.flow.async_configure( result["flow_id"], tst_config ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "api_token" assert pvpc_aioclient_mock.call_count == 0 result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_API_TOKEN: "test-token"} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "api_token" assert result["errors"]["base"] == "invalid_auth" assert pvpc_aioclient_mock.call_count == 1 @@ -216,7 +217,7 @@ async def test_reauth( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_API_TOKEN: "test-token"} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY config_entry = result["result"] assert pvpc_aioclient_mock.call_count == 4 @@ -234,7 +235,7 @@ async def test_reauth( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_API_TOKEN: "test-token"} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert pvpc_aioclient_mock.call_count == 7 @@ -248,7 +249,7 @@ async def test_reauth( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_API_TOKEN: "test-token"} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert pvpc_aioclient_mock.call_count == 8 diff --git a/tests/components/qbittorrent/test_config_flow.py b/tests/components/qbittorrent/test_config_flow.py index 8a424f5c87b..c52762f24d3 100644 --- a/tests/components/qbittorrent/test_config_flow.py +++ b/tests/components/qbittorrent/test_config_flow.py @@ -40,7 +40,7 @@ async def test_flow_user(hass: HomeAssistant, mock_api: requests_mock.Mocker) -> result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" # Test flow with connection failure, fail with cannot_connect @@ -53,7 +53,7 @@ async def test_flow_user(hass: HomeAssistant, mock_api: requests_mock.Mocker) -> result["flow_id"], USER_INPUT ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "cannot_connect"} @@ -69,7 +69,7 @@ async def test_flow_user(hass: HomeAssistant, mock_api: requests_mock.Mocker) -> result["flow_id"], USER_INPUT ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "invalid_auth"} @@ -78,7 +78,7 @@ async def test_flow_user(hass: HomeAssistant, mock_api: requests_mock.Mocker) -> result["flow_id"], USER_INPUT ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { CONF_URL: "http://localhost:8080", CONF_USERNAME: "user", @@ -96,12 +96,12 @@ async def test_flow_user_already_configured(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" # Test flow with duplicate config result = await hass.config_entries.flow.async_configure( result["flow_id"], USER_INPUT ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/qingping/test_config_flow.py b/tests/components/qingping/test_config_flow.py index c5b5dd94cc2..7bcd9c09e68 100644 --- a/tests/components/qingping/test_config_flow.py +++ b/tests/components/qingping/test_config_flow.py @@ -23,7 +23,7 @@ async def test_async_step_bluetooth_valid_device(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=LIGHT_AND_SIGNAL_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch( "homeassistant.components.qingping.async_setup_entry", return_value=True @@ -31,7 +31,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"] == "Motion & Light EEFF" assert result2["data"] == {} assert result2["result"].unique_id == "aa:bb:cc:dd:ee:ff" @@ -50,7 +50,7 @@ async def test_async_step_bluetooth_not_enough_info_at_start( context={"source": config_entries.SOURCE_BLUETOOTH}, data=NO_DATA_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch( "homeassistant.components.qingping.async_setup_entry", return_value=True @@ -58,7 +58,7 @@ async def test_async_step_bluetooth_not_enough_info_at_start( 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"] == "Qingping Motion & Light" assert result2["data"] == {} assert result2["result"].unique_id == "aa:bb:cc:dd:ee:ff" @@ -75,7 +75,7 @@ async def test_async_step_bluetooth_not_qingping(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=NOT_QINGPING_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_supported" @@ -85,7 +85,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" @@ -99,7 +99,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.qingping.async_setup_entry", return_value=True @@ -108,7 +108,7 @@ async def test_async_step_user_with_found_devices(hass: HomeAssistant) -> None: result["flow_id"], user_input={"address": "aa:bb:cc:dd:ee:ff"}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Motion & Light EEFF" assert result2["data"] == {} assert result2["result"].unique_id == "aa:bb:cc:dd:ee:ff" @@ -124,7 +124,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( @@ -140,7 +140,7 @@ async def test_async_step_user_device_added_between_steps(hass: HomeAssistant) - result["flow_id"], user_input={"address": "aa:bb:cc:dd:ee:ff"}, ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" @@ -162,7 +162,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" @@ -179,7 +179,7 @@ async def test_async_step_bluetooth_devices_already_setup(hass: HomeAssistant) - context={"source": config_entries.SOURCE_BLUETOOTH}, data=LIGHT_AND_SIGNAL_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -190,7 +190,7 @@ async def test_async_step_bluetooth_already_in_progress(hass: HomeAssistant) -> context={"source": config_entries.SOURCE_BLUETOOTH}, data=LIGHT_AND_SIGNAL_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( @@ -198,7 +198,7 @@ async def test_async_step_bluetooth_already_in_progress(hass: HomeAssistant) -> context={"source": config_entries.SOURCE_BLUETOOTH}, data=LIGHT_AND_SIGNAL_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_in_progress" @@ -211,7 +211,7 @@ async def test_async_step_user_takes_precedence_over_discovery( context={"source": config_entries.SOURCE_BLUETOOTH}, data=LIGHT_AND_SIGNAL_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch( @@ -222,7 +222,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.qingping.async_setup_entry", return_value=True @@ -231,7 +231,7 @@ async def test_async_step_user_takes_precedence_over_discovery( result["flow_id"], user_input={"address": "aa:bb:cc:dd:ee:ff"}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Motion & Light EEFF" assert result2["data"] == {} assert result2["result"].unique_id == "aa:bb:cc:dd:ee:ff" diff --git a/tests/components/qnap/test_config_flow.py b/tests/components/qnap/test_config_flow.py index 881086b9e10..57ac67525e2 100644 --- a/tests/components/qnap/test_config_flow.py +++ b/tests/components/qnap/test_config_flow.py @@ -5,7 +5,7 @@ from unittest.mock import MagicMock import pytest from requests.exceptions import ConnectTimeout -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.qnap import const from homeassistant.const import ( CONF_HOST, @@ -16,6 +16,7 @@ from homeassistant.const import ( CONF_VERIFY_SSL, ) from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from .conftest import TEST_HOST, TEST_PASSWORD, TEST_USERNAME @@ -35,7 +36,7 @@ async def test_config_flow(hass: HomeAssistant, qnap_connect: MagicMock) -> None const.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] is data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -45,7 +46,7 @@ async def test_config_flow(hass: HomeAssistant, qnap_connect: MagicMock) -> None STANDARD_CONFIG, ) - assert result["type"] is data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "cannot_connect"} @@ -55,7 +56,7 @@ async def test_config_flow(hass: HomeAssistant, qnap_connect: MagicMock) -> None STANDARD_CONFIG, ) - assert result["type"] is data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "invalid_auth"} @@ -65,7 +66,7 @@ async def test_config_flow(hass: HomeAssistant, qnap_connect: MagicMock) -> None STANDARD_CONFIG, ) - assert result["type"] is data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "unknown"} @@ -75,7 +76,7 @@ async def test_config_flow(hass: HomeAssistant, qnap_connect: MagicMock) -> None STANDARD_CONFIG, ) - assert result["type"] is data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Test NAS name" assert result["data"] == { CONF_HOST: "1.2.3.4", diff --git a/tests/components/qnap_qsw/test_config_flow.py b/tests/components/qnap_qsw/test_config_flow.py index 26a6581b207..334f74ccf4b 100644 --- a/tests/components/qnap_qsw/test_config_flow.py +++ b/tests/components/qnap_qsw/test_config_flow.py @@ -5,12 +5,13 @@ from unittest.mock import MagicMock, patch from aioqsw.const import API_MAC_ADDR, API_PRODUCT, API_RESULT from aioqsw.exceptions import LoginError, QswError -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components import dhcp from homeassistant.components.qnap_qsw.const import DOMAIN from homeassistant.config_entries import SOURCE_USER, ConfigEntryState from homeassistant.const import CONF_PASSWORD, CONF_URL, CONF_USERNAME from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from homeassistant.helpers.device_registry import format_mac from .util import CONFIG, LIVE_MOCK, SYSTEM_BOARD_MOCK, USERS_LOGIN_MOCK @@ -53,7 +54,7 @@ async def test_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" assert result["errors"] == {} @@ -67,7 +68,7 @@ async def test_form(hass: HomeAssistant) -> None: entry = conf_entries[0] assert entry.state is ConfigEntryState.LOADED - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert ( result["title"] == f"QNAP {SYSTEM_BOARD_MOCK[API_RESULT][API_PRODUCT]} {SYSTEM_BOARD_MOCK[API_RESULT][API_MAC_ADDR]}" @@ -164,7 +165,7 @@ async def test_dhcp_flow(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_DHCP}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "discovered_connection" with ( @@ -216,7 +217,7 @@ async def test_dhcp_flow_error(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_DHCP}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -233,7 +234,7 @@ async def test_dhcp_connection_error(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_DHCP}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "discovered_connection" with patch( @@ -264,7 +265,7 @@ async def test_dhcp_login_error(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_DHCP}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "discovered_connection" with patch( diff --git a/tests/components/rabbitair/test_config_flow.py b/tests/components/rabbitair/test_config_flow.py index 4b5867b441b..7ec411d6a48 100644 --- a/tests/components/rabbitair/test_config_flow.py +++ b/tests/components/rabbitair/test_config_flow.py @@ -84,7 +84,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 not result["errors"] with patch( @@ -100,7 +100,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_TITLE assert result2["data"] == { CONF_HOST: TEST_HOST, @@ -127,7 +127,7 @@ async def test_form_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 not result["errors"] with patch( @@ -142,7 +142,7 @@ async def test_form_cannot_connect( }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": base_value} @@ -151,7 +151,7 @@ async def test_form_unknown_error(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 not result["errors"] with patch( @@ -166,7 +166,7 @@ async def test_form_unknown_error(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} @@ -177,7 +177,7 @@ async def test_zeroconf_discovery(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_ZEROCONF}, data=ZEROCONF_DATA ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert not result["errors"] with patch( @@ -193,7 +193,7 @@ async def test_zeroconf_discovery(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_TITLE assert result2["data"] == { CONF_HOST: TEST_NAME + ".local", @@ -207,5 +207,5 @@ async def test_zeroconf_discovery(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_ZEROCONF}, data=ZEROCONF_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/radarr/test_config_flow.py b/tests/components/radarr/test_config_flow.py index 9733393836a..407b7b50c48 100644 --- a/tests/components/radarr/test_config_flow.py +++ b/tests/components/radarr/test_config_flow.py @@ -35,7 +35,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_cannot_connect( @@ -50,7 +50,7 @@ async def test_cannot_connect( data=MOCK_USER_INPUT, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "cannot_connect"} @@ -64,7 +64,7 @@ async def test_invalid_auth( DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data=MOCK_USER_INPUT ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "invalid_auth"} @@ -81,7 +81,7 @@ async def test_wrong_app(hass: HomeAssistant) -> None: data={CONF_URL: URL, CONF_VERIFY_SSL: False}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"]["base"] == "wrong_app" @@ -98,7 +98,7 @@ async def test_zero_conf_failure(hass: HomeAssistant) -> None: data={CONF_URL: URL, CONF_VERIFY_SSL: False}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"]["base"] == "zeroconf_failed" @@ -115,7 +115,7 @@ async def test_unknown_error(hass: HomeAssistant) -> None: data=MOCK_USER_INPUT, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "unknown"} @@ -132,7 +132,7 @@ async def test_zero_conf(hass: HomeAssistant) -> None: data={CONF_URL: URL, CONF_VERIFY_SSL: False}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == DEFAULT_NAME assert result["data"] == CONF_DATA @@ -153,14 +153,14 @@ async def test_full_reauth_flow_implementation( data=entry.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( result["flow_id"], user_input={} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with patch_async_setup_entry() as mock_setup_entry: @@ -169,7 +169,7 @@ async def test_full_reauth_flow_implementation( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert entry.data == CONF_DATA | {CONF_API_KEY: "test-api-key-reauth"} @@ -188,7 +188,7 @@ async def test_full_user_flow_implementation( context={CONF_SOURCE: SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with patch_async_setup_entry(): @@ -197,7 +197,7 @@ async def test_full_user_flow_implementation( user_input=MOCK_USER_INPUT, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == DEFAULT_NAME assert result["data"] == CONF_DATA assert result["data"][CONF_URL] == "http://192.168.1.189:7887/test" diff --git a/tests/components/radio_browser/test_config_flow.py b/tests/components/radio_browser/test_config_flow.py index 0c0f2f479a8..be492e635ef 100644 --- a/tests/components/radio_browser/test_config_flow.py +++ b/tests/components/radio_browser/test_config_flow.py @@ -15,7 +15,7 @@ async def test_full_user_flow(hass: HomeAssistant, mock_setup_entry: AsyncMock) 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("errors") is None result2 = await hass.config_entries.flow.async_configure( @@ -23,7 +23,7 @@ async def test_full_user_flow(hass: HomeAssistant, mock_setup_entry: AsyncMock) user_input={}, ) - assert result2.get("type") == FlowResultType.CREATE_ENTRY + assert result2.get("type") is FlowResultType.CREATE_ENTRY assert result2.get("title") == "Radio Browser" assert result2.get("data") == {} @@ -42,7 +42,7 @@ async def test_already_configured( DOMAIN, context={"source": SOURCE_USER} ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "single_instance_allowed" @@ -54,7 +54,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") == "Radio Browser" assert result.get("data") == {} diff --git a/tests/components/radiotherm/test_config_flow.py b/tests/components/radiotherm/test_config_flow.py index 7729dfb86b7..002d6b71ae6 100644 --- a/tests/components/radiotherm/test_config_flow.py +++ b/tests/components/radiotherm/test_config_flow.py @@ -5,11 +5,12 @@ from unittest.mock import MagicMock, patch from radiotherm import CommonThermostat from radiotherm.validate import RadiothermTstatError -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components import dhcp from homeassistant.components.radiotherm.const import DOMAIN from homeassistant.const import CONF_HOST from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -51,7 +52,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"] == "My Name" assert result2["data"] == { "host": "1.2.3.4", @@ -76,7 +77,7 @@ async def test_form_unknown_error(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} @@ -97,7 +98,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {CONF_HOST: "cannot_connect"} @@ -119,7 +120,7 @@ async def test_dhcp_can_confirm(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["step_id"] == "confirm" assert result["description_placeholders"] == { "host": "1.2.3.4", @@ -137,7 +138,7 @@ async def test_dhcp_can_confirm(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"] == "My Name" assert result2["data"] == { "host": "1.2.3.4", @@ -163,7 +164,7 @@ async def test_dhcp_fails_to_connect(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"] == "cannot_connect" @@ -192,7 +193,7 @@ async def test_dhcp_already_exists(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" @@ -209,7 +210,7 @@ async def test_user_unique_id_already_exists(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 ( @@ -230,5 +231,5 @@ async def test_user_unique_id_already_exists(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"] == "already_configured" diff --git a/tests/components/rainbird/test_config_flow.py b/tests/components/rainbird/test_config_flow.py index 09db734f1ad..4768954850d 100644 --- a/tests/components/rainbird/test_config_flow.py +++ b/tests/components/rainbird/test_config_flow.py @@ -61,7 +61,7 @@ async def complete_flow(hass: HomeAssistant) -> FlowResult: 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("step_id") == "user" assert not result.get("errors") assert "flow_id" in result @@ -165,7 +165,7 @@ async def test_multiple_config_entries( responses.extend(config_flow_responses) result = await complete_flow(hass) - assert result.get("type") == FlowResultType.CREATE_ENTRY + assert result.get("type") is FlowResultType.CREATE_ENTRY assert dict(result.get("result").data) == expected_config_entry entries = hass.config_entries.async_entries(DOMAIN) @@ -241,7 +241,7 @@ async def test_duplicate_config_entries( result = await complete_flow(hass) assert len(hass.config_entries.async_entries(DOMAIN)) == 1 - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "already_configured" assert dict(config_entry.data) == expected_config_entry_data @@ -261,7 +261,7 @@ async def test_controller_cannot_connect( ) result = await complete_flow(hass) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "user" assert result.get("errors") == {"base": "cannot_connect"} @@ -279,7 +279,7 @@ async def test_controller_timeout( side_effect=TimeoutError, ): result = await complete_flow(hass) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "user" assert result.get("errors") == {"base": "timeout_connect"} @@ -303,14 +303,14 @@ async def test_options_flow(hass: HomeAssistant, mock_setup: Mock) -> None: # Initiate the options flow result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "init" # Change the default duration result = await hass.config_entries.options.async_configure( result["flow_id"], user_input={ATTR_DURATION: 5} ) - assert result.get("type") == FlowResultType.CREATE_ENTRY + assert result.get("type") is FlowResultType.CREATE_ENTRY assert config_entry.options == { ATTR_DURATION: 5, } diff --git a/tests/components/rainforest_eagle/test_config_flow.py b/tests/components/rainforest_eagle/test_config_flow.py index 191a7a4793e..d3df44fb4fe 100644 --- a/tests/components/rainforest_eagle/test_config_flow.py +++ b/tests/components/rainforest_eagle/test_config_flow.py @@ -22,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"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None 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"] == "abcdef" assert result2["data"] == { CONF_TYPE: TYPE_EAGLE_200, @@ -76,7 +76,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "invalid_auth"} @@ -99,5 +99,5 @@ 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"} diff --git a/tests/components/rainforest_raven/test_config_flow.py b/tests/components/rainforest_raven/test_config_flow.py index d7b188d6b14..d86dee6e0f6 100644 --- a/tests/components/rainforest_raven/test_config_flow.py +++ b/tests/components/rainforest_raven/test_config_flow.py @@ -6,11 +6,11 @@ from aioraven.device import RAVEnConnectionError import pytest import serial.tools.list_ports -from homeassistant import data_entry_flow from homeassistant.components.rainforest_raven.const import DOMAIN from homeassistant.config_entries import SOURCE_USB, SOURCE_USER from homeassistant.const import CONF_DEVICE, CONF_MAC, CONF_SOURCE from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from . import create_mock_device from .const import DEVICE_NAME, DISCOVERY_INFO, METER_LIST @@ -74,7 +74,7 @@ async def test_flow_usb(hass: HomeAssistant, mock_comports, mock_device): DOMAIN, context={CONF_SOURCE: SOURCE_USB}, data=DISCOVERY_INFO ) assert result - assert result.get("type") == data_entry_flow.FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert not result.get("errors") assert result.get("flow_id") assert result.get("step_id") == "meters" @@ -83,7 +83,7 @@ async def test_flow_usb(hass: HomeAssistant, mock_comports, mock_device): result["flow_id"], user_input={CONF_MAC: [METER_LIST.meter_mac_ids[0].hex()]} ) assert result - assert result.get("type") == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result.get("type") is FlowResultType.CREATE_ENTRY async def test_flow_usb_cannot_connect( @@ -94,7 +94,7 @@ async def test_flow_usb_cannot_connect( DOMAIN, context={CONF_SOURCE: SOURCE_USB}, data=DISCOVERY_INFO ) assert result - assert result.get("type") == data_entry_flow.FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "cannot_connect" @@ -106,7 +106,7 @@ async def test_flow_usb_timeout_connect( DOMAIN, context={CONF_SOURCE: SOURCE_USB}, data=DISCOVERY_INFO ) assert result - assert result.get("type") == data_entry_flow.FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "timeout_connect" @@ -118,7 +118,7 @@ async def test_flow_usb_comm_error( DOMAIN, context={CONF_SOURCE: SOURCE_USB}, data=DISCOVERY_INFO ) assert result - assert result.get("type") == data_entry_flow.FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "cannot_connect" @@ -129,7 +129,7 @@ async def test_flow_user(hass: HomeAssistant, mock_comports, mock_device): context={CONF_SOURCE: SOURCE_USER}, ) assert result - assert result.get("type") == data_entry_flow.FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert not result.get("errors") assert result.get("flow_id") assert result.get("step_id") == "user" @@ -141,7 +141,7 @@ async def test_flow_user(hass: HomeAssistant, mock_comports, mock_device): }, ) assert result - assert result.get("type") == data_entry_flow.FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert not result.get("errors") assert result.get("flow_id") assert result.get("step_id") == "meters" @@ -150,7 +150,7 @@ async def test_flow_user(hass: HomeAssistant, mock_comports, mock_device): result["flow_id"], user_input={CONF_MAC: [METER_LIST.meter_mac_ids[0].hex()]} ) assert result - assert result.get("type") == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result.get("type") is FlowResultType.CREATE_ENTRY async def test_flow_user_no_available_devices(hass: HomeAssistant, mock_comports): @@ -165,7 +165,7 @@ async def test_flow_user_no_available_devices(hass: HomeAssistant, mock_comports context={CONF_SOURCE: SOURCE_USER}, ) assert result - assert result.get("type") == data_entry_flow.FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "no_devices_found" @@ -176,7 +176,7 @@ async def test_flow_user_in_progress(hass: HomeAssistant, mock_comports): context={CONF_SOURCE: SOURCE_USER}, ) assert result - assert result.get("type") == data_entry_flow.FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert not result.get("errors") assert result.get("flow_id") assert result.get("step_id") == "user" @@ -186,7 +186,7 @@ async def test_flow_user_in_progress(hass: HomeAssistant, mock_comports): context={CONF_SOURCE: SOURCE_USER}, ) assert result - assert result.get("type") == data_entry_flow.FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "already_in_progress" @@ -202,7 +202,7 @@ async def test_flow_user_cannot_connect( }, ) assert result - assert result.get("type") == data_entry_flow.FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("errors") == {CONF_DEVICE: "cannot_connect"} @@ -218,7 +218,7 @@ async def test_flow_user_timeout_connect( }, ) assert result - assert result.get("type") == data_entry_flow.FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("errors") == {CONF_DEVICE: "timeout_connect"} @@ -234,5 +234,5 @@ async def test_flow_user_comm_error( }, ) assert result - assert result.get("type") == data_entry_flow.FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("errors") == {CONF_DEVICE: "cannot_connect"} diff --git a/tests/components/rainmachine/test_config_flow.py b/tests/components/rainmachine/test_config_flow.py index 1c065a8f7ce..808c2f184a7 100644 --- a/tests/components/rainmachine/test_config_flow.py +++ b/tests/components/rainmachine/test_config_flow.py @@ -6,7 +6,7 @@ from unittest.mock import patch import pytest from regenmaschine.errors import RainMachineError -from homeassistant import config_entries, data_entry_flow, setup +from homeassistant import config_entries, setup from homeassistant.components import zeroconf from homeassistant.components.rainmachine import ( CONF_ALLOW_INACTIVE_ZONES_TO_RUN, @@ -16,6 +16,7 @@ from homeassistant.components.rainmachine import ( ) from homeassistant.const import CONF_IP_ADDRESS, CONF_PASSWORD, CONF_PORT, CONF_SSL from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from homeassistant.helpers import entity_registry as er @@ -24,7 +25,7 @@ async def test_duplicate_error(hass: HomeAssistant, config, config_entry) -> Non result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER}, data=config ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -107,7 +108,7 @@ async def test_options_flow(hass: HomeAssistant, config, config_entry) -> 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"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -118,7 +119,7 @@ async def test_options_flow(hass: HomeAssistant, config, config_entry) -> None: CONF_ALLOW_INACTIVE_ZONES_TO_RUN: False, }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { CONF_DEFAULT_ZONE_RUN_TIME: 600, CONF_USE_APP_RUN_TIMES: False, @@ -133,7 +134,7 @@ async def test_show_form(hass: HomeAssistant) -> None: 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" @@ -144,7 +145,7 @@ async def test_step_user(hass: HomeAssistant, config, setup_rainmachine) -> None context={"source": config_entries.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_IP_ADDRESS: "192.168.1.100", @@ -179,7 +180,7 @@ async def test_step_homekit_zeroconf_ip_already_exists( ), ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -207,7 +208,7 @@ async def test_step_homekit_zeroconf_ip_change( ), ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert config_entry.data[CONF_IP_ADDRESS] == "192.168.1.2" @@ -236,7 +237,7 @@ async def test_step_homekit_zeroconf_new_controller_when_some_exist( ), ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with ( @@ -258,7 +259,7 @@ async def test_step_homekit_zeroconf_new_controller_when_some_exist( ) 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"] == "12345" assert result2["data"] == { CONF_IP_ADDRESS: "192.168.1.100", @@ -290,7 +291,7 @@ async def test_discovery_by_homekit_and_zeroconf_same_time( ), ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with patch( @@ -310,5 +311,5 @@ async def test_discovery_by_homekit_and_zeroconf_same_time( ), ) - assert result2["type"] == data_entry_flow.FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_in_progress" diff --git a/tests/components/random/test_config_flow.py b/tests/components/random/test_config_flow.py index 4ffa59da4e4..b4eff5c966b 100644 --- a/tests/components/random/test_config_flow.py +++ b/tests/components/random/test_config_flow.py @@ -60,14 +60,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": entity_type}, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == entity_type with patch( @@ -82,7 +82,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"] == "My random entity" assert result["data"] == {} assert result["options"] == { @@ -108,14 +108,14 @@ async def test_wrong_uom( 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": "sensor"}, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "sensor" with pytest.raises(Invalid, match="is not a valid unit for device class"): @@ -179,7 +179,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"] == entity_type assert "name" not in result["data_schema"].schema @@ -187,7 +187,7 @@ async def test_options( result["flow_id"], user_input=options_options, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "name": "My random", "entity_type": entity_type, diff --git a/tests/components/rapt_ble/test_config_flow.py b/tests/components/rapt_ble/test_config_flow.py index b71843bd44f..2189b8a610c 100644 --- a/tests/components/rapt_ble/test_config_flow.py +++ b/tests/components/rapt_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=COMPLETE_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch( "homeassistant.components.rapt_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"] == "RAPT Pill 0666" assert result2["data"] == {} assert result2["result"].unique_id == RAPT_MAC @@ -40,7 +40,7 @@ async def test_async_step_bluetooth_not_rapt(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=NOT_RAPT_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.rapt_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": RAPT_MAC}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "RAPT Pill 0666" assert result2["data"] == {} assert result2["result"].unique_id == RAPT_MAC @@ -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": RAPT_MAC}, ) - 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=COMPLETE_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=COMPLETE_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=COMPLETE_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=COMPLETE_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.rapt_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": RAPT_MAC}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "RAPT Pill 0666" assert result2["data"] == {} assert result2["result"].unique_id == RAPT_MAC diff --git a/tests/components/raspberry_pi/test_config_flow.py b/tests/components/raspberry_pi/test_config_flow.py index 05fea6ed3d3..19c23295493 100644 --- a/tests/components/raspberry_pi/test_config_flow.py +++ b/tests/components/raspberry_pi/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"] == "Raspberry Pi" 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/rdw/test_config_flow.py b/tests/components/rdw/test_config_flow.py index b8c21be300e..2aa39f2c2d3 100644 --- a/tests/components/rdw/test_config_flow.py +++ b/tests/components/rdw/test_config_flow.py @@ -18,7 +18,7 @@ async def test_full_user_flow( 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( @@ -28,7 +28,7 @@ async def test_full_user_flow( }, ) - assert result2.get("type") == FlowResultType.CREATE_ENTRY + assert result2.get("type") is FlowResultType.CREATE_ENTRY assert result2.get("title") == "11-ZKZ-3" assert result2.get("data") == {CONF_LICENSE_PLATE: "11ZKZ3"} @@ -45,7 +45,7 @@ async def test_full_flow_with_authentication_error( DOMAIN, context={"source": SOURCE_USER} ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "user" mock_rdw_config_flow.vehicle.side_effect = RDWUnknownLicensePlateError @@ -56,7 +56,7 @@ async def test_full_flow_with_authentication_error( }, ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "user" assert result2.get("errors") == {"base": "unknown_license_plate"} @@ -68,7 +68,7 @@ async def test_full_flow_with_authentication_error( }, ) - assert result3.get("type") == FlowResultType.CREATE_ENTRY + assert result3.get("type") is FlowResultType.CREATE_ENTRY assert result3.get("title") == "11-ZKZ-3" assert result3.get("data") == {CONF_LICENSE_PLATE: "11ZKZ3"} @@ -85,5 +85,5 @@ async def test_connection_error( data={CONF_LICENSE_PLATE: "0001TJ"}, ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("errors") == {"base": "cannot_connect"} diff --git a/tests/components/recollect_waste/test_config_flow.py b/tests/components/recollect_waste/test_config_flow.py index a65b0d27a74..aac829f00a3 100644 --- a/tests/components/recollect_waste/test_config_flow.py +++ b/tests/components/recollect_waste/test_config_flow.py @@ -5,7 +5,6 @@ from unittest.mock import AsyncMock, patch from aiorecollect.errors import RecollectError import pytest -from homeassistant import data_entry_flow from homeassistant.components.recollect_waste import ( CONF_PLACE_ID, CONF_SERVICE_ID, @@ -14,6 +13,7 @@ from homeassistant.components.recollect_waste import ( from homeassistant.config_entries import SOURCE_USER from homeassistant.const import CONF_FRIENDLY_NAME from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from .conftest import TEST_PLACE_ID, TEST_SERVICE_ID @@ -39,7 +39,7 @@ async def test_create_entry( 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 errors that can arise when checking the API key: @@ -47,13 +47,13 @@ async def test_create_entry( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=config ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == get_pickup_events_errors result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=config ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == f"{TEST_PLACE_ID}, {TEST_SERVICE_ID}" assert result["data"] == { CONF_PLACE_ID: TEST_PLACE_ID, @@ -66,7 +66,7 @@ async def test_duplicate_error(hass: HomeAssistant, config, setup_config_entry) 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" @@ -75,11 +75,11 @@ async def test_options_flow( ) -> None: """Test config flow options.""" 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( result["flow_id"], user_input={CONF_FRIENDLY_NAME: True} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == {CONF_FRIENDLY_NAME: True} diff --git a/tests/components/refoss/test_config_flow.py b/tests/components/refoss/test_config_flow.py index f022c950635..ae40f6dd8b2 100644 --- a/tests/components/refoss/test_config_flow.py +++ b/tests/components/refoss/test_config_flow.py @@ -2,9 +2,10 @@ from unittest.mock import AsyncMock, patch -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.refoss.const import DOMAIN from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from . import FakeDiscovery, build_base_device_mock @@ -33,11 +34,11 @@ async def test_creating_entry_sets_up( ) # 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() @@ -60,10 +61,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/renault/test_config_flow.py b/tests/components/renault/test_config_flow.py index eca7991a27c..7d40cf69314 100644 --- a/tests/components/renault/test_config_flow.py +++ b/tests/components/renault/test_config_flow.py @@ -7,7 +7,7 @@ from renault_api.gigya.exceptions import InvalidCredentialsException from renault_api.kamereon import schemas from renault_api.renault_account import RenaultAccount -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.renault.const import ( CONF_KAMEREON_ACCOUNT_ID, CONF_LOCALE, @@ -16,6 +16,7 @@ from homeassistant.components.renault.const import ( from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from homeassistant.helpers import aiohttp_client from .const import MOCK_CONFIG @@ -32,7 +33,7 @@ async def test_config_flow_single_account( 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"] == {} # Failed credentials @@ -49,7 +50,7 @@ async def test_config_flow_single_account( }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "invalid_credentials"} renault_account = AsyncMock() @@ -80,7 +81,7 @@ async def test_config_flow_single_account( }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "account_id_1" assert result["data"][CONF_USERNAME] == "email@test.com" assert result["data"][CONF_PASSWORD] == "test" @@ -97,7 +98,7 @@ async def test_config_flow_no_account( 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"] == {} # Account list empty @@ -117,7 +118,7 @@ async def test_config_flow_no_account( }, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "kamereon_no_account" assert len(mock_setup_entry.mock_calls) == 0 @@ -130,7 +131,7 @@ async def test_config_flow_multiple_accounts( 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"] == {} renault_account_1 = RenaultAccount( @@ -160,7 +161,7 @@ async def test_config_flow_multiple_accounts( }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "kamereon" # Account selected @@ -168,7 +169,7 @@ async def test_config_flow_multiple_accounts( result["flow_id"], user_input={CONF_KAMEREON_ACCOUNT_ID: "account_id_2"}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "account_id_2" assert result["data"][CONF_USERNAME] == "email@test.com" assert result["data"][CONF_PASSWORD] == "test" @@ -188,7 +189,7 @@ async def test_config_flow_duplicate( 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"] == {} renault_account = RenaultAccount( @@ -212,7 +213,7 @@ async def test_config_flow_duplicate( }, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" await hass.async_block_till_done() @@ -233,7 +234,7 @@ async def test_reauth(hass: HomeAssistant, config_entry: ConfigEntry) -> None: data=MOCK_CONFIG, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["description_placeholders"] == {CONF_USERNAME: "email@test.com"} assert result["errors"] == {} @@ -247,7 +248,7 @@ async def test_reauth(hass: HomeAssistant, config_entry: ConfigEntry) -> None: user_input={CONF_PASSWORD: "any"}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["description_placeholders"] == {CONF_USERNAME: "email@test.com"} assert result2["errors"] == {"base": "invalid_credentials"} @@ -258,5 +259,5 @@ async def test_reauth(hass: HomeAssistant, config_entry: ConfigEntry) -> None: user_input={CONF_PASSWORD: "any"}, ) - assert result3["type"] == data_entry_flow.FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "reauth_successful" diff --git a/tests/components/renson/test_config_flow.py b/tests/components/renson/test_config_flow.py index 6d51605824e..2f60149d14d 100644 --- a/tests/components/renson/test_config_flow.py +++ b/tests/components/renson/test_config_flow.py @@ -13,7 +13,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 ( @@ -34,7 +34,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"] == "Renson" assert result2["data"] == { "host": "1.1.1.1", @@ -59,7 +59,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"} @@ -80,5 +80,5 @@ async def test_form_unknown(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} diff --git a/tests/components/reolink/test_config_flow.py b/tests/components/reolink/test_config_flow.py index e8818c9e560..bcbf4fe45a7 100644 --- a/tests/components/reolink/test_config_flow.py +++ b/tests/components/reolink/test_config_flow.py @@ -8,7 +8,7 @@ from unittest.mock import AsyncMock, MagicMock, call import pytest from reolink_aio.exceptions import ApiError, CredentialsInvalidError, ReolinkError -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components import dhcp from homeassistant.components.reolink import DEVICE_UPDATE_INTERVAL, const from homeassistant.components.reolink.config_flow import DEFAULT_PROTOCOL @@ -23,6 +23,7 @@ from homeassistant.const import ( CONF_USERNAME, ) from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from homeassistant.helpers.device_registry import format_mac from homeassistant.util.dt import utcnow @@ -53,7 +54,7 @@ async def test_config_flow_manual_success( const.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] is data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -66,7 +67,7 @@ async def test_config_flow_manual_success( }, ) - assert result["type"] is data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == TEST_NVR_NAME assert result["data"] == { CONF_HOST: TEST_HOST, @@ -88,7 +89,7 @@ async def test_config_flow_errors( const.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] is data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -103,7 +104,7 @@ async def test_config_flow_errors( }, ) - assert result["type"] is data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {CONF_USERNAME: "not_admin"} @@ -119,7 +120,7 @@ async def test_config_flow_errors( }, ) - assert result["type"] is data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {CONF_HOST: "cannot_connect"} @@ -133,7 +134,7 @@ async def test_config_flow_errors( }, ) - assert result["type"] is data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "webhook_exception"} @@ -149,7 +150,7 @@ async def test_config_flow_errors( }, ) - assert result["type"] is data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {CONF_HOST: "unknown"} @@ -163,7 +164,7 @@ async def test_config_flow_errors( }, ) - assert result["type"] is data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {CONF_HOST: "invalid_auth"} @@ -177,7 +178,7 @@ async def test_config_flow_errors( }, ) - assert result["type"] is data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {CONF_HOST: "api_error"} @@ -193,7 +194,7 @@ async def test_config_flow_errors( }, ) - assert result["type"] is data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == TEST_NVR_NAME assert result["data"] == { CONF_HOST: TEST_HOST, @@ -231,7 +232,7 @@ async def test_options_flow(hass: HomeAssistant, mock_setup_entry: MagicMock) -> 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( @@ -239,7 +240,7 @@ async def test_options_flow(hass: HomeAssistant, mock_setup_entry: MagicMock) -> user_input={CONF_PROTOCOL: "rtmp"}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { CONF_PROTOCOL: "rtmp", } @@ -270,7 +271,7 @@ async def test_change_connection_settings( const.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] is data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -283,7 +284,7 @@ async def test_change_connection_settings( }, ) - assert result["type"] is data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert config_entry.data[CONF_HOST] == TEST_HOST2 assert config_entry.data[CONF_USERNAME] == TEST_USERNAME2 @@ -323,7 +324,7 @@ async def test_reauth(hass: HomeAssistant, mock_setup_entry: MagicMock) -> None: data=config_entry.data, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" result = await hass.config_entries.flow.async_configure( @@ -331,7 +332,7 @@ async def test_reauth(hass: HomeAssistant, mock_setup_entry: MagicMock) -> None: {}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -343,7 +344,7 @@ async def test_reauth(hass: HomeAssistant, mock_setup_entry: MagicMock) -> None: }, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert config_entry.data[CONF_HOST] == TEST_HOST assert config_entry.data[CONF_USERNAME] == TEST_USERNAME2 @@ -362,7 +363,7 @@ async def test_dhcp_flow(hass: HomeAssistant, mock_setup_entry: MagicMock) -> No const.DOMAIN, context={"source": config_entries.SOURCE_DHCP}, data=dhcp_data ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -374,7 +375,7 @@ async def test_dhcp_flow(hass: HomeAssistant, mock_setup_entry: MagicMock) -> No }, ) - assert result["type"] is data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == TEST_NVR_NAME assert result["data"] == { CONF_HOST: TEST_HOST, @@ -489,7 +490,7 @@ async def test_dhcp_ip_update( assert reolink_connect_class.call_args_list == expected_calls - assert result["type"] is data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" await hass.async_block_till_done() diff --git a/tests/components/rfxtrx/test_config_flow.py b/tests/components/rfxtrx/test_config_flow.py index d3c87885782..dad48a04290 100644 --- a/tests/components/rfxtrx/test_config_flow.py +++ b/tests/components/rfxtrx/test_config_flow.py @@ -6,10 +6,11 @@ from unittest.mock import MagicMock, patch, sentinel from RFXtrx import RFXtrxTransportError import serial.tools.list_ports -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.rfxtrx import DOMAIN, config_flow from homeassistant.const import STATE_UNKNOWN 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 tests.common import MockConfigEntry @@ -284,7 +285,7 @@ async def test_options_global(hass: HomeAssistant) -> None: user_input={"automatic_add": True, "protocols": SOME_PROTOCOLS}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY await hass.async_block_till_done() @@ -319,7 +320,7 @@ async def test_no_protocols(hass: HomeAssistant) -> None: user_input={"automatic_add": False, "protocols": []}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY await hass.async_block_till_done() @@ -374,7 +375,7 @@ async def test_options_add_device(hass: HomeAssistant) -> None: result["flow_id"], user_input={} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY await hass.async_block_till_done() @@ -528,7 +529,7 @@ async def test_options_replace_sensor_device(hass: HomeAssistant) -> None: }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY await hass.async_block_till_done() @@ -661,7 +662,7 @@ async def test_options_replace_control_device(hass: HomeAssistant) -> None: }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY await hass.async_block_till_done() @@ -742,7 +743,7 @@ async def test_options_add_and_configure_device(hass: HomeAssistant) -> None: }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY await hass.async_block_till_done() @@ -786,7 +787,7 @@ async def test_options_add_and_configure_device(hass: HomeAssistant) -> None: }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY await hass.async_block_till_done() @@ -869,7 +870,7 @@ async def test_options_configure_rfy_cover_device(hass: HomeAssistant) -> None: }, ) - 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/rhasspy/test_config_flow.py b/tests/components/rhasspy/test_config_flow.py index 1a53dd32e04..7f74143c67c 100644 --- a/tests/components/rhasspy/test_config_flow.py +++ b/tests/components/rhasspy/test_config_flow.py @@ -15,7 +15,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 patch( @@ -28,7 +28,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"] == "Rhasspy" assert result2["data"] == {} assert len(mock_setup_entry.mock_calls) == 1 @@ -41,5 +41,5 @@ async def test_single_entry(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"] == "single_instance_allowed" diff --git a/tests/components/ridwell/test_config_flow.py b/tests/components/ridwell/test_config_flow.py index 15352929b4c..601ac182670 100644 --- a/tests/components/ridwell/test_config_flow.py +++ b/tests/components/ridwell/test_config_flow.py @@ -28,7 +28,7 @@ async def test_create_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"] == "user" # Test errors that can arise: @@ -39,7 +39,7 @@ async def test_create_entry( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=config ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == errors @@ -47,7 +47,7 @@ async def test_create_entry( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=config ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == TEST_USERNAME assert result["data"] == { CONF_USERNAME: TEST_USERNAME, @@ -60,7 +60,7 @@ async def test_duplicate_error(hass: HomeAssistant, config, setup_config_entry) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER}, data=config ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -75,6 +75,6 @@ async def test_step_reauth( result["flow_id"], user_input={CONF_PASSWORD: "new_password"}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert len(hass.config_entries.async_entries()) == 1 diff --git a/tests/components/ring/test_config_flow.py b/tests/components/ring/test_config_flow.py index f9c24ad77c5..ae3301be3ed 100644 --- a/tests/components/ring/test_config_flow.py +++ b/tests/components/ring/test_config_flow.py @@ -76,7 +76,7 @@ async def test_form_2fa( 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"] == {} mock_ring_auth.fetch_token.side_effect = ring_doorbell.Requires2FAError @@ -92,7 +92,7 @@ async def test_form_2fa( "foo@bar.com", "fake-password", None ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "2fa" mock_ring_auth.fetch_token.reset_mock(side_effect=True) mock_ring_auth.fetch_token.return_value = "new-foobar" @@ -104,7 +104,7 @@ async def test_form_2fa( mock_ring_auth.fetch_token.assert_called_once_with( "foo@bar.com", "fake-password", "123456" ) - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == "foo@bar.com" assert result3["data"] == { "username": "foo@bar.com", @@ -139,7 +139,7 @@ async def test_reauth( mock_ring_auth.fetch_token.assert_called_once_with( "foo@bar.com", "other_fake_password", None ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "2fa" mock_ring_auth.fetch_token.reset_mock(side_effect=True) mock_ring_auth.fetch_token.return_value = "new-foobar" @@ -151,7 +151,7 @@ async def test_reauth( mock_ring_auth.fetch_token.assert_called_once_with( "foo@bar.com", "other_fake_password", "123456" ) - assert result3["type"] == FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "reauth_successful" assert mock_added_config_entry.data == { "username": "foo@bar.com", @@ -197,7 +197,7 @@ async def test_reauth_error( mock_ring_auth.fetch_token.assert_called_once_with( "foo@bar.com", "error_fake_password", None ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": errors_msg} # Now test reauth can go on to succeed @@ -213,7 +213,7 @@ async def test_reauth_error( mock_ring_auth.fetch_token.assert_called_once_with( "foo@bar.com", "other_fake_password", None ) - assert result3["type"] == FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "reauth_successful" assert mock_added_config_entry.data == { "username": "foo@bar.com", diff --git a/tests/components/risco/test_config_flow.py b/tests/components/risco/test_config_flow.py index d031f4e8542..3f7a166b465 100644 --- a/tests/components/risco/test_config_flow.py +++ b/tests/components/risco/test_config_flow.py @@ -57,13 +57,13 @@ async def test_cloud_form(hass: HomeAssistant) -> None: 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 result2 = await hass.config_entries.flow.async_configure( result["flow_id"], {"next_step_id": "cloud"} ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {} with ( @@ -88,7 +88,7 @@ async def test_cloud_form(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"] == TEST_SITE_NAME assert result3["data"] == TEST_CLOUD_DATA assert len(mock_setup_entry.mock_calls) == 1 @@ -120,7 +120,7 @@ async def test_cloud_error(hass: HomeAssistant, login_with_error, error) -> None ) mock_close.assert_awaited_once() - assert result3["type"] == FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["errors"] == {"base": error} @@ -146,7 +146,7 @@ async def test_form_cloud_already_exists(hass: HomeAssistant) -> None: result2["flow_id"], TEST_CLOUD_DATA ) - assert result3["type"] == FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "already_configured" @@ -236,13 +236,13 @@ async def test_local_form(hass: HomeAssistant) -> None: 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 result2 = await hass.config_entries.flow.async_configure( result["flow_id"], {"next_step_id": "local"} ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {} with ( @@ -272,7 +272,7 @@ async def test_local_form(hass: HomeAssistant) -> None: "type": "local", CONF_COMMUNICATION_DELAY: 0, } - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == TEST_SITE_NAME assert result3["data"] == expected_data assert len(mock_setup_entry.mock_calls) == 1 @@ -300,7 +300,7 @@ async def test_local_error(hass: HomeAssistant, connect_with_error, error) -> No result2["flow_id"], TEST_LOCAL_DATA ) - assert result3["type"] == FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["errors"] == {"base": error} @@ -339,7 +339,7 @@ async def test_form_local_already_exists(hass: HomeAssistant) -> None: result2["flow_id"], TEST_LOCAL_DATA ) - assert result3["type"] == FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "already_configured" @@ -355,14 +355,14 @@ async def test_options_flow(hass: HomeAssistant) -> None: result = await hass.config_entries.options.async_init(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=TEST_OPTIONS, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "risco_to_ha" result = await hass.config_entries.options.async_configure( @@ -370,7 +370,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: user_input=TEST_RISCO_TO_HA, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "ha_to_risco" with patch("homeassistant.components.risco.async_setup_entry", return_value=True): @@ -379,7 +379,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: user_input=TEST_HA_TO_RISCO, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert entry.options == { **TEST_OPTIONS, "risco_states_to_ha": TEST_RISCO_TO_HA, diff --git a/tests/components/roborock/test_config_flow.py b/tests/components/roborock/test_config_flow.py index b5cff60cddb..fc097dd73ae 100644 --- a/tests/components/roborock/test_config_flow.py +++ b/tests/components/roborock/test_config_flow.py @@ -33,7 +33,7 @@ async def test_config_flow_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" with patch( "homeassistant.components.roborock.config_flow.RoborockApiClient.request_code" @@ -42,7 +42,7 @@ async def test_config_flow_success( result["flow_id"], {CONF_USERNAME: USER_EMAIL} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "code" assert result["errors"] == {} with patch( @@ -53,7 +53,7 @@ async def test_config_flow_success( result["flow_id"], user_input={CONF_ENTRY_CODE: "123456"} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == USER_EMAIL assert result["data"] == MOCK_CONFIG assert result["result"] @@ -86,7 +86,7 @@ async def test_config_flow_failures_request_code( 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( "homeassistant.components.roborock.config_flow.RoborockApiClient.request_code", @@ -95,7 +95,7 @@ async def test_config_flow_failures_request_code( result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_USERNAME: USER_EMAIL} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == request_code_errors # Recover from error with patch( @@ -105,7 +105,7 @@ async def test_config_flow_failures_request_code( result["flow_id"], {CONF_USERNAME: USER_EMAIL} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "code" assert result["errors"] == {} with patch( @@ -116,7 +116,7 @@ async def test_config_flow_failures_request_code( result["flow_id"], user_input={CONF_ENTRY_CODE: "123456"} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == USER_EMAIL assert result["data"] == MOCK_CONFIG assert result["result"] @@ -147,7 +147,7 @@ async def test_config_flow_failures_code_login( 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( "homeassistant.components.roborock.config_flow.RoborockApiClient.request_code" @@ -156,7 +156,7 @@ async def test_config_flow_failures_code_login( result["flow_id"], {CONF_USERNAME: USER_EMAIL} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "code" assert result["errors"] == {} # Raise exception for invalid code @@ -167,7 +167,7 @@ async def test_config_flow_failures_code_login( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_ENTRY_CODE: "123456"} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == code_login_errors with patch( "homeassistant.components.roborock.config_flow.RoborockApiClient.code_login", @@ -177,7 +177,7 @@ async def test_config_flow_failures_code_login( result["flow_id"], user_input={CONF_ENTRY_CODE: "123456"} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == USER_EMAIL assert result["data"] == MOCK_CONFIG assert result["result"] @@ -205,7 +205,7 @@ async def test_reauth_flow( ) # Enter a new code assert result["step_id"] == "code" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM new_user_data = deepcopy(USER_DATA) new_user_data.rriot.s = "new_password_hash" with patch( @@ -215,6 +215,6 @@ async def test_reauth_flow( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_ENTRY_CODE: "123456"} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert mock_roborock_entry.data["user_data"]["rriot"]["s"] == "new_password_hash" diff --git a/tests/components/roku/test_config_flow.py b/tests/components/roku/test_config_flow.py index 34640474bcd..3cf5627f342 100644 --- a/tests/components/roku/test_config_flow.py +++ b/tests/components/roku/test_config_flow.py @@ -37,7 +37,7 @@ async def test_duplicate_error( DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data=user_input ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" user_input = {CONF_HOST: mock_config_entry.data[CONF_HOST]} @@ -45,7 +45,7 @@ async def test_duplicate_error( DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data=user_input ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" discovery_info = dataclasses.replace(MOCK_SSDP_DISCOVERY_INFO) @@ -53,7 +53,7 @@ async def test_duplicate_error( DOMAIN, context={CONF_SOURCE: SOURCE_SSDP}, data=discovery_info ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -66,7 +66,7 @@ async def test_form( result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} user_input = {CONF_HOST: HOST} @@ -75,7 +75,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"] == "My Roku 3" assert "data" in result @@ -99,7 +99,7 @@ async def test_form_cannot_connect( flow_id=result["flow_id"], user_input={CONF_HOST: HOST} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} @@ -118,7 +118,7 @@ async def test_form_unknown_error( flow_id=result["flow_id"], user_input=user_input ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "unknown" @@ -135,7 +135,7 @@ async def test_homekit_cannot_connect( data=discovery_info, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -152,7 +152,7 @@ async def test_homekit_unknown_error( data=discovery_info, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "unknown" @@ -168,7 +168,7 @@ async def test_homekit_discovery( DOMAIN, context={CONF_SOURCE: SOURCE_HOMEKIT}, data=discovery_info ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "discovery_confirm" assert result["description_placeholders"] == {CONF_NAME: NAME_ROKUTV} @@ -177,7 +177,7 @@ async def test_homekit_discovery( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == NAME_ROKUTV assert "data" in result @@ -190,7 +190,7 @@ async def test_homekit_discovery( DOMAIN, context={CONF_SOURCE: SOURCE_HOMEKIT}, data=discovery_info ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -207,7 +207,7 @@ async def test_ssdp_cannot_connect( data=discovery_info, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -224,7 +224,7 @@ async def test_ssdp_unknown_error( data=discovery_info, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "unknown" @@ -239,7 +239,7 @@ async def test_ssdp_discovery( DOMAIN, context={CONF_SOURCE: SOURCE_SSDP}, data=discovery_info ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "discovery_confirm" assert result["description_placeholders"] == {CONF_NAME: UPNP_FRIENDLY_NAME} @@ -248,7 +248,7 @@ async def test_ssdp_discovery( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == UPNP_FRIENDLY_NAME assert result["data"] diff --git a/tests/components/romy/test_config_flow.py b/tests/components/romy/test_config_flow.py index 480a37fa068..a29f899ee9d 100644 --- a/tests/components/romy/test_config_flow.py +++ b/tests/components/romy/test_config_flow.py @@ -5,11 +5,12 @@ from unittest.mock import Mock, PropertyMock, patch from romy import RomyRobot -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components import zeroconf from homeassistant.components.romy.const import DOMAIN from homeassistant.const import CONF_HOST, CONF_PASSWORD from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType def _create_mocked_romy( @@ -56,7 +57,7 @@ async def test_show_user_form_robot_is_offline_and_locked(hass: HomeAssistant) - assert result1["errors"].get("host") == "cannot_connect" assert result1["step_id"] == "user" - assert result1["type"] == data_entry_flow.FlowResultType.FORM + assert result1["type"] is FlowResultType.FORM # Robot is locked with patch( @@ -68,7 +69,7 @@ async def test_show_user_form_robot_is_offline_and_locked(hass: HomeAssistant) - ) assert result2["step_id"] == "password" - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM # Robot is initialized and unlocked with patch( @@ -80,7 +81,7 @@ async def test_show_user_form_robot_is_offline_and_locked(hass: HomeAssistant) - ) assert "errors" not in result3 - assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY async def test_show_user_form_robot_unlock_with_password(hass: HomeAssistant) -> None: @@ -106,7 +107,7 @@ async def test_show_user_form_robot_unlock_with_password(hass: HomeAssistant) -> assert result2["errors"] == {"password": "invalid_auth"} assert result2["step_id"] == "password" - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM with patch( "homeassistant.components.romy.config_flow.romy.create_romy", @@ -118,7 +119,7 @@ async def test_show_user_form_robot_unlock_with_password(hass: HomeAssistant) -> assert result3["errors"] == {"password": "cannot_connect"} assert result3["step_id"] == "password" - assert result3["type"] == data_entry_flow.FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM with patch( "homeassistant.components.romy.config_flow.romy.create_romy", @@ -129,7 +130,7 @@ async def test_show_user_form_robot_unlock_with_password(hass: HomeAssistant) -> ) assert "errors" not in result4 - assert result4["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result4["type"] is FlowResultType.CREATE_ENTRY async def test_show_user_form_robot_reachable_again(hass: HomeAssistant) -> None: @@ -148,7 +149,7 @@ async def test_show_user_form_robot_reachable_again(hass: HomeAssistant) -> None assert result1["errors"].get("host") == "cannot_connect" assert result1["step_id"] == "user" - assert result1["type"] == data_entry_flow.FlowResultType.FORM + assert result1["type"] is FlowResultType.FORM # Robot is locked with patch( @@ -160,7 +161,7 @@ async def test_show_user_form_robot_reachable_again(hass: HomeAssistant) -> None ) assert "errors" not in result2 - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY DISCOVERY_INFO = zeroconf.ZeroconfServiceInfo( @@ -188,7 +189,7 @@ async def test_zero_conf_locked_interface_robot(hass: HomeAssistant) -> None: ) assert result1["step_id"] == "password" - assert result1["type"] == data_entry_flow.FlowResultType.FORM + assert result1["type"] is FlowResultType.FORM with patch( "homeassistant.components.romy.config_flow.romy.create_romy", @@ -199,7 +200,7 @@ async def test_zero_conf_locked_interface_robot(hass: HomeAssistant) -> None: ) assert "errors" not in result2 - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY async def test_zero_conf_uninitialized_robot(hass: HomeAssistant) -> None: @@ -216,7 +217,7 @@ async def test_zero_conf_uninitialized_robot(hass: HomeAssistant) -> None: ) assert result["reason"] == "cannot_connect" - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT async def test_zero_conf_unlocked_interface_robot(hass: HomeAssistant) -> None: @@ -233,7 +234,7 @@ async def test_zero_conf_unlocked_interface_robot(hass: HomeAssistant) -> None: ) assert result["step_id"] == "zeroconf_confirm" - 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"], @@ -246,4 +247,4 @@ async def test_zero_conf_unlocked_interface_robot(hass: HomeAssistant) -> None: assert result["result"] assert result["result"].unique_id == "aicu-aicgsbksisfapcjqmqjq" - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY diff --git a/tests/components/roon/test_config_flow.py b/tests/components/roon/test_config_flow.py index c31e689e05b..a9bae92f5e6 100644 --- a/tests/components/roon/test_config_flow.py +++ b/tests/components/roon/test_config_flow.py @@ -2,9 +2,10 @@ from unittest.mock import patch -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.roon.const import DOMAIN from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -194,7 +195,7 @@ async def test_duplicate_config(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"] == "already_configured" diff --git a/tests/components/rova/test_config_flow.py b/tests/components/rova/test_config_flow.py index 357cd9eb344..d9d1df3e188 100644 --- a/tests/components/rova/test_config_flow.py +++ b/tests/components/rova/test_config_flow.py @@ -5,7 +5,6 @@ from unittest.mock import MagicMock import pytest from requests.exceptions import ConnectTimeout, HTTPError -from homeassistant import data_entry_flow from homeassistant.components.rova.const import ( CONF_HOUSE_NUMBER, CONF_HOUSE_NUMBER_SUFFIX, @@ -14,6 +13,7 @@ from homeassistant.components.rova.const import ( ) from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_USER from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -27,7 +27,7 @@ async def test_user(hass: HomeAssistant, mock_rova: MagicMock) -> None: result = await hass.config_entries.flow.async_init( 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" # test with all information provided @@ -40,7 +40,7 @@ async def test_user(hass: HomeAssistant, mock_rova: MagicMock) -> None: CONF_HOUSE_NUMBER_SUFFIX: HOUSE_NUMBER_SUFFIX, }, ) - assert result.get("type") == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result.get("type") is FlowResultType.CREATE_ENTRY data = result.get("data") assert data @@ -69,7 +69,7 @@ async def test_error_if_not_rova_area( }, ) - assert result.get("type") == data_entry_flow.FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("errors") == {"base": "invalid_rova_area"} # now reset the return value and test if we can recover @@ -84,7 +84,7 @@ async def test_error_if_not_rova_area( }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == f"{ZIP_CODE} {HOUSE_NUMBER} {HOUSE_NUMBER_SUFFIX}" assert result["data"] == { CONF_ZIP_CODE: ZIP_CODE, @@ -114,7 +114,7 @@ async def test_abort_if_already_setup(hass: HomeAssistant) -> None: CONF_HOUSE_NUMBER_SUFFIX: HOUSE_NUMBER_SUFFIX, }, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -145,7 +145,7 @@ async def test_abort_if_api_throws_exception( CONF_HOUSE_NUMBER_SUFFIX: HOUSE_NUMBER_SUFFIX, }, ) - assert result.get("type") == data_entry_flow.FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("errors") == {"base": error} # now reset the side effect to see if we can recover @@ -160,7 +160,7 @@ async def test_abort_if_api_throws_exception( }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == f"{ZIP_CODE} {HOUSE_NUMBER} {HOUSE_NUMBER_SUFFIX}" assert result["data"] == { CONF_ZIP_CODE: ZIP_CODE, @@ -181,7 +181,7 @@ async def test_import(hass: HomeAssistant, mock_rova: MagicMock) -> None: }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == f"{ZIP_CODE} {HOUSE_NUMBER} {HOUSE_NUMBER_SUFFIX}" assert result["data"] == { CONF_ZIP_CODE: ZIP_CODE, @@ -215,7 +215,7 @@ async def test_import_already_configured( }, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -237,7 +237,7 @@ async def test_import_if_not_rova_area( }, ) - assert result.get("type") == data_entry_flow.FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "invalid_rova_area" @@ -266,5 +266,5 @@ async def test_import_connection_errors( }, ) - assert result.get("type") == data_entry_flow.FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == error diff --git a/tests/components/rpi_power/test_config_flow.py b/tests/components/rpi_power/test_config_flow.py index 1cb9f772d70..1bce51830f0 100644 --- a/tests/components/rpi_power/test_config_flow.py +++ b/tests/components/rpi_power/test_config_flow.py @@ -18,13 +18,13 @@ async def test_setup(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" assert not result["errors"] with patch(MODULE, return_value=MagicMock()): result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY async def test_not_supported(hass: HomeAssistant) -> None: @@ -36,7 +36,7 @@ async def test_not_supported(hass: HomeAssistant) -> None: with patch(MODULE, return_value=None): 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" @@ -47,7 +47,7 @@ async def test_onboarding(hass: HomeAssistant) -> None: DOMAIN, context={"source": "onboarding"}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY async def test_onboarding_not_supported(hass: HomeAssistant) -> None: @@ -57,5 +57,5 @@ async def test_onboarding_not_supported(hass: HomeAssistant) -> None: DOMAIN, context={"source": "onboarding"}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" diff --git a/tests/components/ruckus_unleashed/test_config_flow.py b/tests/components/ruckus_unleashed/test_config_flow.py index ae0ccb0a9b1..5bfe2d941d5 100644 --- a/tests/components/ruckus_unleashed/test_config_flow.py +++ b/tests/components/ruckus_unleashed/test_config_flow.py @@ -11,7 +11,7 @@ from aioruckus.const import ( ) from aioruckus.exceptions import AuthenticationError -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.ruckus_unleashed.const import ( API_SYS_SYSINFO, API_SYS_SYSINFO_SERIAL, @@ -19,6 +19,7 @@ from homeassistant.components.ruckus_unleashed.const import ( ) from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from homeassistant.util import utcnow from . import ( @@ -37,7 +38,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 ( @@ -54,7 +55,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"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == DEFAULT_TITLE assert result2["data"] == CONFIG @@ -73,7 +74,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None: CONFIG, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "invalid_auth"} @@ -96,7 +97,7 @@ async def test_form_user_reauth(hass: HomeAssistant) -> None: assert len(flows) == 1 assert "flow_id" in flows[0] - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -111,7 +112,7 @@ async def test_form_user_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" @@ -134,7 +135,7 @@ async def test_form_user_reauth_different_unique_id(hass: HomeAssistant) -> None assert len(flows) == 1 assert "flow_id" in flows[0] - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -151,7 +152,7 @@ async def test_form_user_reauth_different_unique_id(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": "invalid_host"} @@ -174,7 +175,7 @@ async def test_form_user_reauth_invalid_auth(hass: HomeAssistant) -> None: assert len(flows) == 1 assert "flow_id" in flows[0] - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -191,7 +192,7 @@ async def test_form_user_reauth_invalid_auth(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": "invalid_auth"} @@ -214,7 +215,7 @@ async def test_form_user_reauth_cannot_connect(hass: HomeAssistant) -> None: assert len(flows) == 1 assert "flow_id" in flows[0] - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -231,7 +232,7 @@ async def test_form_user_reauth_cannot_connect(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": "cannot_connect"} @@ -254,7 +255,7 @@ async def test_form_user_reauth_general_exception(hass: HomeAssistant) -> None: assert len(flows) == 1 assert "flow_id" in flows[0] - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -269,7 +270,7 @@ async def test_form_user_reauth_general_exception(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["step_id"] == "user" assert result2["errors"] == {"base": "unknown"} @@ -288,7 +289,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None: CONFIG, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -304,7 +305,7 @@ async def test_form_general_exception(hass: HomeAssistant) -> None: CONFIG, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "user" assert result2["errors"] == {"base": "unknown"} @@ -325,7 +326,7 @@ async def test_form_unexpected_response(hass: HomeAssistant) -> None: CONFIG, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -348,7 +349,7 @@ async def test_form_duplicate_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( @@ -356,5 +357,5 @@ async def test_form_duplicate_error(hass: HomeAssistant) -> None: CONFIG, ) - assert result2["type"] == data_entry_flow.FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" diff --git a/tests/components/ruuvi_gateway/test_config_flow.py b/tests/components/ruuvi_gateway/test_config_flow.py index e9e8446f8ac..c4ecf929f94 100644 --- a/tests/components/ruuvi_gateway/test_config_flow.py +++ b/tests/components/ruuvi_gateway/test_config_flow.py @@ -50,7 +50,7 @@ async def test_ok_setup(hass: HomeAssistant, init_data, init_context, entry) -> data=init_data, context=init_context, ) - assert init_result["type"] == FlowResultType.FORM + assert init_result["type"] is FlowResultType.FORM assert init_result["step_id"] == config_entries.SOURCE_USER assert init_result["errors"] is None @@ -61,7 +61,7 @@ async def test_ok_setup(hass: HomeAssistant, init_data, init_context, entry) -> entry, ) await hass.async_block_till_done() - assert config_result["type"] == FlowResultType.CREATE_ENTRY + assert config_result["type"] is FlowResultType.CREATE_ENTRY assert config_result["title"] == EXPECTED_TITLE assert config_result["data"] == entry assert config_result["context"]["unique_id"] == GATEWAY_MAC_LOWER @@ -80,7 +80,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None: BASE_DATA, ) - assert config_result["type"] == FlowResultType.FORM + assert config_result["type"] is FlowResultType.FORM assert config_result["errors"] == {"base": "invalid_auth"} # Check that we still can finalize setup @@ -90,7 +90,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None: BASE_DATA, ) await hass.async_block_till_done() - assert config_result["type"] == FlowResultType.CREATE_ENTRY + assert config_result["type"] is FlowResultType.CREATE_ENTRY assert config_result["title"] == EXPECTED_TITLE assert config_result["data"] == BASE_DATA assert config_result["context"]["unique_id"] == GATEWAY_MAC_LOWER @@ -109,7 +109,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None: BASE_DATA, ) - assert config_result["type"] == FlowResultType.FORM + assert config_result["type"] is FlowResultType.FORM assert config_result["errors"] == {"base": "cannot_connect"} # Check that we still can finalize setup @@ -119,7 +119,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None: BASE_DATA, ) await hass.async_block_till_done() - assert config_result["type"] == FlowResultType.CREATE_ENTRY + assert config_result["type"] is FlowResultType.CREATE_ENTRY assert config_result["title"] == EXPECTED_TITLE assert config_result["data"] == BASE_DATA assert config_result["context"]["unique_id"] == GATEWAY_MAC_LOWER @@ -138,7 +138,7 @@ async def test_form_unexpected(hass: HomeAssistant) -> None: BASE_DATA, ) - assert config_result["type"] == FlowResultType.FORM + assert config_result["type"] is FlowResultType.FORM assert config_result["errors"] == {"base": "unknown"} # Check that we still can finalize setup @@ -148,7 +148,7 @@ async def test_form_unexpected(hass: HomeAssistant) -> None: BASE_DATA, ) await hass.async_block_till_done() - assert config_result["type"] == FlowResultType.CREATE_ENTRY + assert config_result["type"] is FlowResultType.CREATE_ENTRY assert config_result["title"] == EXPECTED_TITLE assert config_result["data"] == BASE_DATA assert config_result["context"]["unique_id"] == GATEWAY_MAC_LOWER diff --git a/tests/components/ruuvitag_ble/test_config_flow.py b/tests/components/ruuvitag_ble/test_config_flow.py index 6f668b0168b..b6c79f1de0e 100644 --- a/tests/components/ruuvitag_ble/test_config_flow.py +++ b/tests/components/ruuvitag_ble/test_config_flow.py @@ -26,7 +26,7 @@ async def test_async_step_bluetooth_valid_device(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=RUUVITAG_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch( "homeassistant.components.ruuvitag_ble.async_setup_entry", return_value=True @@ -34,7 +34,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"] == CONFIGURED_NAME assert result2["result"].unique_id == RUUVITAG_SERVICE_INFO.address @@ -46,7 +46,7 @@ async def test_async_step_bluetooth_not_ruuvitag(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=NOT_RUUVITAG_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_supported" @@ -56,7 +56,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" @@ -70,7 +70,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.ruuvitag_ble.async_setup_entry", return_value=True @@ -79,7 +79,7 @@ async def test_async_step_user_with_found_devices(hass: HomeAssistant) -> None: result["flow_id"], user_input={"address": RUUVITAG_SERVICE_INFO.address}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == CONFIGURED_NAME assert result2["result"].unique_id == RUUVITAG_SERVICE_INFO.address @@ -94,7 +94,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( @@ -110,7 +110,7 @@ async def test_async_step_user_device_added_between_steps(hass: HomeAssistant) - result["flow_id"], user_input={"address": RUUVITAG_SERVICE_INFO.address}, ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" @@ -132,7 +132,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" @@ -149,7 +149,7 @@ async def test_async_step_bluetooth_devices_already_setup(hass: HomeAssistant) - context={"source": config_entries.SOURCE_BLUETOOTH}, data=RUUVITAG_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -160,7 +160,7 @@ async def test_async_step_bluetooth_already_in_progress(hass: HomeAssistant) -> context={"source": config_entries.SOURCE_BLUETOOTH}, data=RUUVITAG_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( @@ -168,7 +168,7 @@ async def test_async_step_bluetooth_already_in_progress(hass: HomeAssistant) -> context={"source": config_entries.SOURCE_BLUETOOTH}, data=RUUVITAG_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_in_progress" @@ -181,7 +181,7 @@ async def test_async_step_user_takes_precedence_over_discovery( context={"source": config_entries.SOURCE_BLUETOOTH}, data=RUUVITAG_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch( @@ -192,7 +192,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.ruuvitag_ble.async_setup_entry", return_value=True @@ -201,7 +201,7 @@ async def test_async_step_user_takes_precedence_over_discovery( result["flow_id"], user_input={"address": RUUVITAG_SERVICE_INFO.address}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == CONFIGURED_NAME assert result2["data"] == {} assert result2["result"].unique_id == RUUVITAG_SERVICE_INFO.address diff --git a/tests/components/rympro/test_config_flow.py b/tests/components/rympro/test_config_flow.py index f5591d8e0c7..05078eb9a6c 100644 --- a/tests/components/rympro/test_config_flow.py +++ b/tests/components/rympro/test_config_flow.py @@ -41,7 +41,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 ( @@ -67,7 +67,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_DATA[CONF_EMAIL] assert result2["data"] == TEST_DATA assert len(mock_setup_entry.mock_calls) == 1 @@ -99,7 +99,7 @@ async def test_login_error(hass: HomeAssistant, exception, error) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": error} with ( @@ -125,7 +125,7 @@ async def test_login_error(hass: HomeAssistant, exception, error) -> None: ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == TEST_DATA[CONF_EMAIL] assert result3["data"] == TEST_DATA assert len(mock_setup_entry.mock_calls) == 1 @@ -156,7 +156,7 @@ async def test_form_already_exists(hass: HomeAssistant, config_entry) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" diff --git a/tests/components/sabnzbd/test_config_flow.py b/tests/components/sabnzbd/test_config_flow.py index 2da1c7c87db..7f5394902b4 100644 --- a/tests/components/sabnzbd/test_config_flow.py +++ b/tests/components/sabnzbd/test_config_flow.py @@ -5,7 +5,7 @@ from unittest.mock import AsyncMock, patch from pysabnzbd import SabnzbdApiException import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.sabnzbd import DOMAIN from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_USER from homeassistant.const import ( @@ -41,7 +41,7 @@ async def test_create_entry(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> 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 patch( @@ -54,7 +54,7 @@ async def test_create_entry(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> ) 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"] == "edc3eee7330e" assert result2["data"] == { CONF_API_KEY: "edc3eee7330e4fdda04489e3fbc283d0", @@ -91,7 +91,7 @@ async def test_import_flow(hass: HomeAssistant) -> None: data=VALID_CONFIG_OLD, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "edc3eee7330e" assert result["data"][CONF_NAME] == "Sabnzbd" assert result["data"][CONF_API_KEY] == "edc3eee7330e4fdda04489e3fbc283d0" diff --git a/tests/components/samsungtv/test_config_flow.py b/tests/components/samsungtv/test_config_flow.py index a300c28b945..8ce1467b451 100644 --- a/tests/components/samsungtv/test_config_flow.py +++ b/tests/components/samsungtv/test_config_flow.py @@ -358,7 +358,7 @@ async def test_user_legacy_missing_auth(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER}, data=MOCK_USER_DATA ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "pairing" assert result["errors"] == {"base": "auth_missing"} @@ -370,7 +370,7 @@ async def test_user_legacy_missing_auth(hass: HomeAssistant) -> None: result2 = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == RESULT_CANNOT_CONNECT @@ -451,7 +451,7 @@ async def test_user_websocket_auth_retry(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER}, data=MOCK_USER_DATA ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "pairing" assert result["errors"] == {"base": "auth_missing"} with ( @@ -466,7 +466,7 @@ async def test_user_websocket_auth_retry(hass: HomeAssistant) -> None: 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"] == "Living Room (82GXARRS)" assert result["data"][CONF_HOST] == "fake_host" assert result["data"][CONF_NAME] == "Living Room" @@ -561,7 +561,7 @@ async def test_ssdp_legacy_not_remote_control_receiver_udn( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_SSDP}, data=data ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == RESULT_NOT_SUPPORTED @@ -607,7 +607,7 @@ async def test_ssdp_legacy_missing_auth(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "pairing" assert result["errors"] == {"base": "auth_missing"} @@ -616,7 +616,7 @@ async def test_ssdp_legacy_missing_auth(hass: HomeAssistant) -> None: result["flow_id"], user_input={} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "fake_model" assert result["data"][CONF_HOST] == "fake_host" assert result["data"][CONF_NAME] == "fake_model" @@ -636,7 +636,7 @@ async def test_ssdp_legacy_not_supported(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_SSDP}, data=MOCK_SSDP_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == RESULT_NOT_SUPPORTED @@ -768,7 +768,7 @@ async def test_ssdp_encrypted_websocket_not_supported( context={"source": config_entries.SOURCE_SSDP}, data=MOCK_SSDP_DATA_RENDERING_CONTROL_ST, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == RESULT_NOT_SUPPORTED @@ -1176,7 +1176,7 @@ async def test_autodetect_auth_missing(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER}, data=MOCK_USER_DATA ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "pairing" assert result["errors"] == {"base": "auth_missing"} @@ -1191,7 +1191,7 @@ async def test_autodetect_auth_missing(hass: HomeAssistant) -> None: {}, ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == RESULT_CANNOT_CONNECT @@ -2042,7 +2042,7 @@ async def test_ssdp_update_mac(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER}, data=MOCK_USER_DATA ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY entry = result["result"] assert entry.data[CONF_MANUFACTURER] == DEFAULT_MANUFACTURER assert entry.data[CONF_MODEL] == "fake_model" @@ -2059,7 +2059,7 @@ async def test_ssdp_update_mac(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_SSDP}, data=MOCK_SSDP_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == RESULT_ALREADY_CONFIGURED # ensure mac wasn't updated with "none" @@ -2076,7 +2076,7 @@ async def test_ssdp_update_mac(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_SSDP}, data=MOCK_SSDP_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == RESULT_ALREADY_CONFIGURED # ensure mac was updated with new wifiMac value diff --git a/tests/components/schlage/test_config_flow.py b/tests/components/schlage/test_config_flow.py index 118ae44d15b..15ef3858c0c 100644 --- a/tests/components/schlage/test_config_flow.py +++ b/tests/components/schlage/test_config_flow.py @@ -22,7 +22,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["errors"] == {} result2 = await hass.config_entries.flow.async_configure( @@ -35,7 +35,7 @@ async def test_form( await hass.async_block_till_done() mock_pyschlage_auth.authenticate.assert_called_once_with() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "test-username" assert result2["data"] == { "username": "test-username", @@ -60,7 +60,7 @@ async def test_form_invalid_auth( "password": "test-password", }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "invalid_auth"} @@ -79,7 +79,7 @@ async def test_form_unknown(hass: HomeAssistant, mock_pyschlage_auth: Mock) -> N }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} @@ -105,7 +105,7 @@ async def test_reauth( await hass.async_block_till_done() mock_pyschlage_auth.authenticate.assert_called_once_with() - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "reauth_successful" assert mock_added_config_entry.data == { "username": "asdf@asdf.com", @@ -138,7 +138,7 @@ async def test_reauth_invalid_auth( await hass.async_block_till_done() mock_pyschlage_auth.authenticate.assert_called_once_with() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "invalid_auth"} @@ -165,7 +165,7 @@ async def test_reauth_wrong_account( await hass.async_block_till_done() mock_pyschlage_auth.authenticate.assert_called_once_with() - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "wrong_account" assert mock_added_config_entry.data == { "username": "asdf@asdf.com", diff --git a/tests/components/scrape/test_config_flow.py b/tests/components/scrape/test_config_flow.py index 8e281e148fc..17a527d2975 100644 --- a/tests/components/scrape/test_config_flow.py +++ b/tests/components/scrape/test_config_flow.py @@ -49,7 +49,7 @@ async def test_form( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["step_id"] == "user" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM with patch( "homeassistant.components.rest.RestData", @@ -75,7 +75,7 @@ async def test_form( ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["version"] == 1 assert result3["options"] == { CONF_RESOURCE: "https://www.home-assistant.io", @@ -106,7 +106,7 @@ async def test_form_with_post( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["step_id"] == "user" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM with patch( "homeassistant.components.rest.RestData", @@ -133,7 +133,7 @@ async def test_form_with_post( ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["version"] == 1 assert result3["options"] == { CONF_RESOURCE: "https://www.home-assistant.io", @@ -165,7 +165,7 @@ async def test_flow_fails( 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 patch( @@ -224,7 +224,7 @@ async def test_flow_fails( ) await hass.async_block_till_done() - assert result4["type"] == FlowResultType.CREATE_ENTRY + assert result4["type"] is FlowResultType.CREATE_ENTRY assert result4["title"] == "https://www.home-assistant.io" assert result4["options"] == { CONF_RESOURCE: "https://www.home-assistant.io", @@ -253,7 +253,7 @@ async def test_options_resource_flow( result = await hass.config_entries.options.async_init(loaded_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( @@ -261,7 +261,7 @@ async def test_options_resource_flow( {"next_step_id": "resource"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "resource" mocker = MockRestData("test_scrape_sensor2") @@ -280,7 +280,7 @@ async def test_options_resource_flow( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { CONF_RESOURCE: "https://www.home-assistant.io", CONF_METHOD: "GET", @@ -319,7 +319,7 @@ async def test_options_add_remove_sensor_flow( result = await hass.config_entries.options.async_init(loaded_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( @@ -327,7 +327,7 @@ async def test_options_add_remove_sensor_flow( {"next_step_id": "add_sensor"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "add_sensor" mocker = MockRestData("test_scrape_sensor2") @@ -348,7 +348,7 @@ async def test_options_add_remove_sensor_flow( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { CONF_RESOURCE: "https://www.home-assistant.io", CONF_METHOD: "GET", @@ -387,7 +387,7 @@ async def test_options_add_remove_sensor_flow( result = await hass.config_entries.options.async_init(loaded_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( @@ -395,7 +395,7 @@ async def test_options_add_remove_sensor_flow( {"next_step_id": "remove_sensor"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "remove_sensor" mocker = MockRestData("test_scrape_sensor2") @@ -408,7 +408,7 @@ async def test_options_add_remove_sensor_flow( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { CONF_RESOURCE: "https://www.home-assistant.io", CONF_METHOD: "GET", @@ -445,7 +445,7 @@ async def test_options_edit_sensor_flow( result = await hass.config_entries.options.async_init(loaded_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( @@ -453,7 +453,7 @@ async def test_options_edit_sensor_flow( {"next_step_id": "select_edit_sensor"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "select_edit_sensor" result = await hass.config_entries.options.async_configure( @@ -461,7 +461,7 @@ async def test_options_edit_sensor_flow( {"index": "0"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "edit_sensor" mocker = MockRestData("test_scrape_sensor2") @@ -475,7 +475,7 @@ async def test_options_edit_sensor_flow( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { CONF_RESOURCE: "https://www.home-assistant.io", CONF_METHOD: "GET", @@ -529,21 +529,21 @@ async def test_sensor_options_add_device_class( entry.add_to_hass(hass) result = await hass.config_entries.options.async_init(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_sensor"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "select_edit_sensor" result = await hass.config_entries.options.async_configure( result["flow_id"], {"index": "0"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "edit_sensor" result = await hass.config_entries.options.async_configure( @@ -559,7 +559,7 @@ async def test_sensor_options_add_device_class( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { CONF_RESOURCE: "https://www.home-assistant.io", CONF_METHOD: "GET", @@ -611,21 +611,21 @@ async def test_sensor_options_remove_device_class( entry.add_to_hass(hass) result = await hass.config_entries.options.async_init(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_sensor"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "select_edit_sensor" result = await hass.config_entries.options.async_configure( result["flow_id"], {"index": "0"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "edit_sensor" result = await hass.config_entries.options.async_configure( @@ -638,7 +638,7 @@ async def test_sensor_options_remove_device_class( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { CONF_RESOURCE: "https://www.home-assistant.io", CONF_METHOD: "GET", diff --git a/tests/components/season/test_config_flow.py b/tests/components/season/test_config_flow.py index e0a140f7136..2bc6a780c1b 100644 --- a/tests/components/season/test_config_flow.py +++ b/tests/components/season/test_config_flow.py @@ -20,7 +20,7 @@ async def test_full_user_flow( 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( @@ -28,7 +28,7 @@ async def test_full_user_flow( user_input={CONF_TYPE: TYPE_ASTRONOMICAL}, ) - assert result2.get("type") == FlowResultType.CREATE_ENTRY + assert result2.get("type") is FlowResultType.CREATE_ENTRY assert result2.get("title") == "Season" assert result2.get("data") == {CONF_TYPE: TYPE_ASTRONOMICAL} @@ -44,5 +44,5 @@ async def test_single_instance_allowed( DOMAIN, context={"source": SOURCE_USER}, data={CONF_TYPE: TYPE_ASTRONOMICAL} ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "already_configured" diff --git a/tests/components/sensibo/test_config_flow.py b/tests/components/sensibo/test_config_flow.py index 3b1117f0908..e994402b09f 100644 --- a/tests/components/sensibo/test_config_flow.py +++ b/tests/components/sensibo/test_config_flow.py @@ -26,7 +26,7 @@ async def test_form(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 assert result["errors"] == {} with ( @@ -51,7 +51,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["version"] == 2 assert result2["data"] == { "api_key": "1234567890", @@ -78,7 +78,7 @@ async def test_flow_fails( 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 patch( @@ -115,7 +115,7 @@ async def test_flow_fails( }, ) - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == "Sensibo" assert result3["data"] == { "api_key": "1234567891", @@ -129,7 +129,7 @@ async def test_flow_get_no_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"] == config_entries.SOURCE_USER with ( @@ -159,7 +159,7 @@ async def test_flow_get_no_username(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"] == config_entries.SOURCE_USER with ( @@ -202,7 +202,7 @@ async def test_reauth_flow(hass: HomeAssistant) -> None: data=entry.data, ) assert result["step_id"] == "reauth_confirm" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with ( @@ -225,7 +225,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 entry.data == {"api_key": "1234567891"} @@ -275,7 +275,7 @@ async def test_reauth_flow_error( await hass.async_block_till_done() assert result2["step_id"] == "reauth_confirm" - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": p_error} with ( @@ -298,7 +298,7 @@ async def test_reauth_flow_error( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "reauth_successful" assert entry.data == {"api_key": "1234567891"} @@ -348,7 +348,7 @@ async def test_flow_reauth_no_username_or_device( data=entry.data, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" with ( @@ -370,5 +370,5 @@ async def test_flow_reauth_no_username_or_device( await hass.async_block_till_done() assert result2["step_id"] == "reauth_confirm" - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": p_error} diff --git a/tests/components/sensirion_ble/test_config_flow.py b/tests/components/sensirion_ble/test_config_flow.py index e93d060fd3e..00e92d37118 100644 --- a/tests/components/sensirion_ble/test_config_flow.py +++ b/tests/components/sensirion_ble/test_config_flow.py @@ -30,7 +30,7 @@ async def test_async_step_bluetooth_valid_device(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=SENSIRION_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch( "homeassistant.components.sensirion_ble.async_setup_entry", return_value=True @@ -38,7 +38,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"] == CONFIGURED_NAME assert result2["result"].unique_id == SENSIRION_SERVICE_INFO.address @@ -50,7 +50,7 @@ async def test_async_step_bluetooth_not_sensirion(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=NOT_SENSIRION_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_supported" @@ -60,7 +60,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" @@ -74,7 +74,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.sensirion_ble.async_setup_entry", return_value=True @@ -83,7 +83,7 @@ async def test_async_step_user_with_found_devices(hass: HomeAssistant) -> None: result["flow_id"], user_input={"address": SENSIRION_SERVICE_INFO.address}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == CONFIGURED_NAME assert result2["result"].unique_id == SENSIRION_SERVICE_INFO.address @@ -98,7 +98,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( @@ -114,7 +114,7 @@ async def test_async_step_user_device_added_between_steps(hass: HomeAssistant) - result["flow_id"], user_input={"address": SENSIRION_SERVICE_INFO.address}, ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" @@ -136,7 +136,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" @@ -153,7 +153,7 @@ async def test_async_step_bluetooth_devices_already_setup(hass: HomeAssistant) - context={"source": config_entries.SOURCE_BLUETOOTH}, data=SENSIRION_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -164,7 +164,7 @@ async def test_async_step_bluetooth_already_in_progress(hass: HomeAssistant) -> context={"source": config_entries.SOURCE_BLUETOOTH}, data=SENSIRION_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( @@ -172,7 +172,7 @@ async def test_async_step_bluetooth_already_in_progress(hass: HomeAssistant) -> context={"source": config_entries.SOURCE_BLUETOOTH}, data=SENSIRION_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_in_progress" @@ -185,7 +185,7 @@ async def test_async_step_user_takes_precedence_over_discovery( context={"source": config_entries.SOURCE_BLUETOOTH}, data=SENSIRION_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch( @@ -196,7 +196,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.sensirion_ble.async_setup_entry", return_value=True @@ -205,7 +205,7 @@ async def test_async_step_user_takes_precedence_over_discovery( result["flow_id"], user_input={"address": SENSIRION_SERVICE_INFO.address}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == CONFIGURED_NAME assert result2["data"] == {} assert result2["result"].unique_id == SENSIRION_SERVICE_INFO.address diff --git a/tests/components/sensorpro/test_config_flow.py b/tests/components/sensorpro/test_config_flow.py index 1558e774f21..05be86d5209 100644 --- a/tests/components/sensorpro/test_config_flow.py +++ b/tests/components/sensorpro/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=SENSORPRO_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch( "homeassistant.components.sensorpro.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"] == "T201 EEFF" assert result2["data"] == {} assert result2["result"].unique_id == "aa:bb:cc:dd:ee:ff" @@ -40,7 +40,7 @@ async def test_async_step_bluetooth_not_sensorpro(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=NOT_SENSORPRO_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.sensorpro.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": "aa:bb:cc:dd:ee:ff"}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "T201 EEFF" assert result2["data"] == {} assert result2["result"].unique_id == "aa:bb:cc:dd:ee:ff" @@ -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": "aa:bb:cc:dd:ee:ff"}, ) - 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=SENSORPRO_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=SENSORPRO_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=SENSORPRO_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=SENSORPRO_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.sensorpro.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": "aa:bb:cc:dd:ee:ff"}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "T201 EEFF" assert result2["data"] == {} assert result2["result"].unique_id == "aa:bb:cc:dd:ee:ff" diff --git a/tests/components/sensorpush/test_config_flow.py b/tests/components/sensorpush/test_config_flow.py index abbe04178c2..7e87dd1c6b8 100644 --- a/tests/components/sensorpush/test_config_flow.py +++ b/tests/components/sensorpush/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=HTPWX_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch( "homeassistant.components.sensorpush.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"] == "HTP.xw F4D" assert result2["data"] == {} assert result2["result"].unique_id == "4125DDBA-2774-4851-9889-6AADDD4CAC3D" @@ -40,7 +40,7 @@ async def test_async_step_bluetooth_not_sensorpush(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=NOT_SENSOR_PUSH_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.sensorpush.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": "61DE521B-F0BF-9F44-64D4-75BBE1738105"}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "HT.w 0CA1" assert result2["data"] == {} assert result2["result"].unique_id == "61DE521B-F0BF-9F44-64D4-75BBE1738105" @@ -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": "61DE521B-F0BF-9F44-64D4-75BBE1738105"}, ) - 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=HTW_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=HTW_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=HTW_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=HTW_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.sensorpush.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": "61DE521B-F0BF-9F44-64D4-75BBE1738105"}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "HT.w 0CA1" assert result2["data"] == {} assert result2["result"].unique_id == "61DE521B-F0BF-9F44-64D4-75BBE1738105" diff --git a/tests/components/sentry/test_config_flow.py b/tests/components/sentry/test_config_flow.py index 0c3fc45b68b..f3136b639de 100644 --- a/tests/components/sentry/test_config_flow.py +++ b/tests/components/sentry/test_config_flow.py @@ -29,7 +29,7 @@ async def test_full_user_flow_implementation(hass: HomeAssistant) -> None: 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("errors") == {} with ( @@ -61,7 +61,7 @@ async def test_integration_already_exists(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "single_instance_allowed" @@ -80,7 +80,7 @@ async def test_user_flow_bad_dsn(hass: HomeAssistant) -> None: {"dsn": "foo"}, ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("errors") == {"base": "bad_dsn"} @@ -99,7 +99,7 @@ async def test_user_flow_unknown_exception(hass: HomeAssistant) -> None: {"dsn": "foo"}, ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("errors") == {"base": "unknown"} @@ -117,7 +117,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: result = await hass.config_entries.options.async_init(entry.entry_id) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "init" result = await hass.config_entries.options.async_configure( @@ -134,7 +134,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: }, ) - assert result.get("type") == FlowResultType.CREATE_ENTRY + assert result.get("type") is FlowResultType.CREATE_ENTRY assert result.get("data") == { CONF_ENVIRONMENT: "Test", CONF_EVENT_CUSTOM_COMPONENTS: True, diff --git a/tests/components/seventeentrack/test_config_flow.py b/tests/components/seventeentrack/test_config_flow.py index ae48fb6c792..380146ed276 100644 --- a/tests/components/seventeentrack/test_config_flow.py +++ b/tests/components/seventeentrack/test_config_flow.py @@ -5,7 +5,7 @@ from unittest.mock import AsyncMock from py17track.errors import SeventeenTrackError import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.seventeentrack import DOMAIN from homeassistant.components.seventeentrack.const import ( CONF_SHOW_ARCHIVED, @@ -38,7 +38,7 @@ async def test_create_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["errors"] == {} result2 = await hass.config_entries.flow.async_configure( @@ -47,7 +47,7 @@ async def test_create_entry( ) 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"] == "someemail@gmail.com" assert result2["data"] == { CONF_PASSWORD: "edc3eee7330e4fdda04489e3fbc283d0", @@ -97,7 +97,7 @@ async def test_flow_fails( ) 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"] == "someemail@gmail.com" assert result["data"] == { CONF_PASSWORD: "edc3eee7330e4fdda04489e3fbc283d0", @@ -113,7 +113,7 @@ async def test_import_flow(hass: HomeAssistant, mock_seventeentrack: AsyncMock) data=VALID_CONFIG_OLD, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "someemail@gmail.com" assert result["data"][CONF_USERNAME] == "someemail@gmail.com" assert result["data"][CONF_PASSWORD] == "edc3eee7330e4fdda04489e3fbc283d0" @@ -150,7 +150,7 @@ async def test_import_flow_cannot_connect_error( data=VALID_CONFIG_OLD, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == error @@ -170,7 +170,7 @@ async def test_option_flow(hass: HomeAssistant, mock_seventeentrack: AsyncMock) await hass.async_block_till_done() 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( @@ -178,7 +178,7 @@ async def test_option_flow(hass: HomeAssistant, mock_seventeentrack: AsyncMock) user_input={CONF_SHOW_ARCHIVED: True, CONF_SHOW_DELIVERED: False}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_SHOW_ARCHIVED] assert not result["data"][CONF_SHOW_DELIVERED] @@ -204,5 +204,5 @@ async def test_import_flow_already_configured( ) await hass.async_block_till_done() - assert result_aborted["type"] == data_entry_flow.FlowResultType.ABORT + assert result_aborted["type"] is FlowResultType.ABORT assert result_aborted["reason"] == "already_configured" diff --git a/tests/components/sfr_box/test_config_flow.py b/tests/components/sfr_box/test_config_flow.py index 282d7dbbb4c..08c12e9817b 100644 --- a/tests/components/sfr_box/test_config_flow.py +++ b/tests/components/sfr_box/test_config_flow.py @@ -7,11 +7,12 @@ import pytest from sfrbox_api.exceptions import SFRBoxAuthenticationError, SFRBoxError from sfrbox_api.models import SystemInfo -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.sfr_box.const import DOMAIN from homeassistant.config_entries import ConfigEntry 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 load_fixture @@ -25,7 +26,7 @@ async def test_config_flow_skip_auth( 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( @@ -39,7 +40,7 @@ async def test_config_flow_skip_auth( }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} with patch( @@ -55,7 +56,7 @@ async def test_config_flow_skip_auth( }, ) - assert result["type"] == data_entry_flow.FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "choose_auth" result = await hass.config_entries.flow.async_configure( @@ -63,7 +64,7 @@ async def test_config_flow_skip_auth( {"next_step_id": "skip_auth"}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "SFR Box" assert result["data"] == {CONF_HOST: "192.168.0.1"} @@ -77,7 +78,7 @@ async def test_config_flow_with_auth( 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( @@ -93,7 +94,7 @@ async def test_config_flow_with_auth( }, ) - assert result["type"] == data_entry_flow.FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "choose_auth" result = await hass.config_entries.flow.async_configure( @@ -113,7 +114,7 @@ async def test_config_flow_with_auth( }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "invalid_auth"} with patch("homeassistant.components.sfr_box.config_flow.SFRBox.authenticate"): @@ -125,7 +126,7 @@ async def test_config_flow_with_auth( }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "SFR Box" assert result["data"] == { CONF_HOST: "192.168.0.1", @@ -146,7 +147,7 @@ async def test_config_flow_duplicate_host( 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"] == {} system_info = SystemInfo(**json.loads(load_fixture("system_getInfo.json", DOMAIN))) @@ -163,7 +164,7 @@ async def test_config_flow_duplicate_host( }, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" await hass.async_block_till_done() @@ -180,7 +181,7 @@ async def test_config_flow_duplicate_mac( 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"] == {} system_info = SystemInfo(**json.loads(load_fixture("system_getInfo.json", DOMAIN))) @@ -195,7 +196,7 @@ async def test_config_flow_duplicate_mac( }, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" await hass.async_block_till_done() @@ -216,7 +217,7 @@ async def test_reauth(hass: HomeAssistant, config_entry_with_auth: ConfigEntry) data=config_entry_with_auth.data, ) - assert result.get("type") == data_entry_flow.FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("errors") == {} # Failed credentials @@ -232,7 +233,7 @@ async def test_reauth(hass: HomeAssistant, config_entry_with_auth: ConfigEntry) }, ) - assert result.get("type") == data_entry_flow.FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("errors") == {"base": "invalid_auth"} # Valid credentials @@ -245,5 +246,5 @@ async def test_reauth(hass: HomeAssistant, config_entry_with_auth: ConfigEntry) }, ) - assert result.get("type") == data_entry_flow.FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "reauth_successful" diff --git a/tests/components/shelly/test_config_flow.py b/tests/components/shelly/test_config_flow.py index 1e7bbc01d6d..f2b0736f867 100644 --- a/tests/components/shelly/test_config_flow.py +++ b/tests/components/shelly/test_config_flow.py @@ -15,7 +15,7 @@ from aioshelly.exceptions import ( ) import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components import zeroconf from homeassistant.components.shelly import config_flow from homeassistant.components.shelly.const import ( @@ -26,6 +26,7 @@ from homeassistant.components.shelly.const import ( from homeassistant.components.shelly.coordinator import ENTRY_RELOAD_COOLDOWN from homeassistant.config_entries import SOURCE_REAUTH from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from homeassistant.setup import async_setup_component from homeassistant.util import dt as dt_util @@ -74,7 +75,7 @@ async def test_form( 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 ( @@ -102,7 +103,7 @@ async def test_form( ) 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 name" assert result2["data"] == { "host": "1.1.1.1", @@ -123,7 +124,7 @@ async def test_form_gen1_custom_port( 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 ( @@ -141,7 +142,7 @@ async def test_form_gen1_custom_port( {"host": "1.1.1.1", "port": "1100"}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"]["base"] == "custom_port_not_supported" @@ -181,7 +182,7 @@ async def test_form_auth( 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( @@ -193,7 +194,7 @@ async def test_form_auth( {"host": "1.1.1.1"}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result["errors"] == {} with ( @@ -210,7 +211,7 @@ async def test_form_auth( ) 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"] == "Test name" assert result3["data"] == { "host": "1.1.1.1", @@ -246,7 +247,7 @@ async def test_form_errors_get_info( {"host": "1.1.1.1"}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": base_error} @@ -267,7 +268,7 @@ async def test_form_missing_model_key( {"host": "1.1.1.1"}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "firmware_not_fully_provisioned"} @@ -278,7 +279,7 @@ async def test_form_missing_model_key_auth_enabled( 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( @@ -290,14 +291,14 @@ async def test_form_missing_model_key_auth_enabled( {"host": "1.1.1.1"}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result["errors"] == {} monkeypatch.setattr(mock_rpc_device, "shelly", {"gen": 2}) result3 = await hass.config_entries.flow.async_configure( result2["flow_id"], {"password": "1234"} ) - assert result3["type"] == data_entry_flow.FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["errors"] == {"base": "firmware_not_fully_provisioned"} @@ -317,14 +318,14 @@ async def test_form_missing_model_key_zeroconf( data=DISCOVERY_INFO, context={"source": config_entries.SOURCE_ZEROCONF}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "firmware_not_fully_provisioned"} result2 = await hass.config_entries.flow.async_configure( result["flow_id"], {}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "firmware_not_fully_provisioned"} @@ -357,7 +358,7 @@ async def test_form_errors_test_connection( {"host": "1.1.1.1"}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": base_error} @@ -382,7 +383,7 @@ async def test_form_already_configured(hass: HomeAssistant) -> None: {"host": "1.1.1.1"}, ) - assert result2["type"] == data_entry_flow.FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" # Test config entry got updated with latest IP @@ -424,7 +425,7 @@ async def test_user_setup_ignored_device( {"host": "1.1.1.1"}, ) - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY # Test config entry got updated with latest IP assert entry.data["host"] == "1.1.1.1" @@ -447,7 +448,7 @@ async def test_form_firmware_unsupported(hass: HomeAssistant) -> None: {"host": "1.1.1.1"}, ) - assert result2["type"] == data_entry_flow.FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "unsupported_firmware" @@ -484,7 +485,7 @@ async def test_form_auth_errors_test_connection_gen1( result2["flow_id"], {"username": "test username", "password": "test password"}, ) - assert result3["type"] == data_entry_flow.FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["errors"] == {"base": base_error} @@ -520,7 +521,7 @@ async def test_form_auth_errors_test_connection_gen2( result3 = await hass.config_entries.flow.async_configure( result2["flow_id"], {"password": "test password"} ) - assert result3["type"] == data_entry_flow.FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["errors"] == {"base": base_error} @@ -562,7 +563,7 @@ async def test_zeroconf( data=DISCOVERY_INFO, context={"source": config_entries.SOURCE_ZEROCONF}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} context = next( flow["context"] @@ -586,7 +587,7 @@ async def test_zeroconf( ) 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 name" assert result2["data"] == { "host": "1.1.1.1", @@ -621,7 +622,7 @@ async def test_zeroconf_sleeping_device( data=DISCOVERY_INFO, context={"source": config_entries.SOURCE_ZEROCONF}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} context = next( flow["context"] @@ -644,7 +645,7 @@ async def test_zeroconf_sleeping_device( ) 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 name" assert result2["data"] == { "host": "1.1.1.1", @@ -678,7 +679,7 @@ async def test_zeroconf_sleeping_device_error(hass: HomeAssistant) -> None: data=DISCOVERY_INFO, context={"source": config_entries.SOURCE_ZEROCONF}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -699,7 +700,7 @@ async def test_zeroconf_already_configured(hass: HomeAssistant) -> None: data=DISCOVERY_INFO, context={"source": config_entries.SOURCE_ZEROCONF}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" # Test config entry got updated with latest IP @@ -726,7 +727,7 @@ async def test_zeroconf_ignored(hass: HomeAssistant) -> None: data=DISCOVERY_INFO, context={"source": config_entries.SOURCE_ZEROCONF}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -749,7 +750,7 @@ async def test_zeroconf_with_wifi_ap_ip(hass: HomeAssistant) -> None: ), context={"source": config_entries.SOURCE_ZEROCONF}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" # Test config entry was not updated with the wifi ap ip @@ -768,7 +769,7 @@ async def test_zeroconf_firmware_unsupported(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_ZEROCONF}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "unsupported_firmware" @@ -783,7 +784,7 @@ async def test_zeroconf_cannot_connect(hass: HomeAssistant) -> None: data=DISCOVERY_INFO, context={"source": config_entries.SOURCE_ZEROCONF}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -801,7 +802,7 @@ async def test_zeroconf_require_auth( data=DISCOVERY_INFO, context={"source": config_entries.SOURCE_ZEROCONF}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with ( @@ -819,7 +820,7 @@ async def test_zeroconf_require_auth( ) 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 name" assert result2["data"] == { "host": "1.1.1.1", @@ -865,7 +866,7 @@ async def test_reauth_successful( data=entry.data, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" result = await hass.config_entries.flow.async_configure( @@ -873,7 +874,7 @@ async def test_reauth_successful( user_input=user_input, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" @@ -914,7 +915,7 @@ async def test_reauth_unsuccessful( data=entry.data, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" result = await hass.config_entries.flow.async_configure( @@ -922,7 +923,7 @@ async def test_reauth_unsuccessful( user_input=user_input, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_unsuccessful" @@ -947,7 +948,7 @@ async def test_reauth_get_info_error(hass: HomeAssistant, error: Exception) -> N data=entry.data, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" result = await hass.config_entries.flow.async_configure( @@ -955,7 +956,7 @@ async def test_reauth_get_info_error(hass: HomeAssistant, error: Exception) -> N user_input={"password": "test2 password"}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_unsuccessful" @@ -1026,7 +1027,7 @@ async def test_options_flow_ble(hass: HomeAssistant, mock_rpc_device: Mock) -> N """Test setting ble options for gen2 devices.""" entry = await init_integration(hass, 2) 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" assert result["errors"] is None @@ -1038,11 +1039,11 @@ async def test_options_flow_ble(hass: HomeAssistant, mock_rpc_device: Mock) -> N ) 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_BLE_SCANNER_MODE] == BLEScannerMode.DISABLED 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" assert result["errors"] is None @@ -1054,11 +1055,11 @@ async def test_options_flow_ble(hass: HomeAssistant, mock_rpc_device: Mock) -> N ) 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_BLE_SCANNER_MODE] == BLEScannerMode.ACTIVE 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" assert result["errors"] is None @@ -1070,7 +1071,7 @@ async def test_options_flow_ble(hass: HomeAssistant, mock_rpc_device: Mock) -> N ) 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_BLE_SCANNER_MODE] == BLEScannerMode.PASSIVE await hass.config_entries.async_unload(entry.entry_id) @@ -1099,7 +1100,7 @@ async def test_zeroconf_already_configured_triggers_refresh_mac_in_name( data=DISCOVERY_INFO_WITH_MAC, context={"source": config_entries.SOURCE_ZEROCONF}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" monkeypatch.setattr(mock_rpc_device, "connected", False) @@ -1134,7 +1135,7 @@ async def test_zeroconf_already_configured_triggers_refresh( data=DISCOVERY_INFO, context={"source": config_entries.SOURCE_ZEROCONF}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" monkeypatch.setattr(mock_rpc_device, "connected", False) @@ -1176,7 +1177,7 @@ async def test_zeroconf_sleeping_device_not_triggers_refresh( data=DISCOVERY_INFO, context={"source": config_entries.SOURCE_ZEROCONF}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" monkeypatch.setattr(mock_rpc_device, "connected", False) @@ -1197,7 +1198,7 @@ async def test_sleeping_device_gen2_with_new_firmware( 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 ( diff --git a/tests/components/shopping_list/test_config_flow.py b/tests/components/shopping_list/test_config_flow.py index 1d807e87ca2..4f6f5270c08 100644 --- a/tests/components/shopping_list/test_config_flow.py +++ b/tests/components/shopping_list/test_config_flow.py @@ -12,7 +12,7 @@ async def test_import(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_IMPORT}, data={} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY async def test_user(hass: HomeAssistant) -> None: @@ -22,7 +22,7 @@ async def test_user(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" @@ -33,7 +33,7 @@ async def test_user_confirm(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER}, data={} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["result"].data == {} @@ -43,6 +43,6 @@ async def test_onboarding_flow(hass: HomeAssistant) -> None: DOMAIN, context={"source": "onboarding"} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Shopping list" assert result["data"] == {} diff --git a/tests/components/sia/test_config_flow.py b/tests/components/sia/test_config_flow.py index 542c06da24f..c46a2ebbf46 100644 --- a/tests/components/sia/test_config_flow.py +++ b/tests/components/sia/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.sia.config_flow import ACCOUNT_SCHEMA, HUB_SCHEMA from homeassistant.components.sia.const import ( CONF_ACCOUNT, @@ -18,6 +18,7 @@ from homeassistant.components.sia.const import ( ) from homeassistant.const import CONF_PORT, CONF_PROTOCOL from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from homeassistant.setup import async_setup_component from tests.common import MockConfigEntry @@ -164,9 +165,7 @@ async def test_form_start_account( async def test_create(hass: HomeAssistant, entry_with_basic_config) -> None: """Test we create a entry through the form.""" - assert ( - entry_with_basic_config["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY - ) + assert entry_with_basic_config["type"] is FlowResultType.CREATE_ENTRY assert ( entry_with_basic_config["title"] == f"SIA Alarm on port {BASIC_CONFIG[CONF_PORT]}" @@ -179,10 +178,7 @@ async def test_create_additional_account( hass: HomeAssistant, entry_with_additional_account_config ) -> None: """Test we create a config with two accounts.""" - assert ( - entry_with_additional_account_config["type"] - == data_entry_flow.FlowResultType.CREATE_ENTRY - ) + assert entry_with_additional_account_config["type"] is FlowResultType.CREATE_ENTRY assert ( entry_with_additional_account_config["title"] == f"SIA Alarm on port {BASIC_CONFIG[CONF_PORT]}" @@ -322,7 +318,7 @@ async def test_options_basic(hass: HomeAssistant) -> None: ) await setup_sia(hass, config_entry) 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"] == "options" assert result["last_step"] @@ -330,7 +326,7 @@ async def test_options_basic(hass: HomeAssistant) -> None: result["flow_id"], BASIC_OPTIONS ) await hass.async_block_till_done() - assert updated["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert updated["type"] is FlowResultType.CREATE_ENTRY assert updated["data"] == { CONF_ACCOUNTS: {BASIC_CONFIG[CONF_ACCOUNT]: BASIC_OPTIONS} } @@ -348,13 +344,13 @@ async def test_options_additional(hass: HomeAssistant) -> None: ) await setup_sia(hass, config_entry) 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"] == "options" assert not result["last_step"] updated = await hass.config_entries.options.async_configure( result["flow_id"], BASIC_OPTIONS ) - assert updated["type"] == data_entry_flow.FlowResultType.FORM + assert updated["type"] is FlowResultType.FORM assert updated["step_id"] == "options" assert updated["last_step"] diff --git a/tests/components/simplepush/test_config_flow.py b/tests/components/simplepush/test_config_flow.py index 3905014747b..6718491f2a0 100644 --- a/tests/components/simplepush/test_config_flow.py +++ b/tests/components/simplepush/test_config_flow.py @@ -5,10 +5,11 @@ from unittest.mock import patch import pytest from simplepush import UnknownError -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.simplepush.const import CONF_DEVICE_KEY, CONF_SALT, DOMAIN from homeassistant.const import CONF_NAME, CONF_PASSWORD from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -44,7 +45,7 @@ async def test_flow_successful(hass: HomeAssistant) -> None: result["flow_id"], user_input=MOCK_CONFIG, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "simplepush" assert result["data"] == MOCK_CONFIG @@ -60,7 +61,7 @@ async def test_flow_with_password(hass: HomeAssistant) -> None: result["flow_id"], user_input=mock_config_pass, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "simplepush" assert result["data"] == mock_config_pass @@ -83,7 +84,7 @@ async def test_flow_user_device_key_already_configured(hass: HomeAssistant) -> N result["flow_id"], user_input=MOCK_CONFIG, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -108,7 +109,7 @@ async def test_flow_user_name_already_configured(hass: HomeAssistant) -> None: result["flow_id"], user_input=MOCK_CONFIG, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -126,5 +127,5 @@ async def test_error_on_connection_failure(hass: HomeAssistant) -> None: result["flow_id"], user_input=MOCK_CONFIG, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} diff --git a/tests/components/simplisafe/test_config_flow.py b/tests/components/simplisafe/test_config_flow.py index af92833eb5b..dde7e37b891 100644 --- a/tests/components/simplisafe/test_config_flow.py +++ b/tests/components/simplisafe/test_config_flow.py @@ -27,12 +27,12 @@ async def test_duplicate_error( DOMAIN, context={"source": 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"], user_input={CONF_AUTH_CODE: VALID_AUTH_CODE} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -42,12 +42,12 @@ async def test_invalid_auth_code_length(hass: HomeAssistant) -> None: DOMAIN, context={"source": 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"], user_input={CONF_AUTH_CODE: "too_short_code"} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {CONF_AUTH_CODE: "invalid_auth_code_length"} @@ -61,13 +61,13 @@ async def test_invalid_credentials(hass: HomeAssistant) -> None: DOMAIN, context={"source": 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"], user_input={CONF_AUTH_CODE: VALID_AUTH_CODE}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {CONF_AUTH_CODE: "invalid_auth"} @@ -79,14 +79,14 @@ async def test_options_flow(config_entry, 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_CODE: "4321"} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == {CONF_CODE: "4321"} @@ -108,7 +108,7 @@ async def test_step_reauth(config_entry, hass: HomeAssistant, setup_simplisafe) result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_AUTH_CODE: VALID_AUTH_CODE} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert len(hass.config_entries.async_entries()) == 1 @@ -137,7 +137,7 @@ async def test_step_reauth_wrong_account( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_AUTH_CODE: VALID_AUTH_CODE} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "wrong_account" @@ -178,7 +178,7 @@ async def test_step_user( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_AUTH_CODE: auth_code} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY if log_statement: assert any(m for m in caplog.messages if log_statement in m) @@ -198,10 +198,10 @@ async def test_unknown_error(hass: HomeAssistant, setup_simplisafe) -> None: DOMAIN, context={"source": 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"], user_input={CONF_AUTH_CODE: VALID_AUTH_CODE} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "unknown"} diff --git a/tests/components/skybell/test_config_flow.py b/tests/components/skybell/test_config_flow.py index 535eb91f01b..cb62f808efc 100644 --- a/tests/components/skybell/test_config_flow.py +++ b/tests/components/skybell/test_config_flow.py @@ -33,7 +33,7 @@ async def test_flow_user(hass: HomeAssistant) -> None: 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( @@ -41,7 +41,7 @@ async def test_flow_user(hass: HomeAssistant) -> None: user_input=CONF_DATA, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "user" assert result["data"] == CONF_DATA assert result["result"].unique_id == USER_ID @@ -59,7 +59,7 @@ async def test_flow_user_already_configured(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER}, data=CONF_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -69,7 +69,7 @@ async def test_flow_user_cannot_connect(hass: HomeAssistant, skybell_mock) -> No result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=CONF_DATA ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "cannot_connect"} @@ -83,7 +83,7 @@ async def test_invalid_credentials(hass: HomeAssistant, skybell_mock) -> None: DOMAIN, context={"source": SOURCE_USER}, data=CONF_DATA ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "invalid_auth"} @@ -94,7 +94,7 @@ async def test_flow_user_unknown_error(hass: HomeAssistant, skybell_mock) -> Non result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=CONF_DATA ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "unknown"} @@ -114,14 +114,14 @@ async def test_step_reauth(hass: HomeAssistant) -> None: data=entry.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( result["flow_id"], user_input={CONF_PASSWORD: PASSWORD}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" @@ -140,7 +140,7 @@ async def test_step_reauth_failed(hass: HomeAssistant, skybell_mock) -> None: data=entry.data, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" skybell_mock.async_initialize.side_effect = ( @@ -151,7 +151,7 @@ async def test_step_reauth_failed(hass: HomeAssistant, skybell_mock) -> None: user_input={CONF_PASSWORD: PASSWORD}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "invalid_auth"} skybell_mock.async_initialize.side_effect = None @@ -160,5 +160,5 @@ async def test_step_reauth_failed(hass: HomeAssistant, skybell_mock) -> None: result["flow_id"], user_input={CONF_PASSWORD: PASSWORD}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" diff --git a/tests/components/slack/test_config_flow.py b/tests/components/slack/test_config_flow.py index c7b8d927c94..565b5ec2149 100644 --- a/tests/components/slack/test_config_flow.py +++ b/tests/components/slack/test_config_flow.py @@ -2,9 +2,10 @@ from unittest.mock import patch -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.slack.const import DOMAIN from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from . import CONF_DATA, CONF_INPUT, TEAM_NAME, create_entry, mock_connection @@ -24,7 +25,7 @@ async def test_flow_user( result["flow_id"], user_input=CONF_INPUT, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == TEAM_NAME assert result["data"] == CONF_DATA @@ -43,7 +44,7 @@ async def test_flow_user_already_configured( result["flow_id"], user_input=CONF_INPUT, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -57,7 +58,7 @@ async def test_flow_user_invalid_auth( context={"source": config_entries.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_auth"} @@ -72,7 +73,7 @@ async def test_flow_user_cannot_connect( context={"source": config_entries.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"} @@ -88,6 +89,6 @@ async def test_flow_user_unknown_error(hass: HomeAssistant) -> None: context={"source": config_entries.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"} diff --git a/tests/components/sleepiq/test_config_flow.py b/tests/components/sleepiq/test_config_flow.py index b623252cec4..fff483d2f15 100644 --- a/tests/components/sleepiq/test_config_flow.py +++ b/tests/components/sleepiq/test_config_flow.py @@ -5,10 +5,11 @@ from unittest.mock import AsyncMock, patch from asyncsleepiq import SleepIQLoginException, SleepIQTimeoutException import pytest -from homeassistant import config_entries, data_entry_flow, setup +from homeassistant import config_entries, setup from homeassistant.components.sleepiq.const import DOMAIN from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from .conftest import SLEEPIQ_CONFIG, setup_platform @@ -49,7 +50,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" @@ -70,7 +71,7 @@ async def test_login_failure(hass: HomeAssistant, side_effect, error) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER}, data=SLEEPIQ_CONFIG ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": error} @@ -89,7 +90,7 @@ async def test_success(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> 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"][CONF_USERNAME] == SLEEPIQ_CONFIG[CONF_USERNAME] assert result2["data"][CONF_PASSWORD] == SLEEPIQ_CONFIG[CONF_PASSWORD] assert len(mock_setup_entry.mock_calls) == 1 @@ -124,5 +125,5 @@ async def test_reauth_password(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/slimproto/test_config_flow.py b/tests/components/slimproto/test_config_flow.py index 686768c6eb6..97da39517bd 100644 --- a/tests/components/slimproto/test_config_flow.py +++ b/tests/components/slimproto/test_config_flow.py @@ -16,7 +16,7 @@ async def test_full_user_flow(hass: HomeAssistant, mock_setup_entry: AsyncMock) DOMAIN, context={"source": SOURCE_USER} ) - assert result.get("type") == FlowResultType.CREATE_ENTRY + assert result.get("type") is FlowResultType.CREATE_ENTRY assert result.get("title") == DEFAULT_NAME assert result.get("data") == {} @@ -35,5 +35,5 @@ async def test_already_configured( DOMAIN, context={"source": SOURCE_USER} ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "single_instance_allowed" diff --git a/tests/components/sma/test_config_flow.py b/tests/components/sma/test_config_flow.py index d73d8eb9728..93ac1783e09 100644 --- a/tests/components/sma/test_config_flow.py +++ b/tests/components/sma/test_config_flow.py @@ -22,7 +22,7 @@ async def test_form(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["errors"] == {} with ( @@ -36,7 +36,7 @@ async def test_form(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"] == MOCK_USER_INPUT["host"] assert result["data"] == MOCK_USER_INPUT @@ -58,7 +58,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None: MOCK_USER_INPUT, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} assert len(mock_setup_entry.mock_calls) == 0 @@ -78,7 +78,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None: MOCK_USER_INPUT, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "invalid_auth"} assert len(mock_setup_entry.mock_calls) == 0 @@ -99,7 +99,7 @@ async def test_form_cannot_retrieve_device_info(hass: HomeAssistant) -> None: MOCK_USER_INPUT, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_retrieve_device_info"} assert len(mock_setup_entry.mock_calls) == 0 @@ -119,7 +119,7 @@ async def test_form_unexpected_exception(hass: HomeAssistant) -> None: MOCK_USER_INPUT, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "unknown"} assert len(mock_setup_entry.mock_calls) == 0 @@ -143,6 +143,6 @@ async def test_form_already_configured(hass: HomeAssistant, mock_config_entry) - MOCK_USER_INPUT, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert len(mock_setup_entry.mock_calls) == 0 diff --git a/tests/components/smappee/test_config_flow.py b/tests/components/smappee/test_config_flow.py index b5551c03c77..82f5baf952f 100644 --- a/tests/components/smappee/test_config_flow.py +++ b/tests/components/smappee/test_config_flow.py @@ -4,7 +4,7 @@ from http import HTTPStatus from ipaddress import ip_address from unittest.mock import patch -from homeassistant import data_entry_flow, setup +from homeassistant import setup from homeassistant.components import zeroconf from homeassistant.components.smappee.const import ( CONF_SERIALNUMBER, @@ -16,6 +16,7 @@ from homeassistant.components.smappee.const import ( from homeassistant.config_entries import SOURCE_USER, SOURCE_ZEROCONF from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from homeassistant.helpers import config_entry_oauth2_flow from tests.common import MockConfigEntry @@ -34,7 +35,7 @@ async def test_show_user_form(hass: HomeAssistant) -> None: ) assert result["step_id"] == "environment" - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM async def test_show_user_host_form(hass: HomeAssistant) -> None: @@ -44,14 +45,14 @@ async def test_show_user_host_form(hass: HomeAssistant) -> None: context={"source": SOURCE_USER}, ) assert result["step_id"] == "environment" - 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"], {"environment": ENV_LOCAL} ) assert result["step_id"] == ENV_LOCAL - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM async def test_show_zeroconf_connection_error_form(hass: HomeAssistant) -> None: @@ -72,14 +73,14 @@ async def test_show_zeroconf_connection_error_form(hass: HomeAssistant) -> None: ) assert result["description_placeholders"] == {CONF_SERIALNUMBER: "1006000212"} - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "zeroconf_confirm" result = await hass.config_entries.flow.async_configure( result["flow_id"], {"host": "1.2.3.4"} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" assert len(hass.config_entries.async_entries(DOMAIN)) == 0 @@ -104,14 +105,14 @@ async def test_show_zeroconf_connection_error_form_next_generation( ) assert result["description_placeholders"] == {CONF_SERIALNUMBER: "5001000212"} - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "zeroconf_confirm" result = await hass.config_entries.flow.async_configure( result["flow_id"], {"host": "1.2.3.4"} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" assert len(hass.config_entries.async_entries(DOMAIN)) == 0 @@ -127,19 +128,19 @@ async def test_connection_error(hass: HomeAssistant) -> None: context={"source": SOURCE_USER}, ) assert result["step_id"] == "environment" - 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"], {"environment": ENV_LOCAL} ) assert result["step_id"] == ENV_LOCAL - 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"], {"host": "1.2.3.4"} ) assert result["reason"] == "cannot_connect" - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT async def test_user_local_connection_error(hass: HomeAssistant) -> None: @@ -156,19 +157,19 @@ async def test_user_local_connection_error(hass: HomeAssistant) -> None: context={"source": SOURCE_USER}, ) assert result["step_id"] == "environment" - 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"], {"environment": ENV_LOCAL} ) assert result["step_id"] == ENV_LOCAL - 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"], {"host": "1.2.3.4"} ) assert result["reason"] == "cannot_connect" - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT async def test_zeroconf_wrong_mdns(hass: HomeAssistant) -> None: @@ -188,7 +189,7 @@ async def test_zeroconf_wrong_mdns(hass: HomeAssistant) -> None: ) assert result["reason"] == "invalid_mdns" - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT async def test_full_user_wrong_mdns(hass: HomeAssistant) -> None: @@ -212,18 +213,18 @@ async def test_full_user_wrong_mdns(hass: HomeAssistant) -> None: context={"source": SOURCE_USER}, ) assert result["step_id"] == "environment" - 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"], {"environment": ENV_LOCAL} ) assert result["step_id"] == ENV_LOCAL - 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"], {"host": "1.2.3.4"} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "invalid_mdns" @@ -257,18 +258,18 @@ async def test_user_device_exists_abort(hass: HomeAssistant) -> None: context={"source": SOURCE_USER}, ) assert result["step_id"] == "environment" - 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"], {"environment": ENV_LOCAL} ) assert result["step_id"] == ENV_LOCAL - 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"], {"host": "1.2.3.4"} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert len(hass.config_entries.async_entries(DOMAIN)) == 1 @@ -312,7 +313,7 @@ async def test_zeroconf_device_exists_abort(hass: HomeAssistant) -> None: properties={"_raw": {}}, ), ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert len(hass.config_entries.async_entries(DOMAIN)) == 1 @@ -333,7 +334,7 @@ async def test_cloud_device_exists_abort(hass: HomeAssistant) -> None: context={"source": SOURCE_USER}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured_device" assert len(hass.config_entries.async_entries(DOMAIN)) == 1 @@ -362,7 +363,7 @@ async def test_zeroconf_abort_if_cloud_device_exists(hass: HomeAssistant) -> Non properties={"_raw": {}}, ), ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured_device" assert len(hass.config_entries.async_entries(DOMAIN)) == 1 @@ -396,7 +397,7 @@ async def test_zeroconf_confirm_abort_if_cloud_device_exists( 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 assert result["reason"] == "already_configured_device" assert len(hass.config_entries.async_entries(DOMAIN)) == 1 @@ -421,7 +422,7 @@ async def test_abort_cloud_flow_if_local_device_exists(hass: HomeAssistant) -> N result["flow_id"], {"environment": ENV_CLOUD} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured_local_device" assert len(hass.config_entries.async_entries(DOMAIN)) == 1 @@ -511,7 +512,7 @@ async def test_full_zeroconf_flow(hass: HomeAssistant) -> None: properties={"_raw": {}}, ), ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "zeroconf_confirm" assert result["description_placeholders"] == {CONF_SERIALNUMBER: "1006000212"} @@ -519,7 +520,7 @@ async def test_full_zeroconf_flow(hass: HomeAssistant) -> None: result["flow_id"], {"host": "1.2.3.4"} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "smappee1006000212" assert len(hass.config_entries.async_entries(DOMAIN)) == 1 @@ -549,7 +550,7 @@ async def test_full_user_local_flow(hass: HomeAssistant) -> None: context={"source": SOURCE_USER}, ) assert result["step_id"] == "environment" - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["description_placeholders"] is None result = await hass.config_entries.flow.async_configure( @@ -557,12 +558,12 @@ async def test_full_user_local_flow(hass: HomeAssistant) -> None: {"environment": ENV_LOCAL}, ) assert result["step_id"] == ENV_LOCAL - 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"], {"host": "1.2.3.4"} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "smappee1006000212" assert len(hass.config_entries.async_entries(DOMAIN)) == 1 @@ -596,7 +597,7 @@ async def test_full_zeroconf_flow_next_generation(hass: HomeAssistant) -> None: properties={"_raw": {}}, ), ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "zeroconf_confirm" assert result["description_placeholders"] == {CONF_SERIALNUMBER: "5001000212"} @@ -604,7 +605,7 @@ async def test_full_zeroconf_flow_next_generation(hass: HomeAssistant) -> None: result["flow_id"], {"host": "1.2.3.4"} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "smappee5001000212" assert len(hass.config_entries.async_entries(DOMAIN)) == 1 diff --git a/tests/components/smartthings/test_config_flow.py b/tests/components/smartthings/test_config_flow.py index e3dcf76bbaf..49444e47780 100644 --- a/tests/components/smartthings/test_config_flow.py +++ b/tests/components/smartthings/test_config_flow.py @@ -8,7 +8,7 @@ from aiohttp import ClientResponseError from pysmartthings import APIResponseError from pysmartthings.installedapp import format_install_url -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.smartthings import smartapp from homeassistant.components.smartthings.const import ( CONF_APP_ID, @@ -19,6 +19,7 @@ from homeassistant.components.smartthings.const import ( from homeassistant.config import async_process_ha_core_config from homeassistant.const import CONF_ACCESS_TOKEN, CONF_CLIENT_ID, CONF_CLIENT_SECRET from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -29,7 +30,7 @@ async def test_import_shows_user_step(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_IMPORT} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["description_placeholders"][ "webhook_url" @@ -56,7 +57,7 @@ async def test_entry_created( 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" assert result["description_placeholders"][ "webhook_url" @@ -64,7 +65,7 @@ async def test_entry_created( # Advance to PAT screen 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"] == "pat" assert "token_url" in result["description_placeholders"] assert "component_url" in result["description_placeholders"] @@ -73,14 +74,14 @@ async def test_entry_created( result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_ACCESS_TOKEN: token} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "select_location" # Select location and advance to external auth result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_LOCATION_ID: location.location_id} ) - assert result["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP assert result["step_id"] == "authorize" assert result["url"] == format_install_url(app.app_id, location.location_id) @@ -89,7 +90,7 @@ async def test_entry_created( # Finish 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["data"]["app_id"] == app.app_id assert result["data"]["installed_app_id"] == installed_app_id assert result["data"]["location_id"] == location.location_id @@ -127,7 +128,7 @@ async def test_entry_created_from_update_event( 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" assert result["description_placeholders"][ "webhook_url" @@ -135,7 +136,7 @@ async def test_entry_created_from_update_event( # Advance to PAT screen 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"] == "pat" assert "token_url" in result["description_placeholders"] assert "component_url" in result["description_placeholders"] @@ -144,14 +145,14 @@ async def test_entry_created_from_update_event( result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_ACCESS_TOKEN: token} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "select_location" # Select location and advance to external auth result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_LOCATION_ID: location.location_id} ) - assert result["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP assert result["step_id"] == "authorize" assert result["url"] == format_install_url(app.app_id, location.location_id) @@ -160,7 +161,7 @@ async def test_entry_created_from_update_event( # Finish 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["data"]["app_id"] == app.app_id assert result["data"]["installed_app_id"] == installed_app_id assert result["data"]["location_id"] == location.location_id @@ -199,7 +200,7 @@ async def test_entry_created_existing_app_new_oauth_client( 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" assert result["description_placeholders"][ "webhook_url" @@ -207,7 +208,7 @@ async def test_entry_created_existing_app_new_oauth_client( # Advance to PAT screen 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"] == "pat" assert "token_url" in result["description_placeholders"] assert "component_url" in result["description_placeholders"] @@ -216,14 +217,14 @@ async def test_entry_created_existing_app_new_oauth_client( result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_ACCESS_TOKEN: token} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "select_location" # Select location and advance to external auth result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_LOCATION_ID: location.location_id} ) - assert result["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP assert result["step_id"] == "authorize" assert result["url"] == format_install_url(app.app_id, location.location_id) @@ -232,7 +233,7 @@ async def test_entry_created_existing_app_new_oauth_client( # Finish 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["data"]["app_id"] == app.app_id assert result["data"]["installed_app_id"] == installed_app_id assert result["data"]["location_id"] == location.location_id @@ -283,7 +284,7 @@ async def test_entry_created_existing_app_copies_oauth_client( 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" assert result["description_placeholders"][ "webhook_url" @@ -291,7 +292,7 @@ async def test_entry_created_existing_app_copies_oauth_client( # Advance to PAT screen 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"] == "pat" assert "token_url" in result["description_placeholders"] assert "component_url" in result["description_placeholders"] @@ -302,14 +303,14 @@ async def test_entry_created_existing_app_copies_oauth_client( result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_ACCESS_TOKEN: token} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "select_location" # Select location and advance to external auth result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_LOCATION_ID: location.location_id} ) - assert result["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP assert result["step_id"] == "authorize" assert result["url"] == format_install_url(app.app_id, location.location_id) @@ -318,7 +319,7 @@ async def test_entry_created_existing_app_copies_oauth_client( # Finish 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["data"]["app_id"] == app.app_id assert result["data"]["installed_app_id"] == installed_app_id assert result["data"]["location_id"] == location.location_id @@ -377,7 +378,7 @@ async def test_entry_created_with_cloudhook( 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" assert result["description_placeholders"][ "webhook_url" @@ -387,7 +388,7 @@ async def test_entry_created_with_cloudhook( # Advance to PAT screen 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"] == "pat" assert "token_url" in result["description_placeholders"] assert "component_url" in result["description_placeholders"] @@ -396,14 +397,14 @@ async def test_entry_created_with_cloudhook( result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_ACCESS_TOKEN: token} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "select_location" # Select location and advance to external auth result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_LOCATION_ID: location.location_id} ) - assert result["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP assert result["step_id"] == "authorize" assert result["url"] == format_install_url(app.app_id, location.location_id) @@ -412,7 +413,7 @@ async def test_entry_created_with_cloudhook( # Finish 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["data"]["app_id"] == app.app_id assert result["data"]["installed_app_id"] == installed_app_id assert result["data"]["location_id"] == location.location_id @@ -440,7 +441,7 @@ async def test_invalid_webhook_aborts(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"] == "invalid_webhook_url" assert result["description_placeholders"][ "webhook_url" @@ -456,7 +457,7 @@ async def test_invalid_token_shows_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["step_id"] == "user" assert result["description_placeholders"][ "webhook_url" @@ -464,7 +465,7 @@ async def test_invalid_token_shows_error(hass: HomeAssistant) -> None: # Advance to PAT screen 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"] == "pat" assert "token_url" in result["description_placeholders"] assert "component_url" in result["description_placeholders"] @@ -473,7 +474,7 @@ async def test_invalid_token_shows_error(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_ACCESS_TOKEN: token} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "pat" assert result["data_schema"]({}) == {CONF_ACCESS_TOKEN: token} assert result["errors"] == {CONF_ACCESS_TOKEN: "token_invalid_format"} @@ -495,7 +496,7 @@ async def test_unauthorized_token_shows_error( 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" assert result["description_placeholders"][ "webhook_url" @@ -503,7 +504,7 @@ async def test_unauthorized_token_shows_error( # Advance to PAT screen 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"] == "pat" assert "token_url" in result["description_placeholders"] assert "component_url" in result["description_placeholders"] @@ -512,7 +513,7 @@ async def test_unauthorized_token_shows_error( result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_ACCESS_TOKEN: token} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "pat" assert result["data_schema"]({}) == {CONF_ACCESS_TOKEN: token} assert result["errors"] == {CONF_ACCESS_TOKEN: "token_unauthorized"} @@ -534,7 +535,7 @@ async def test_forbidden_token_shows_error( 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" assert result["description_placeholders"][ "webhook_url" @@ -542,7 +543,7 @@ async def test_forbidden_token_shows_error( # Advance to PAT screen 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"] == "pat" assert "token_url" in result["description_placeholders"] assert "component_url" in result["description_placeholders"] @@ -551,7 +552,7 @@ async def test_forbidden_token_shows_error( result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_ACCESS_TOKEN: token} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "pat" assert result["data_schema"]({}) == {CONF_ACCESS_TOKEN: token} assert result["errors"] == {CONF_ACCESS_TOKEN: "token_forbidden"} @@ -579,7 +580,7 @@ async def test_webhook_problem_shows_error( 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" assert result["description_placeholders"][ "webhook_url" @@ -587,7 +588,7 @@ async def test_webhook_problem_shows_error( # Advance to PAT screen 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"] == "pat" assert "token_url" in result["description_placeholders"] assert "component_url" in result["description_placeholders"] @@ -596,7 +597,7 @@ async def test_webhook_problem_shows_error( result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_ACCESS_TOKEN: token} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "pat" assert result["data_schema"]({}) == {CONF_ACCESS_TOKEN: token} assert result["errors"] == {"base": "webhook_error"} @@ -621,7 +622,7 @@ async def test_api_error_shows_error(hass: HomeAssistant, smartthings_mock) -> N 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" assert result["description_placeholders"][ "webhook_url" @@ -629,7 +630,7 @@ async def test_api_error_shows_error(hass: HomeAssistant, smartthings_mock) -> N # Advance to PAT screen 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"] == "pat" assert "token_url" in result["description_placeholders"] assert "component_url" in result["description_placeholders"] @@ -638,7 +639,7 @@ async def test_api_error_shows_error(hass: HomeAssistant, smartthings_mock) -> N result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_ACCESS_TOKEN: token} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "pat" assert result["data_schema"]({}) == {CONF_ACCESS_TOKEN: token} assert result["errors"] == {"base": "app_setup_error"} @@ -661,7 +662,7 @@ async def test_unknown_response_error_shows_error( 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" assert result["description_placeholders"][ "webhook_url" @@ -669,7 +670,7 @@ async def test_unknown_response_error_shows_error( # Advance to PAT screen 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"] == "pat" assert "token_url" in result["description_placeholders"] assert "component_url" in result["description_placeholders"] @@ -678,7 +679,7 @@ async def test_unknown_response_error_shows_error( result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_ACCESS_TOKEN: token} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "pat" assert result["data_schema"]({}) == {CONF_ACCESS_TOKEN: token} assert result["errors"] == {"base": "app_setup_error"} @@ -695,7 +696,7 @@ async def test_unknown_error_shows_error(hass: HomeAssistant, smartthings_mock) 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" assert result["description_placeholders"][ "webhook_url" @@ -703,7 +704,7 @@ async def test_unknown_error_shows_error(hass: HomeAssistant, smartthings_mock) # Advance to PAT screen 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"] == "pat" assert "token_url" in result["description_placeholders"] assert "component_url" in result["description_placeholders"] @@ -712,7 +713,7 @@ async def test_unknown_error_shows_error(hass: HomeAssistant, smartthings_mock) result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_ACCESS_TOKEN: token} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "pat" assert result["data_schema"]({}) == {CONF_ACCESS_TOKEN: token} assert result["errors"] == {"base": "app_setup_error"} @@ -737,7 +738,7 @@ async def test_no_available_locations_aborts( 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" assert result["description_placeholders"][ "webhook_url" @@ -745,7 +746,7 @@ async def test_no_available_locations_aborts( # Advance to PAT screen 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"] == "pat" assert "token_url" in result["description_placeholders"] assert "component_url" in result["description_placeholders"] @@ -754,5 +755,5 @@ async def test_no_available_locations_aborts( result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_ACCESS_TOKEN: token} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_available_locations" diff --git a/tests/components/smarttub/test_config_flow.py b/tests/components/smarttub/test_config_flow.py index df3695f31af..47204e2154e 100644 --- a/tests/components/smarttub/test_config_flow.py +++ b/tests/components/smarttub/test_config_flow.py @@ -4,10 +4,11 @@ from unittest.mock import patch from smarttub import LoginFailed -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.smarttub.const import DOMAIN from homeassistant.const import CONF_EMAIL, CONF_PASSWORD from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -75,14 +76,14 @@ async def test_reauth_success(hass: HomeAssistant, smarttub_api, account) -> Non data=mock_entry.data, ) - assert result["type"] == data_entry_flow.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"], {CONF_EMAIL: "test-email3", CONF_PASSWORD: "test-password3"} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert mock_entry.data[CONF_EMAIL] == "test-email3" assert mock_entry.data[CONF_PASSWORD] == "test-password3" @@ -116,12 +117,12 @@ async def test_reauth_wrong_account(hass: HomeAssistant, smarttub_api, account) data=mock_entry2.data, ) - assert result["type"] == data_entry_flow.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"], {CONF_EMAIL: "test-email1", CONF_PASSWORD: "test-password1"} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/smhi/test_config_flow.py b/tests/components/smhi/test_config_flow.py index 7d8701eca45..a771bcc1e1d 100644 --- a/tests/components/smhi/test_config_flow.py +++ b/tests/components/smhi/test_config_flow.py @@ -26,7 +26,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 ( @@ -50,7 +50,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"] == "Home" assert result2["data"] == { "location": { @@ -86,7 +86,7 @@ async def test_form(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result4["type"] == FlowResultType.CREATE_ENTRY + assert result4["type"] is FlowResultType.CREATE_ENTRY assert result4["title"] == "Weather 1.0 1.0" assert result4["data"] == { "location": { @@ -118,7 +118,7 @@ async def test_form_invalid_coordinates(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "wrong_location"} # Continue flow with new coordinates @@ -143,7 +143,7 @@ async def test_form_invalid_coordinates(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"] == "Weather 2.0 2.0" assert result3["data"] == { "location": { @@ -187,7 +187,7 @@ async def test_form_unique_id_exist(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" @@ -224,7 +224,7 @@ async def test_reconfigure_flow( "entry_id": entry.entry_id, }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM with patch( "homeassistant.components.smhi.config_flow.Smhi.async_get_forecast", @@ -241,7 +241,7 @@ async def test_reconfigure_flow( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "wrong_location"} with ( @@ -265,7 +265,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" entry = hass.config_entries.async_get_entry(entry.entry_id) assert entry.title == "Home" diff --git a/tests/components/snapcast/test_config_flow.py b/tests/components/snapcast/test_config_flow.py index bb07eae2140..3bdba8b4c58 100644 --- a/tests/components/snapcast/test_config_flow.py +++ b/tests/components/snapcast/test_config_flow.py @@ -26,7 +26,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 not result["errors"] @@ -38,7 +38,7 @@ async def test_form( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "invalid_host"} @@ -50,7 +50,7 @@ async def test_form( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "cannot_connect"} @@ -60,7 +60,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"] == "Snapcast" assert result["data"] == {CONF_HOST: "snapserver.test", CONF_PORT: 1705} assert len(mock_create_server.mock_calls) == 1 @@ -80,7 +80,7 @@ async def test_abort( 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 not result["errors"] @@ -91,5 +91,5 @@ async def test_abort( ) 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/snooz/test_config_flow.py b/tests/components/snooz/test_config_flow.py index 172ca3cd143..209bd50512a 100644 --- a/tests/components/snooz/test_config_flow.py +++ b/tests/components/snooz/test_config_flow.py @@ -30,7 +30,7 @@ async def test_async_step_bluetooth_valid_device(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=SNOOZ_SERVICE_INFO_PAIRING, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" await _test_setup_entry(hass, result["flow_id"]) @@ -44,7 +44,7 @@ async def test_async_step_bluetooth_waits_to_pair(hass: HomeAssistant) -> None: data=SNOOZ_SERVICE_INFO_NOT_PAIRING, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" await _test_pairs(hass, result["flow_id"]) @@ -59,7 +59,7 @@ async def test_async_step_bluetooth_retries_pairing(hass: HomeAssistant) -> None data=SNOOZ_SERVICE_INFO_NOT_PAIRING, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" retry_id = await _test_pairs_timeout(hass, result["flow_id"]) @@ -73,7 +73,7 @@ async def test_async_step_bluetooth_not_snooz(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=NOT_SNOOZ_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_supported" @@ -83,7 +83,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" @@ -97,7 +97,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" assert result["data_schema"] # ensure discovered devices are listed as options @@ -119,7 +119,7 @@ async def test_async_step_user_with_found_devices_waits_to_pair( DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" await _test_pairs(hass, result["flow_id"], {CONF_NAME: TEST_SNOOZ_DISPLAY_NAME}) @@ -137,7 +137,7 @@ async def test_async_step_user_with_found_devices_retries_pairing( DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" user_input = {CONF_NAME: TEST_SNOOZ_DISPLAY_NAME} @@ -156,7 +156,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( @@ -171,7 +171,7 @@ async def test_async_step_user_device_added_between_steps(hass: HomeAssistant) - result["flow_id"], user_input={CONF_NAME: TEST_SNOOZ_DISPLAY_NAME}, ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" @@ -194,7 +194,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" @@ -212,7 +212,7 @@ async def test_async_step_bluetooth_devices_already_setup(hass: HomeAssistant) - context={"source": config_entries.SOURCE_BLUETOOTH}, data=SNOOZ_SERVICE_INFO_PAIRING, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -223,7 +223,7 @@ async def test_async_step_bluetooth_already_in_progress(hass: HomeAssistant) -> context={"source": config_entries.SOURCE_BLUETOOTH}, data=SNOOZ_SERVICE_INFO_PAIRING, ) - 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( @@ -231,7 +231,7 @@ async def test_async_step_bluetooth_already_in_progress(hass: HomeAssistant) -> context={"source": config_entries.SOURCE_BLUETOOTH}, data=SNOOZ_SERVICE_INFO_PAIRING, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_in_progress" @@ -244,7 +244,7 @@ async def test_async_step_user_takes_precedence_over_discovery( context={"source": config_entries.SOURCE_BLUETOOTH}, data=SNOOZ_SERVICE_INFO_PAIRING, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch( @@ -255,7 +255,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_setup_entry( hass, result["flow_id"], {CONF_NAME: TEST_SNOOZ_DISPLAY_NAME} @@ -286,7 +286,7 @@ async def _test_pairs( flow_id, user_input=user_input or {}, ) - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["step_id"] == "wait_for_pairing_mode" pairing_mode_entered.set() @@ -305,12 +305,12 @@ async def _test_pairs_timeout( result = await hass.config_entries.flow.async_configure( flow_id, user_input=user_input or {} ) - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["step_id"] == "wait_for_pairing_mode" await hass.async_block_till_done() 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"] == "pairing_timeout" return result2["flow_id"] @@ -325,7 +325,7 @@ async def _test_setup_entry( user_input=user_input or {}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { CONF_ADDRESS: TEST_ADDRESS, CONF_TOKEN: TEST_PAIRING_TOKEN, diff --git a/tests/components/solaredge/test_config_flow.py b/tests/components/solaredge/test_config_flow.py index 81b97c071fd..9ff605a871d 100644 --- a/tests/components/solaredge/test_config_flow.py +++ b/tests/components/solaredge/test_config_flow.py @@ -5,11 +5,11 @@ from unittest.mock import Mock, patch import pytest from requests.exceptions import ConnectTimeout, HTTPError -from homeassistant import data_entry_flow from homeassistant.components.solaredge.const import CONF_SITE_ID, DEFAULT_NAME, DOMAIN from homeassistant.config_entries import SOURCE_IGNORE, SOURCE_USER from homeassistant.const import CONF_API_KEY, CONF_NAME from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -32,7 +32,7 @@ async def test_user(hass: HomeAssistant, test_api: Mock) -> None: result = await hass.config_entries.flow.async_init( 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" # test with all provided @@ -41,7 +41,7 @@ async def test_user(hass: HomeAssistant, test_api: Mock) -> None: context={"source": SOURCE_USER}, data={CONF_NAME: NAME, CONF_API_KEY: API_KEY, CONF_SITE_ID: SITE_ID}, ) - assert result.get("type") == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result.get("type") is FlowResultType.CREATE_ENTRY assert result.get("title") == "solaredge_site_1_2_3" data = result.get("data") @@ -63,7 +63,7 @@ async def test_abort_if_already_setup(hass: HomeAssistant, test_api: str) -> Non context={"source": SOURCE_USER}, data={CONF_NAME: "test", CONF_SITE_ID: SITE_ID, CONF_API_KEY: "test"}, ) - assert result.get("type") == data_entry_flow.FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("errors") == {CONF_SITE_ID: "already_configured"} @@ -83,7 +83,7 @@ async def test_ignored_entry_does_not_cause_error( context={"source": SOURCE_USER}, data={CONF_NAME: "test", CONF_SITE_ID: SITE_ID, CONF_API_KEY: "test"}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "test" data = result["data"] @@ -103,7 +103,7 @@ async def test_asserts(hass: HomeAssistant, test_api: Mock) -> None: context={"source": SOURCE_USER}, data={CONF_NAME: NAME, CONF_API_KEY: API_KEY, CONF_SITE_ID: SITE_ID}, ) - assert result.get("type") == data_entry_flow.FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("errors") == {CONF_SITE_ID: "site_not_active"} # test with api_failure @@ -113,7 +113,7 @@ async def test_asserts(hass: HomeAssistant, test_api: Mock) -> None: context={"source": SOURCE_USER}, data={CONF_NAME: NAME, CONF_API_KEY: API_KEY, CONF_SITE_ID: SITE_ID}, ) - assert result.get("type") == data_entry_flow.FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("errors") == {CONF_SITE_ID: "invalid_api_key"} # test with ConnectionTimeout @@ -123,7 +123,7 @@ async def test_asserts(hass: HomeAssistant, test_api: Mock) -> None: context={"source": SOURCE_USER}, data={CONF_NAME: NAME, CONF_API_KEY: API_KEY, CONF_SITE_ID: SITE_ID}, ) - assert result.get("type") == data_entry_flow.FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("errors") == {CONF_SITE_ID: "could_not_connect"} # test with HTTPError @@ -133,5 +133,5 @@ async def test_asserts(hass: HomeAssistant, test_api: Mock) -> None: context={"source": SOURCE_USER}, data={CONF_NAME: NAME, CONF_API_KEY: API_KEY, CONF_SITE_ID: SITE_ID}, ) - assert result.get("type") == data_entry_flow.FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("errors") == {CONF_SITE_ID: "could_not_connect"} diff --git a/tests/components/solarlog/test_config_flow.py b/tests/components/solarlog/test_config_flow.py index 16f25264b9d..4b840dd0cf9 100644 --- a/tests/components/solarlog/test_config_flow.py +++ b/tests/components/solarlog/test_config_flow.py @@ -4,11 +4,12 @@ from unittest.mock import patch import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.solarlog import config_flow from homeassistant.components.solarlog.const import DEFAULT_HOST, DOMAIN 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 @@ -68,12 +69,12 @@ async def test_user(hass: HomeAssistant, test_connect) -> None: flow = init_config_flow(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" # tets with all provided result = await flow.async_step_user({CONF_NAME: NAME, CONF_HOST: HOST}) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "solarlog_test_1_2_3" assert result["data"][CONF_HOST] == HOST @@ -84,19 +85,19 @@ async def test_import(hass: HomeAssistant, test_connect) -> None: # import with only host result = await flow.async_step_import({CONF_HOST: HOST}) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "solarlog" assert result["data"][CONF_HOST] == HOST # import with only name result = await flow.async_step_import({CONF_NAME: NAME}) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "solarlog_test_1_2_3" assert result["data"][CONF_HOST] == DEFAULT_HOST # import with host and name result = await flow.async_step_import({CONF_HOST: HOST, CONF_NAME: NAME}) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "solarlog_test_1_2_3" assert result["data"][CONF_HOST] == HOST @@ -112,19 +113,19 @@ async def test_abort_if_already_setup(hass: HomeAssistant, test_connect) -> None result = await flow.async_step_import( {CONF_HOST: HOST, CONF_NAME: "solarlog_test_7_8_9"} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" # Should fail, same HOST and NAME result = await flow.async_step_user({CONF_HOST: HOST, CONF_NAME: NAME}) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {CONF_HOST: "already_configured"} # SHOULD pass, diff HOST (without http://), different NAME result = await flow.async_step_import( {CONF_HOST: "2.2.2.2", CONF_NAME: "solarlog_test_7_8_9"} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "solarlog_test_7_8_9" assert result["data"][CONF_HOST] == "http://2.2.2.2" @@ -132,6 +133,6 @@ async def test_abort_if_already_setup(hass: HomeAssistant, test_connect) -> None result = await flow.async_step_import( {CONF_HOST: "http://2.2.2.2", CONF_NAME: NAME} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "solarlog_test_1_2_3" assert result["data"][CONF_HOST] == "http://2.2.2.2" diff --git a/tests/components/soma/test_config_flow.py b/tests/components/soma/test_config_flow.py index 04a93bb5a58..8b8548bfe3e 100644 --- a/tests/components/soma/test_config_flow.py +++ b/tests/components/soma/test_config_flow.py @@ -5,9 +5,9 @@ from unittest.mock import patch from api.soma_api import SomaApi from requests import RequestException -from homeassistant import data_entry_flow from homeassistant.components.soma import DOMAIN, config_flow from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -20,7 +20,7 @@ async def test_form(hass: HomeAssistant) -> None: flow = config_flow.SomaFlowHandler() flow.hass = hass result = await flow.async_step_user() - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM async def test_import_abort(hass: HomeAssistant) -> None: @@ -29,7 +29,7 @@ async def test_import_abort(hass: HomeAssistant) -> None: flow.hass = hass MockConfigEntry(domain=DOMAIN).add_to_hass(hass) result = await flow.async_step_import() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_setup" @@ -39,7 +39,7 @@ async def test_import_create(hass: HomeAssistant) -> None: flow.hass = hass with patch.object(SomaApi, "list_devices", return_value={"result": "success"}): result = await flow.async_step_import({"host": MOCK_HOST, "port": MOCK_PORT}) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY async def test_error_status(hass: HomeAssistant) -> None: @@ -48,7 +48,7 @@ async def test_error_status(hass: HomeAssistant) -> None: flow.hass = hass with patch.object(SomaApi, "list_devices", return_value={"result": "error"}): result = await flow.async_step_import({"host": MOCK_HOST, "port": MOCK_PORT}) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "result_error" @@ -58,7 +58,7 @@ async def test_key_error(hass: HomeAssistant) -> None: flow.hass = hass with patch.object(SomaApi, "list_devices", return_value={}): result = await flow.async_step_import({"host": MOCK_HOST, "port": MOCK_PORT}) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "connection_error" @@ -68,7 +68,7 @@ async def test_exception(hass: HomeAssistant) -> None: flow.hass = hass with patch.object(SomaApi, "list_devices", side_effect=RequestException()): result = await flow.async_step_import({"host": MOCK_HOST, "port": MOCK_PORT}) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "connection_error" @@ -79,4 +79,4 @@ async def test_full_flow(hass: HomeAssistant) -> None: flow.hass = hass with patch.object(SomaApi, "list_devices", return_value={"result": "success"}): result = await flow.async_step_user({"host": MOCK_HOST, "port": MOCK_PORT}) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY diff --git a/tests/components/somfy_mylink/test_config_flow.py b/tests/components/somfy_mylink/test_config_flow.py index a01f4d640a1..175fcd68477 100644 --- a/tests/components/somfy_mylink/test_config_flow.py +++ b/tests/components/somfy_mylink/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 import dhcp from homeassistant.components.somfy_mylink.const import ( CONF_REVERSED_TARGET_IDS, @@ -13,6 +13,7 @@ from homeassistant.components.somfy_mylink.const import ( ) 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 @@ -182,7 +183,7 @@ async def test_options_not_loaded(hass: HomeAssistant) -> None: ): result = await hass.config_entries.options.async_init(config_entry.entry_id) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT @pytest.mark.parametrize("reversed", [True, False]) @@ -211,7 +212,7 @@ async def test_options_with_targets(hass: HomeAssistant, reversed) -> None: await hass.async_block_till_done() result = await hass.config_entries.options.async_init(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" result2 = await hass.config_entries.options.async_configure( @@ -219,19 +220,19 @@ async def test_options_with_targets(hass: HomeAssistant, reversed) -> None: user_input={"target_id": "a"}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM result3 = await hass.config_entries.options.async_configure( result2["flow_id"], user_input={"reverse": reversed}, ) - assert result3["type"] == data_entry_flow.FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM result4 = await hass.config_entries.options.async_configure( result3["flow_id"], user_input={"target_id": None}, ) - assert result4["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result4["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { CONF_REVERSED_TARGET_IDS: {"a": reversed}, diff --git a/tests/components/sonarr/test_config_flow.py b/tests/components/sonarr/test_config_flow.py index 3e48a4b25a8..6bd14e8b581 100644 --- a/tests/components/sonarr/test_config_flow.py +++ b/tests/components/sonarr/test_config_flow.py @@ -29,7 +29,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_cannot_connect( @@ -45,7 +45,7 @@ async def test_cannot_connect( data=user_input, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "cannot_connect"} @@ -65,7 +65,7 @@ async def test_invalid_auth( data=user_input, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "invalid_auth"} @@ -83,7 +83,7 @@ async def test_unknown_error( data=user_input, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "unknown" @@ -106,14 +106,14 @@ async def test_full_reauth_flow_implementation( data=entry.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( result["flow_id"], user_input={} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" user_input = MOCK_REAUTH_INPUT.copy() @@ -122,7 +122,7 @@ async def test_full_reauth_flow_implementation( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert entry.data[CONF_API_KEY] == "test-api-key-reauth" @@ -139,7 +139,7 @@ async def test_full_user_flow_implementation( context={CONF_SOURCE: SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" user_input = MOCK_USER_INPUT.copy() @@ -149,7 +149,7 @@ async def test_full_user_flow_implementation( user_input=user_input, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "192.168.1.189" assert result["data"] @@ -166,7 +166,7 @@ async def test_full_user_flow_advanced_options( DOMAIN, context={CONF_SOURCE: SOURCE_USER, "show_advanced_options": True} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" user_input = { @@ -179,7 +179,7 @@ async def test_full_user_flow_advanced_options( user_input=user_input, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "192.168.1.189" assert result["data"] @@ -201,7 +201,7 @@ async def test_options_flow( result = await hass.config_entries.options.async_init(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( @@ -210,6 +210,6 @@ async def test_options_flow( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_UPCOMING_DAYS] == 2 assert result["data"][CONF_WANTED_MAX_ITEMS] == 100 diff --git a/tests/components/songpal/test_config_flow.py b/tests/components/songpal/test_config_flow.py index 338207a5d13..12c1ef3ec70 100644 --- a/tests/components/songpal/test_config_flow.py +++ b/tests/components/songpal/test_config_flow.py @@ -77,7 +77,7 @@ async def test_flow_ssdp(hass: HomeAssistant) -> None: 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"] == FRIENDLY_NAME assert result["data"] == CONF_DATA @@ -91,7 +91,7 @@ async def test_flow_user(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] is None _flow_next(hass, result["flow_id"]) @@ -100,7 +100,7 @@ async def test_flow_user(hass: HomeAssistant) -> None: result["flow_id"], user_input={CONF_ENDPOINT: ENDPOINT}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == MODEL assert result["data"] == { CONF_NAME: MODEL, @@ -119,7 +119,7 @@ async def test_flow_import(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_IMPORT}, data=CONF_DATA ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == FRIENDLY_NAME assert result["data"] == CONF_DATA @@ -135,7 +135,7 @@ async def test_flow_import_without_name(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_IMPORT}, data={CONF_ENDPOINT: ENDPOINT} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == MODEL assert result["data"] == {CONF_NAME: MODEL, CONF_ENDPOINT: ENDPOINT} @@ -163,7 +163,7 @@ async def test_ssdp_bravia(hass: HomeAssistant) -> None: context={"source": SOURCE_SSDP}, data=ssdp_data, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_songpal_device" @@ -175,7 +175,7 @@ async def test_sddp_exist(hass: HomeAssistant) -> None: context={"source": SOURCE_SSDP}, data=SSDP_DATA, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -188,7 +188,7 @@ async def test_user_exist(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=CONF_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" mocked_device.get_supported_methods.assert_called_once() @@ -204,7 +204,7 @@ async def test_import_exist(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_IMPORT}, data=CONF_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" mocked_device.get_supported_methods.assert_called_once() @@ -220,7 +220,7 @@ async def test_user_invalid(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=CONF_DATA ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "cannot_connect"} @@ -237,7 +237,7 @@ async def test_import_invalid(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_IMPORT}, data=CONF_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" mocked_device.get_supported_methods.assert_called_once() diff --git a/tests/components/soundtouch/test_config_flow.py b/tests/components/soundtouch/test_config_flow.py index bc7de5b7fda..264049ab5fc 100644 --- a/tests/components/soundtouch/test_config_flow.py +++ b/tests/components/soundtouch/test_config_flow.py @@ -26,7 +26,7 @@ async def test_user_flow_create_entry( context={CONF_SOURCE: SOURCE_USER}, ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "user" with patch( @@ -41,7 +41,7 @@ async def test_user_flow_create_entry( assert len(mock_setup_entry.mock_calls) == 1 - assert result.get("type") == FlowResultType.CREATE_ENTRY + assert result.get("type") is FlowResultType.CREATE_ENTRY assert result.get("title") == DEVICE_1_NAME assert result.get("data") == { CONF_HOST: DEVICE_1_IP, @@ -65,7 +65,7 @@ async def test_user_flow_cannot_connect( }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} @@ -92,7 +92,7 @@ async def test_zeroconf_flow_create_entry( ), ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "zeroconf_confirm" assert result.get("description_placeholders") == {"name": DEVICE_1_NAME} @@ -105,7 +105,7 @@ async def test_zeroconf_flow_create_entry( assert len(mock_setup_entry.mock_calls) == 1 - assert result.get("type") == FlowResultType.CREATE_ENTRY + assert result.get("type") is FlowResultType.CREATE_ENTRY assert result.get("title") == DEVICE_1_NAME assert result.get("data") == { CONF_HOST: DEVICE_1_IP, diff --git a/tests/components/speedtestdotnet/test_config_flow.py b/tests/components/speedtestdotnet/test_config_flow.py index f412c71a6ed..f509c91ad20 100644 --- a/tests/components/speedtestdotnet/test_config_flow.py +++ b/tests/components/speedtestdotnet/test_config_flow.py @@ -20,13 +20,13 @@ async def test_flow_works(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( speedtestdotnet.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={} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY async def test_options(hass: HomeAssistant, mock_api: MagicMock) -> None: @@ -41,7 +41,7 @@ async def test_options(hass: HomeAssistant, mock_api: MagicMock) -> None: await hass.async_block_till_done() result = await hass.config_entries.options.async_init(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( @@ -51,7 +51,7 @@ async def test_options(hass: HomeAssistant, mock_api: MagicMock) -> None: }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { CONF_SERVER_NAME: "Country1 - Sponsor1 - Server1", CONF_SERVER_ID: "1", @@ -60,7 +60,7 @@ async def test_options(hass: HomeAssistant, mock_api: MagicMock) -> None: # test setting server name to "*Auto Detect" result = await hass.config_entries.options.async_init(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( @@ -70,7 +70,7 @@ async def test_options(hass: HomeAssistant, mock_api: MagicMock) -> None: }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { CONF_SERVER_NAME: "*Auto Detect", CONF_SERVER_ID: None, @@ -86,5 +86,5 @@ async def test_integration_already_configured(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( speedtestdotnet.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" diff --git a/tests/components/spider/test_config_flow.py b/tests/components/spider/test_config_flow.py index 1fb61573216..69f97130f8c 100644 --- a/tests/components/spider/test_config_flow.py +++ b/tests/components/spider/test_config_flow.py @@ -4,10 +4,11 @@ from unittest.mock import Mock, patch import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.spider.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 @@ -34,7 +35,7 @@ async def test_user(hass: HomeAssistant, spider) -> 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" with ( @@ -50,7 +51,7 @@ async def test_user(hass: HomeAssistant, spider) -> 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"] == DOMAIN assert result["data"][CONF_USERNAME] == USERNAME assert result["data"][CONF_PASSWORD] == PASSWORD @@ -80,7 +81,7 @@ async def test_import(hass: HomeAssistant, spider) -> 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"] == DOMAIN assert result["data"][CONF_USERNAME] == USERNAME assert result["data"][CONF_PASSWORD] == PASSWORD @@ -99,7 +100,7 @@ async def test_abort_if_already_setup(hass: HomeAssistant, spider) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER}, data=SPIDER_USER_DATA ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" # Should fail, config exist (flow) @@ -107,5 +108,5 @@ async def test_abort_if_already_setup(hass: HomeAssistant, spider) -> None: DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, data=SPIDER_USER_DATA ) - 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/spotify/test_config_flow.py b/tests/components/spotify/test_config_flow.py index 1ab4e46bd55..6de549c8bc7 100644 --- a/tests/components/spotify/test_config_flow.py +++ b/tests/components/spotify/test_config_flow.py @@ -7,7 +7,6 @@ from unittest.mock import patch import pytest from spotipy import SpotifyException -from homeassistant import data_entry_flow from homeassistant.components import zeroconf from homeassistant.components.application_credentials import ( ClientCredential, @@ -16,6 +15,7 @@ from homeassistant.components.application_credentials import ( from homeassistant.components.spotify.const import DOMAIN from homeassistant.config_entries import SOURCE_REAUTH, SOURCE_USER, SOURCE_ZEROCONF from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from homeassistant.helpers import config_entry_oauth2_flow from homeassistant.setup import async_setup_component @@ -53,14 +53,14 @@ async def test_abort_if_no_configuration(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "missing_credentials" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_ZEROCONF}, data=BLANK_ZEROCONF_INFO ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "missing_credentials" @@ -72,7 +72,7 @@ async def test_zeroconf_abort_if_existing_entry(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_ZEROCONF}, data=BLANK_ZEROCONF_INFO ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -96,7 +96,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"] == ( "https://accounts.spotify.com/authorize" "?response_type=code&client_id=client" @@ -181,7 +181,7 @@ async def test_abort_if_spotify_error( ): 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 assert result["reason"] == "connection_error" @@ -306,7 +306,7 @@ async def test_reauth_account_mismatch( spotify_mock.return_value.current_user.return_value = {"id": "fake_id"} 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 assert result["reason"] == "reauth_account_mismatch" @@ -316,5 +316,5 @@ async def test_abort_if_no_reauth_entry(hass: HomeAssistant) -> None: DOMAIN, context={"source": "reauth_confirm"} ) - assert result.get("type") == data_entry_flow.FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "reauth_account_mismatch" diff --git a/tests/components/sql/test_config_flow.py b/tests/components/sql/test_config_flow.py index 7b3b0aaf350..93cde0bccdd 100644 --- a/tests/components/sql/test_config_flow.py +++ b/tests/components/sql/test_config_flow.py @@ -42,7 +42,7 @@ async def test_form(recorder_mock: Recorder, 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 patch( @@ -55,7 +55,7 @@ async def test_form(recorder_mock: Recorder, 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"] == "Get Value" assert result2["options"] == { "name": "Get Value", @@ -76,7 +76,7 @@ async def test_form_with_value_template( 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 patch( @@ -89,7 +89,7 @@ async def test_form_with_value_template( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Get Value" assert result2["options"] == { "name": "Get Value", @@ -107,7 +107,7 @@ async def test_flow_fails_db_url(recorder_mock: Recorder, hass: HomeAssistant) - DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result4["type"] == FlowResultType.FORM + assert result4["type"] is FlowResultType.FORM assert result4["step_id"] == config_entries.SOURCE_USER with patch( @@ -130,7 +130,7 @@ async def test_flow_fails_invalid_query( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result4["type"] == FlowResultType.FORM + assert result4["type"] is FlowResultType.FORM assert result4["step_id"] == config_entries.SOURCE_USER result5 = await hass.config_entries.flow.async_configure( @@ -138,7 +138,7 @@ async def test_flow_fails_invalid_query( user_input=ENTRY_CONFIG_INVALID_QUERY, ) - assert result5["type"] == FlowResultType.FORM + assert result5["type"] is FlowResultType.FORM assert result5["errors"] == { "query": "query_invalid", } @@ -148,7 +148,7 @@ async def test_flow_fails_invalid_query( user_input=ENTRY_CONFIG_INVALID_QUERY_2, ) - assert result6["type"] == FlowResultType.FORM + assert result6["type"] is FlowResultType.FORM assert result6["errors"] == { "query": "query_invalid", } @@ -158,7 +158,7 @@ async def test_flow_fails_invalid_query( user_input=ENTRY_CONFIG_INVALID_QUERY_3, ) - assert result6["type"] == FlowResultType.FORM + assert result6["type"] is FlowResultType.FORM assert result6["errors"] == { "query": "query_invalid", } @@ -168,7 +168,7 @@ async def test_flow_fails_invalid_query( user_input=ENTRY_CONFIG_QUERY_NO_READ_ONLY, ) - assert result5["type"] == FlowResultType.FORM + assert result5["type"] is FlowResultType.FORM assert result5["errors"] == { "query": "query_no_read_only", } @@ -178,7 +178,7 @@ async def test_flow_fails_invalid_query( user_input=ENTRY_CONFIG_QUERY_NO_READ_ONLY_CTE, ) - assert result6["type"] == FlowResultType.FORM + assert result6["type"] is FlowResultType.FORM assert result6["errors"] == { "query": "query_no_read_only", } @@ -188,7 +188,7 @@ async def test_flow_fails_invalid_query( user_input=ENTRY_CONFIG_MULTIPLE_QUERIES, ) - assert result6["type"] == FlowResultType.FORM + assert result6["type"] is FlowResultType.FORM assert result6["errors"] == { "query": "multiple_queries", } @@ -198,7 +198,7 @@ async def test_flow_fails_invalid_query( user_input=ENTRY_CONFIG_NO_RESULTS, ) - assert result5["type"] == FlowResultType.FORM + assert result5["type"] is FlowResultType.FORM assert result5["errors"] == { "query": "query_invalid", } @@ -208,7 +208,7 @@ async def test_flow_fails_invalid_query( user_input=ENTRY_CONFIG, ) - assert result5["type"] == FlowResultType.CREATE_ENTRY + assert result5["type"] is FlowResultType.CREATE_ENTRY assert result5["title"] == "Get Value" assert result5["options"] == { "name": "Get Value", @@ -228,7 +228,7 @@ async def test_flow_fails_invalid_column_name( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result4["type"] == FlowResultType.FORM + assert result4["type"] is FlowResultType.FORM assert result4["step_id"] == "user" result5 = await hass.config_entries.flow.async_configure( @@ -236,7 +236,7 @@ async def test_flow_fails_invalid_column_name( user_input=ENTRY_CONFIG_INVALID_COLUMN_NAME, ) - assert result5["type"] == FlowResultType.FORM + assert result5["type"] is FlowResultType.FORM assert result5["errors"] == { "column": "column_invalid", } @@ -246,7 +246,7 @@ async def test_flow_fails_invalid_column_name( user_input=ENTRY_CONFIG, ) - assert result5["type"] == FlowResultType.CREATE_ENTRY + assert result5["type"] is FlowResultType.CREATE_ENTRY assert result5["title"] == "Get Value" assert result5["options"] == { "name": "Get Value", @@ -284,7 +284,7 @@ async def test_options_flow(recorder_mock: Recorder, hass: HomeAssistant) -> Non result = await hass.config_entries.options.async_init(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( @@ -300,7 +300,7 @@ async def test_options_flow(recorder_mock: Recorder, hass: HomeAssistant) -> Non }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "name": "Get Value", "query": "SELECT 5 as size", @@ -334,7 +334,7 @@ async def test_options_flow_name_previously_removed( result = await hass.config_entries.options.async_init(entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" with patch( @@ -353,7 +353,7 @@ async def test_options_flow_name_previously_removed( await hass.async_block_till_done() assert len(mock_setup_entry.mock_calls) == 1 - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "name": "Get Value Title", "query": "SELECT 5 as size", @@ -436,7 +436,7 @@ async def test_options_flow_fails_invalid_query( user_input=ENTRY_CONFIG_INVALID_QUERY_OPT, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == { "query": "query_invalid", } @@ -446,7 +446,7 @@ async def test_options_flow_fails_invalid_query( user_input=ENTRY_CONFIG_INVALID_QUERY_2_OPT, ) - assert result3["type"] == FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["errors"] == { "query": "query_invalid", } @@ -456,7 +456,7 @@ async def test_options_flow_fails_invalid_query( user_input=ENTRY_CONFIG_INVALID_QUERY_3_OPT, ) - assert result3["type"] == FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["errors"] == { "query": "query_invalid", } @@ -466,7 +466,7 @@ async def test_options_flow_fails_invalid_query( user_input=ENTRY_CONFIG_QUERY_NO_READ_ONLY_OPT, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == { "query": "query_no_read_only", } @@ -476,7 +476,7 @@ async def test_options_flow_fails_invalid_query( user_input=ENTRY_CONFIG_QUERY_NO_READ_ONLY_CTE_OPT, ) - assert result3["type"] == FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["errors"] == { "query": "query_no_read_only", } @@ -486,7 +486,7 @@ async def test_options_flow_fails_invalid_query( user_input=ENTRY_CONFIG_MULTIPLE_QUERIES_OPT, ) - assert result3["type"] == FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["errors"] == { "query": "multiple_queries", } @@ -501,7 +501,7 @@ async def test_options_flow_fails_invalid_query( }, ) - assert result4["type"] == FlowResultType.CREATE_ENTRY + assert result4["type"] is FlowResultType.CREATE_ENTRY assert result4["data"] == { "name": "Get Value", "query": "SELECT 5 as size", @@ -540,7 +540,7 @@ async def test_options_flow_fails_invalid_column_name( user_input=ENTRY_CONFIG_INVALID_COLUMN_NAME_OPT, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == { "column": "column_invalid", } @@ -554,7 +554,7 @@ async def test_options_flow_fails_invalid_column_name( }, ) - assert result4["type"] == FlowResultType.CREATE_ENTRY + assert result4["type"] is FlowResultType.CREATE_ENTRY assert result4["data"] == { "name": "Get Value", "query": "SELECT 5 as value", @@ -589,7 +589,7 @@ async def test_options_flow_db_url_empty( result = await hass.config_entries.options.async_init(entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" with ( @@ -611,7 +611,7 @@ async def test_options_flow_db_url_empty( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "name": "Get Value", "query": "SELECT 5 as size", @@ -627,7 +627,7 @@ async def test_full_flow_not_recorder_db( 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 ( @@ -650,7 +650,7 @@ async def test_full_flow_not_recorder_db( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Get Value" assert result2["options"] == { "name": "Get Value", @@ -663,7 +663,7 @@ async def test_full_flow_not_recorder_db( result = await hass.config_entries.options.async_init(entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" with ( @@ -686,7 +686,7 @@ async def test_full_flow_not_recorder_db( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "name": "Get Value", "db_url": "sqlite://path/to/db.db", @@ -711,7 +711,7 @@ async def test_full_flow_not_recorder_db( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "name": "Get Value", "db_url": "sqlite://path/to/db.db", @@ -745,7 +745,7 @@ async def test_device_state_class(recorder_mock: Recorder, hass: HomeAssistant) entry.add_to_hass(hass) result = await hass.config_entries.options.async_init(entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" with patch( @@ -764,7 +764,7 @@ async def test_device_state_class(recorder_mock: Recorder, hass: HomeAssistant) ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["data"] == { "name": "Get Value", "query": "SELECT 5 as value", @@ -775,7 +775,7 @@ async def test_device_state_class(recorder_mock: Recorder, hass: HomeAssistant) } result = await hass.config_entries.options.async_init(entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" with patch( @@ -792,7 +792,7 @@ async def test_device_state_class(recorder_mock: Recorder, hass: HomeAssistant) ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert "device_class" not in result3["data"] assert "state_class" not in result3["data"] assert result3["data"] == { diff --git a/tests/components/squeezebox/test_config_flow.py b/tests/components/squeezebox/test_config_flow.py index dc82b658163..0a03bcc291c 100644 --- a/tests/components/squeezebox/test_config_flow.py +++ b/tests/components/squeezebox/test_config_flow.py @@ -55,7 +55,7 @@ async def test_user_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"] == "edit" assert CONF_HOST in result["data_schema"].schema for key in result["data_schema"].schema: @@ -73,7 +73,7 @@ async def test_user_form(hass: HomeAssistant) -> None: CONF_HTTPS: False, }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == HOST assert result["data"] == { CONF_HOST: HOST, @@ -99,14 +99,14 @@ async def test_user_form_timeout(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"] == {"base": "no_server_found"} # simulate manual input of host result2 = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_HOST: HOST2} ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "edit" assert CONF_HOST in result2["data_schema"].schema for key in result2["data_schema"].schema: @@ -137,7 +137,7 @@ async def test_user_form_duplicate(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"] == {"base": "no_server_found"} @@ -162,7 +162,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None: }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "invalid_auth"} @@ -186,7 +186,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None: }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} @@ -201,7 +201,7 @@ async def test_discovery(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_INTEGRATION_DISCOVERY}, data={CONF_HOST: HOST, CONF_PORT: PORT, "uuid": UUID}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "edit" @@ -213,7 +213,7 @@ async def test_discovery_no_uuid(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_INTEGRATION_DISCOVERY}, data={CONF_HOST: HOST, CONF_PORT: PORT, CONF_HTTPS: False}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "edit" @@ -238,7 +238,7 @@ async def test_dhcp_discovery(hass: HomeAssistant) -> None: hostname="any", ), ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "edit" @@ -260,7 +260,7 @@ async def test_dhcp_discovery_no_server_found(hass: HomeAssistant) -> None: hostname="any", ), ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" @@ -279,4 +279,4 @@ async def test_dhcp_discovery_existing_player(hass: HomeAssistant) -> None: hostname="any", ), ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT diff --git a/tests/components/srp_energy/test_config_flow.py b/tests/components/srp_energy/test_config_flow.py index 8d4904bf00d..bef1acab855 100644 --- a/tests/components/srp_energy/test_config_flow.py +++ b/tests/components/srp_energy/test_config_flow.py @@ -31,7 +31,7 @@ async def test_show_form( DOMAIN, context={CONF_SOURCE: SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -44,7 +44,7 @@ async def test_show_form( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == ACCNT_NAME assert "data" in result @@ -74,7 +74,7 @@ async def test_form_invalid_account( flow_id=result["flow_id"], user_input=TEST_CONFIG_HOME ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "invalid_account"} @@ -93,7 +93,7 @@ async def test_form_invalid_auth( flow_id=result["flow_id"], user_input=TEST_CONFIG_HOME ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "invalid_auth"} @@ -112,7 +112,7 @@ async def test_form_unknown_error( flow_id=result["flow_id"], user_input=TEST_CONFIG_HOME ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "unknown" @@ -135,7 +135,7 @@ async def test_flow_entry_already_configured( DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data=user_input_second ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -156,7 +156,7 @@ async def test_flow_multiple_configs( ) # Verify created - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == ACCNT_NAME_2 assert "data" in result diff --git a/tests/components/starlink/test_config_flow.py b/tests/components/starlink/test_config_flow.py index 5b0e122ad5d..613e9b0fc7a 100644 --- a/tests/components/starlink/test_config_flow.py +++ b/tests/components/starlink/test_config_flow.py @@ -1,10 +1,11 @@ """Test the Starlink config flow.""" -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.starlink.const import DOMAIN from homeassistant.config_entries import SOURCE_USER from homeassistant.const import CONF_IP_ADDRESS from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from .patchers import DEVICE_FOUND_PATCHER, NO_DEVICE_PATCHER, SETUP_ENTRY_PATCHER @@ -27,7 +28,7 @@ async def test_flow_user_fails_can_succeed(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"] with DEVICE_FOUND_PATCHER, SETUP_ENTRY_PATCHER: @@ -37,7 +38,7 @@ async def test_flow_user_fails_can_succeed(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"] == user_input @@ -57,7 +58,7 @@ async def test_flow_user_success(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"] == user_input @@ -85,5 +86,5 @@ async def test_flow_user_duplicate_abort(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/steam_online/test_config_flow.py b/tests/components/steam_online/test_config_flow.py index 00b47ea48bd..9292f58d231 100644 --- a/tests/components/steam_online/test_config_flow.py +++ b/tests/components/steam_online/test_config_flow.py @@ -4,11 +4,11 @@ from unittest.mock import patch import steam -from homeassistant import data_entry_flow from homeassistant.components.steam_online.const import CONF_ACCOUNTS, DOMAIN from homeassistant.config_entries import SOURCE_REAUTH, SOURCE_USER from homeassistant.const import CONF_API_KEY, CONF_SOURCE from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from homeassistant.helpers import entity_registry as er from . import ( @@ -42,7 +42,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"] == ACCOUNT_NAME_1 assert result["data"] == CONF_DATA assert result["options"] == CONF_OPTIONS @@ -56,7 +56,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" @@ -68,7 +68,7 @@ async def test_flow_user_invalid_auth(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_auth" @@ -79,7 +79,7 @@ async def test_flow_user_invalid_account(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_account" @@ -91,7 +91,7 @@ async def test_flow_user_unknown(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" @@ -104,7 +104,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" @@ -121,20 +121,20 @@ async def test_flow_reauth(hass: HomeAssistant) -> None: }, data=CONF_DATA, ) - assert result["type"] == data_entry_flow.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"], user_input={}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" new_conf = CONF_DATA | {CONF_API_KEY: "1234567890"} result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=new_conf, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert entry.data == new_conf @@ -153,7 +153,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: result = await hass.config_entries.options.async_init(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( @@ -162,7 +162,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_OPTIONS_2 @@ -187,7 +187,7 @@ async def test_options_flow_deselect(hass: HomeAssistant) -> None: return_value=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( @@ -196,7 +196,7 @@ async def test_options_flow_deselect(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_ACCOUNTS: {}} assert len(er.async_get(hass).entities) == 0 @@ -208,7 +208,7 @@ async def test_options_flow_timeout(hass: HomeAssistant) -> None: servicemock.side_effect = steam.api.HTTPTimeoutError 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( @@ -217,7 +217,7 @@ async def test_options_flow_timeout(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_OPTIONS @@ -227,7 +227,7 @@ async def test_options_flow_unauthorized(hass: HomeAssistant) -> None: with patch_interface_private(): 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( @@ -236,5 +236,5 @@ async def test_options_flow_unauthorized(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_OPTIONS diff --git a/tests/components/steamist/test_config_flow.py b/tests/components/steamist/test_config_flow.py index 9480703af9f..6152721ed0a 100644 --- a/tests/components/steamist/test_config_flow.py +++ b/tests/components/steamist/test_config_flow.py @@ -42,7 +42,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 ( @@ -63,7 +63,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"] == "127.0.0.1" assert result2["data"] == { "host": "127.0.0.1", @@ -76,7 +76,7 @@ async def test_form_with_discovery(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 ( @@ -97,7 +97,7 @@ async def test_form_with_discovery(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"] == DEVICE_NAME assert result2["data"] == DEFAULT_ENTRY_DATA assert result2["context"]["unique_id"] == FORMATTED_MAC_ADDRESS @@ -121,7 +121,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"} @@ -142,7 +142,7 @@ async def test_form_unknown_exception(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} @@ -153,13 +153,13 @@ async def test_discovery(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER} ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert not result["errors"] result2 = await hass.config_entries.flow.async_configure(result["flow_id"], {}) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "pick_device" assert not result2["errors"] @@ -167,7 +167,7 @@ async def test_discovery(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 not result["errors"] @@ -189,7 +189,7 @@ async def test_discovery(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"] == DEVICE_NAME assert result3["data"] == DEFAULT_ENTRY_DATA mock_setup.assert_called_once() @@ -199,7 +199,7 @@ async def test_discovery(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 not result["errors"] @@ -207,7 +207,7 @@ async def test_discovery(hass: HomeAssistant) -> None: result2 = await hass.config_entries.flow.async_configure(result["flow_id"], {}) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "no_devices_found" @@ -221,7 +221,7 @@ async def test_discovered_by_discovery_and_dhcp(hass: HomeAssistant) -> None: data=DISCOVERY_30303, ) 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_status(MOCK_ASYNC_GET_STATUS_INACTIVE): @@ -231,7 +231,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_status(MOCK_ASYNC_GET_STATUS_INACTIVE): @@ -245,7 +245,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" @@ -260,7 +260,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 ( @@ -274,7 +274,7 @@ async def test_discovered_by_discovery(hass: HomeAssistant) -> None: 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["data"] == DEFAULT_ENTRY_DATA assert mock_async_setup.called assert mock_async_setup_entry.called @@ -291,7 +291,7 @@ async def test_discovered_by_dhcp(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 ( @@ -305,7 +305,7 @@ async def test_discovered_by_dhcp(hass: HomeAssistant) -> None: 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["data"] == DEFAULT_ENTRY_DATA assert mock_async_setup.called assert mock_async_setup_entry.called @@ -325,7 +325,7 @@ async def test_discovered_by_dhcp_discovery_fails(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -345,7 +345,7 @@ async def test_discovered_by_dhcp_discovery_finds_non_steamist_device( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_steamist_device" @@ -374,7 +374,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 == FORMATTED_MAC_ADDRESS @@ -409,7 +409,7 @@ async def test_discovered_by_dhcp_or_discovery_existing_unique_id_does_not_reloa ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert not mock_setup.called assert not mock_setup_entry.called diff --git a/tests/components/stookalert/test_config_flow.py b/tests/components/stookalert/test_config_flow.py index 9830022203a..3664527cbcf 100644 --- a/tests/components/stookalert/test_config_flow.py +++ b/tests/components/stookalert/test_config_flow.py @@ -16,7 +16,7 @@ async def test_full_user_flow(hass: HomeAssistant) -> 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" with patch( @@ -29,7 +29,7 @@ async def test_full_user_flow(hass: HomeAssistant) -> None: }, ) - assert result2.get("type") == FlowResultType.CREATE_ENTRY + assert result2.get("type") is FlowResultType.CREATE_ENTRY assert result2.get("title") == "Overijssel" assert result2.get("data") == { CONF_PROVINCE: "Overijssel", @@ -55,5 +55,5 @@ async def test_already_configured(hass: HomeAssistant) -> None: }, ) - assert result2.get("type") == FlowResultType.ABORT + assert result2.get("type") is FlowResultType.ABORT assert result2.get("reason") == "already_configured" diff --git a/tests/components/stookwijzer/test_config_flow.py b/tests/components/stookwijzer/test_config_flow.py index 590c93bb3c1..732e8abfc98 100644 --- a/tests/components/stookwijzer/test_config_flow.py +++ b/tests/components/stookwijzer/test_config_flow.py @@ -15,7 +15,7 @@ async def test_full_user_flow(hass: HomeAssistant) -> 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" assert "flow_id" in result @@ -32,7 +32,7 @@ async def test_full_user_flow(hass: HomeAssistant) -> None: }, ) - assert result2.get("type") == FlowResultType.CREATE_ENTRY + assert result2.get("type") is FlowResultType.CREATE_ENTRY assert result2.get("data") == { "location": { "latitude": 1.0, diff --git a/tests/components/streamlabswater/test_config_flow.py b/tests/components/streamlabswater/test_config_flow.py index 4efe80b31e5..0cee3b8b088 100644 --- a/tests/components/streamlabswater/test_config_flow.py +++ b/tests/components/streamlabswater/test_config_flow.py @@ -16,7 +16,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"] == {} with patch("homeassistant.components.streamlabswater.config_flow.StreamlabsClient"): @@ -26,7 +26,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Streamlabs" assert result["data"] == {CONF_API_KEY: "abc"} assert len(mock_setup_entry.mock_calls) == 1 @@ -49,7 +49,7 @@ async def test_form_cannot_connect( {CONF_API_KEY: "abc"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} with patch("homeassistant.components.streamlabswater.config_flow.StreamlabsClient"): @@ -59,7 +59,7 @@ async def test_form_cannot_connect( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Streamlabs" assert result["data"] == {CONF_API_KEY: "abc"} assert len(mock_setup_entry.mock_calls) == 1 @@ -80,7 +80,7 @@ async def test_form_unknown(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> {CONF_API_KEY: "abc"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "unknown"} with patch("homeassistant.components.streamlabswater.config_flow.StreamlabsClient"): @@ -90,7 +90,7 @@ async def test_form_unknown(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Streamlabs" assert result["data"] == {CONF_API_KEY: "abc"} assert len(mock_setup_entry.mock_calls) == 1 @@ -118,7 +118,7 @@ async def test_form_entry_already_exists(hass: HomeAssistant) -> None: {CONF_API_KEY: "abc"}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -132,7 +132,7 @@ async def test_import(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Streamlabs" assert result["data"] == {CONF_API_KEY: "abc"} assert len(mock_setup_entry.mock_calls) == 1 @@ -153,7 +153,7 @@ async def test_import_cannot_connect( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -170,7 +170,7 @@ async def test_import_unknown(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"] == "unknown" @@ -190,5 +190,5 @@ async def test_import_entry_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" diff --git a/tests/components/suez_water/test_config_flow.py b/tests/components/suez_water/test_config_flow.py index a4ab52151d1..1d689ffe0d6 100644 --- a/tests/components/suez_water/test_config_flow.py +++ b/tests/components/suez_water/test_config_flow.py @@ -24,7 +24,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"] == {} with patch("homeassistant.components.suez_water.config_flow.SuezClient"): @@ -34,7 +34,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "test-username" assert result["result"].unique_id == "test-username" assert result["data"] == MOCK_DATA @@ -64,7 +64,7 @@ async def test_form_invalid_auth( MOCK_DATA, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "invalid_auth"} with patch("homeassistant.components.suez_water.config_flow.SuezClient"): @@ -74,7 +74,7 @@ async def test_form_invalid_auth( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "test-username" assert result["result"].unique_id == "test-username" assert result["data"] == MOCK_DATA @@ -100,7 +100,7 @@ async def test_form_already_configured(hass: HomeAssistant) -> None: MOCK_DATA, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -124,7 +124,7 @@ async def test_form_error( MOCK_DATA, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": error} with patch( @@ -135,7 +135,7 @@ async def test_form_error( MOCK_DATA, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "test-username" assert result["data"] == MOCK_DATA assert len(mock_setup_entry.mock_calls) == 1 @@ -149,7 +149,7 @@ async def test_import(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "test-username" assert result["result"].unique_id == "test-username" assert result["data"] == MOCK_DATA @@ -175,7 +175,7 @@ async def test_import_error( DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, data=MOCK_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == reason @@ -196,7 +196,7 @@ async def test_importing_invalid_auth(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, data=MOCK_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "invalid_auth" @@ -214,5 +214,5 @@ async def test_import_already_configured(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, data=MOCK_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/sun/test_config_flow.py b/tests/components/sun/test_config_flow.py index ef13595ed59..c5b5b29976c 100644 --- a/tests/components/sun/test_config_flow.py +++ b/tests/components/sun/test_config_flow.py @@ -18,7 +18,7 @@ async def test_full_user_flow(hass: HomeAssistant) -> 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" with patch( @@ -30,7 +30,7 @@ async def test_full_user_flow(hass: HomeAssistant) -> None: user_input={}, ) - assert result.get("type") == FlowResultType.CREATE_ENTRY + assert result.get("type") is FlowResultType.CREATE_ENTRY assert result.get("title") == "Sun" assert result.get("data") == {} assert result.get("options") == {} @@ -51,7 +51,7 @@ async def test_single_instance_allowed( DOMAIN, context={"source": source} ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "single_instance_allowed" @@ -65,7 +65,7 @@ async def test_import_flow( data={}, ) - assert result.get("type") == FlowResultType.CREATE_ENTRY + assert result.get("type") is FlowResultType.CREATE_ENTRY assert result.get("title") == "Sun" assert result.get("data") == {} assert result.get("options") == {} diff --git a/tests/components/sunweg/test_config_flow.py b/tests/components/sunweg/test_config_flow.py index 54ad4f3f234..3f250ebc994 100644 --- a/tests/components/sunweg/test_config_flow.py +++ b/tests/components/sunweg/test_config_flow.py @@ -4,10 +4,11 @@ from unittest.mock import patch from sunweg.api import APIHelper, SunWegApiError -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.sunweg.const import CONF_PLANT_ID, DOMAIN from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from .common import SUNWEG_MOCK_ENTRY, SUNWEG_USER_INPUT @@ -20,7 +21,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" @@ -35,7 +36,7 @@ async def test_incorrect_login(hass: HomeAssistant) -> None: result["flow_id"], SUNWEG_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"} @@ -53,7 +54,7 @@ async def test_server_unavailable(hass: HomeAssistant) -> None: result["flow_id"], SUNWEG_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": "timeout_connect"} @@ -77,7 +78,7 @@ async def test_reauth(hass: HomeAssistant) -> None: data=mock_entry.data, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" with patch.object(APIHelper, "authenticate", return_value=False): @@ -86,7 +87,7 @@ async def test_reauth(hass: HomeAssistant) -> None: user_input=SUNWEG_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"] == {"base": "invalid_auth"} @@ -98,7 +99,7 @@ async def test_reauth(hass: HomeAssistant) -> None: user_input=SUNWEG_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"] == {"base": "timeout_connect"} @@ -108,7 +109,7 @@ async def test_reauth(hass: HomeAssistant) -> None: user_input=SUNWEG_USER_INPUT, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" entries = hass.config_entries.async_entries() @@ -129,7 +130,7 @@ async def test_no_plants_on_account(hass: HomeAssistant) -> None: result["flow_id"], SUNWEG_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"} @@ -160,7 +161,7 @@ async def test_multiple_plant_ids(hass: HomeAssistant, plant_fixture) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], SUNWEG_USER_INPUT ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "plant" result = await hass.config_entries.flow.async_configure( @@ -168,7 +169,7 @@ async def test_multiple_plant_ids(hass: HomeAssistant, plant_fixture) -> 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] == SUNWEG_USER_INPUT[CONF_USERNAME] assert result["data"][CONF_PASSWORD] == SUNWEG_USER_INPUT[CONF_PASSWORD] assert result["data"][CONF_PLANT_ID] == 123456 @@ -192,7 +193,7 @@ async def test_one_plant_on_account(hass: HomeAssistant, plant_fixture) -> None: result["flow_id"], SUNWEG_USER_INPUT ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_USERNAME] == SUNWEG_USER_INPUT[CONF_USERNAME] assert result["data"][CONF_PASSWORD] == SUNWEG_USER_INPUT[CONF_PASSWORD] assert result["data"][CONF_PLANT_ID] == 123456 diff --git a/tests/components/surepetcare/test_config_flow.py b/tests/components/surepetcare/test_config_flow.py index 67ee5d81247..c8f77012502 100644 --- a/tests/components/surepetcare/test_config_flow.py +++ b/tests/components/surepetcare/test_config_flow.py @@ -23,7 +23,7 @@ async def test_form(hass: HomeAssistant, surepetcare: NonCallableMagicMock) -> N 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_form(hass: HomeAssistant, surepetcare: NonCallableMagicMock) -> N ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Sure Petcare" assert result2["data"] == { "username": "test-username", @@ -67,7 +67,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "invalid_auth"} @@ -89,7 +89,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"} @@ -111,7 +111,7 @@ async def test_form_unknown_error(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} @@ -142,7 +142,7 @@ async def test_flow_entry_already_exists( }, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/swiss_public_transport/test_config_flow.py b/tests/components/swiss_public_transport/test_config_flow.py index 9400423ff98..a18db9bf2de 100644 --- a/tests/components/swiss_public_transport/test_config_flow.py +++ b/tests/components/swiss_public_transport/test_config_flow.py @@ -124,7 +124,7 @@ async def test_flow_user_init_data_already_configured(hass: HomeAssistant) -> No user_input=MOCK_DATA_STEP, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -152,7 +152,7 @@ async def test_import( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == MOCK_DATA_IMPORT assert len(mock_setup_entry.mock_calls) == 1 @@ -179,7 +179,7 @@ async def test_import_error(hass: HomeAssistant, raise_error, text_error) -> Non ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == text_error @@ -199,5 +199,5 @@ async def test_import_already_configured(hass: HomeAssistant) -> None: data=MOCK_DATA_IMPORT, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/switch_as_x/test_config_flow.py b/tests/components/switch_as_x/test_config_flow.py index 59b7d7fadcd..206ae232d56 100644 --- a/tests/components/switch_as_x/test_config_flow.py +++ b/tests/components/switch_as_x/test_config_flow.py @@ -33,7 +33,7 @@ async def test_config_flow( 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( @@ -46,7 +46,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"] == "ceiling" assert result["data"] == {} assert result["options"] == { @@ -91,7 +91,7 @@ async def test_config_flow_registered_entity( 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( @@ -104,7 +104,7 @@ async def test_config_flow_registered_entity( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "ceiling" assert result["data"] == {} assert result["options"] == { @@ -158,7 +158,7 @@ async def test_options( assert config_entry 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 schema_key = next(k for k in schema if k == CONF_INVERT) @@ -170,7 +170,7 @@ async def test_options( CONF_INVERT: False, }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { CONF_ENTITY_ID: "switch.ceiling", CONF_INVERT: False, diff --git a/tests/components/switchbee/test_config_flow.py b/tests/components/switchbee/test_config_flow.py index 99c44365353..50ad6d22cd1 100644 --- a/tests/components/switchbee/test_config_flow.py +++ b/tests/components/switchbee/test_config_flow.py @@ -56,7 +56,7 @@ async def test_form(hass: HomeAssistant, test_cucode_in_coordinator_data) -> Non ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "1.1.1.1" assert result2["data"] == { CONF_HOST: "1.1.1.1", @@ -84,7 +84,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "invalid_auth"} @@ -108,7 +108,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"} @@ -131,7 +131,7 @@ async def test_form_unknown_error(hass: HomeAssistant) -> None: }, ) - assert form_result["type"] == FlowResultType.FORM + assert form_result["type"] is FlowResultType.FORM assert form_result["errors"] == {"base": "unknown"} @@ -177,5 +177,5 @@ async def test_form_entry_exists(hass: HomeAssistant) -> None: }, ) - assert form_result["type"] == FlowResultType.ABORT + assert form_result["type"] is FlowResultType.ABORT assert form_result["reason"] == "already_configured" diff --git a/tests/components/switchbot/test_config_flow.py b/tests/components/switchbot/test_config_flow.py index 3d53dd2848e..a62a100f55a 100644 --- a/tests/components/switchbot/test_config_flow.py +++ b/tests/components/switchbot/test_config_flow.py @@ -46,7 +46,7 @@ async def test_bluetooth_discovery(hass: HomeAssistant) -> None: context={"source": SOURCE_BLUETOOTH}, data=WOHAND_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" with patch_async_setup_entry() as mock_setup_entry: @@ -56,7 +56,7 @@ async def test_bluetooth_discovery(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"] == "Bot EEFF" assert result["data"] == { CONF_ADDRESS: "AA:BB:CC:DD:EE:FF", @@ -73,7 +73,7 @@ async def test_bluetooth_discovery_requires_password(hass: HomeAssistant) -> Non context={"source": SOURCE_BLUETOOTH}, data=WOHAND_ENCRYPTED_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "password" with patch_async_setup_entry() as mock_setup_entry: @@ -83,7 +83,7 @@ async def test_bluetooth_discovery_requires_password(hass: HomeAssistant) -> Non ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Bot 923B" assert result["data"] == { CONF_ADDRESS: "798A8547-2A3D-C609-55FF-73FA824B923B", @@ -101,14 +101,14 @@ async def test_bluetooth_discovery_lock_key(hass: HomeAssistant) -> None: context={"source": SOURCE_BLUETOOTH}, data=WOLOCK_SERVICE_INFO, ) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "lock_choose_method" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={"next_step_id": "lock_key"} ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "lock_key" assert result["errors"] == {} @@ -125,7 +125,7 @@ async def test_bluetooth_discovery_lock_key(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "lock_key" assert result["errors"] == {"base": "encryption_key_invalid"} @@ -145,7 +145,7 @@ async def test_bluetooth_discovery_lock_key(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"] == "Lock EEFF" assert result["data"] == { CONF_ADDRESS: "aa:bb:cc:dd:ee:ff", @@ -175,7 +175,7 @@ async def test_bluetooth_discovery_already_setup(hass: HomeAssistant) -> None: context={"source": SOURCE_BLUETOOTH}, data=WOHAND_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -186,7 +186,7 @@ async def test_async_step_bluetooth_not_switchbot(hass: HomeAssistant) -> None: context={"source": SOURCE_BLUETOOTH}, data=NOT_SWITCHBOT_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_supported" @@ -197,7 +197,7 @@ async def test_async_step_bluetooth_not_connectable(hass: HomeAssistant) -> None context={"source": SOURCE_BLUETOOTH}, data=WOHAND_SERVICE_INFO_NOT_CONNECTABLE, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_supported" @@ -211,7 +211,7 @@ async def test_user_setup_wohand(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"] == "confirm" assert result["errors"] is None @@ -222,7 +222,7 @@ async def test_user_setup_wohand(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"] == "Bot EEFF" assert result["data"] == { CONF_ADDRESS: "AA:BB:CC:DD:EE:FF", @@ -252,7 +252,7 @@ async def test_user_setup_wohand_already_configured(hass: HomeAssistant) -> None result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -266,7 +266,7 @@ async def test_user_setup_wocurtain(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"] == "confirm" assert result["errors"] is None @@ -277,7 +277,7 @@ async def test_user_setup_wocurtain(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"] == "Curtain EEFF" assert result["data"] == { CONF_ADDRESS: "aa:bb:cc:dd:ee:ff", @@ -302,7 +302,7 @@ async def test_user_setup_wocurtain_or_bot(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 result["errors"] == {} @@ -313,7 +313,7 @@ async def test_user_setup_wocurtain_or_bot(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"] == "Curtain EEFF" assert result["data"] == { CONF_ADDRESS: "aa:bb:cc:dd:ee:ff", @@ -337,7 +337,7 @@ async def test_user_setup_wocurtain_or_bot_with_password(hass: HomeAssistant) -> 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 result["errors"] == {} @@ -345,7 +345,7 @@ async def test_user_setup_wocurtain_or_bot_with_password(hass: HomeAssistant) -> result["flow_id"], {CONF_ADDRESS: "798A8547-2A3D-C609-55FF-73FA824B923B"}, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "password" assert result2["errors"] is None @@ -356,7 +356,7 @@ async def test_user_setup_wocurtain_or_bot_with_password(hass: HomeAssistant) -> ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == "Bot 923B" assert result3["data"] == { CONF_ADDRESS: "798A8547-2A3D-C609-55FF-73FA824B923B", @@ -377,7 +377,7 @@ async def test_user_setup_single_bot_with_password(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"] == "password" assert result["errors"] is None @@ -388,7 +388,7 @@ async def test_user_setup_single_bot_with_password(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"] == "Bot 923B" assert result2["data"] == { CONF_ADDRESS: "798A8547-2A3D-C609-55FF-73FA824B923B", @@ -409,14 +409,14 @@ async def test_user_setup_wolock_key(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "lock_choose_method" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={"next_step_id": "lock_key"} ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "lock_key" assert result["errors"] == {} @@ -433,7 +433,7 @@ async def test_user_setup_wolock_key(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "lock_key" assert result["errors"] == {"base": "encryption_key_invalid"} @@ -453,7 +453,7 @@ async def test_user_setup_wolock_key(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"] == "Lock EEFF" assert result["data"] == { CONF_ADDRESS: "aa:bb:cc:dd:ee:ff", @@ -475,14 +475,14 @@ async def test_user_setup_wolock_auth(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "lock_choose_method" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={"next_step_id": "lock_auth"} ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "lock_auth" assert result["errors"] == {} @@ -498,7 +498,7 @@ async def test_user_setup_wolock_auth(hass: HomeAssistant) -> None: }, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "lock_auth" assert result["errors"] == {"base": "auth_failed"} assert "error from api" in result["description_placeholders"]["error_detail"] @@ -526,7 +526,7 @@ async def test_user_setup_wolock_auth(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"] == "Lock EEFF" assert result["data"] == { CONF_ADDRESS: "aa:bb:cc:dd:ee:ff", @@ -548,14 +548,14 @@ async def test_user_setup_wolock_auth_switchbot_api_down(hass: HomeAssistant) -> result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "lock_choose_method" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={"next_step_id": "lock_auth"} ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "lock_auth" assert result["errors"] == {} @@ -571,7 +571,7 @@ async def test_user_setup_wolock_auth_switchbot_api_down(hass: HomeAssistant) -> }, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -588,7 +588,7 @@ async def test_user_setup_wolock_or_bot(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 result["errors"] == {} @@ -597,14 +597,14 @@ async def test_user_setup_wolock_or_bot(hass: HomeAssistant) -> None: USER_INPUT, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.MENU + assert result["type"] is FlowResultType.MENU assert result["step_id"] == "lock_choose_method" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={"next_step_id": "lock_key"} ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "lock_key" assert result["errors"] == {} @@ -624,7 +624,7 @@ async def test_user_setup_wolock_or_bot(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"] == "Lock EEFF" assert result["data"] == { CONF_ADDRESS: "aa:bb:cc:dd:ee:ff", @@ -645,7 +645,7 @@ async def test_user_setup_wosensor(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"] == "confirm" assert result["errors"] is None @@ -656,7 +656,7 @@ async def test_user_setup_wosensor(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"] == "Meter EEFF" assert result["data"] == { CONF_ADDRESS: "aa:bb:cc:dd:ee:ff", @@ -675,7 +675,7 @@ async def test_user_no_devices(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -688,7 +688,7 @@ async def test_async_step_user_takes_precedence_over_discovery( context={"source": SOURCE_BLUETOOTH}, data=WOCURTAIN_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" with patch( @@ -699,7 +699,7 @@ async def test_async_step_user_takes_precedence_over_discovery( DOMAIN, context={"source": SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM with patch_async_setup_entry() as mock_setup_entry: result2 = await hass.config_entries.flow.async_configure( @@ -707,7 +707,7 @@ async def test_async_step_user_takes_precedence_over_discovery( user_input={}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Curtain EEFF" assert result2["data"] == { CONF_ADDRESS: "aa:bb:cc:dd:ee:ff", @@ -740,7 +740,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: entry = await init_integration(hass) result = await hass.config_entries.options.async_init(entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" assert result["errors"] is None @@ -752,7 +752,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_RETRY_COUNT] == 3 assert len(mock_setup_entry.mock_calls) == 2 @@ -763,7 +763,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: entry = await init_integration(hass) result = await hass.config_entries.options.async_init(entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" assert result["errors"] is None @@ -775,7 +775,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_RETRY_COUNT] == 6 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/switchbot_cloud/test_config_flow.py b/tests/components/switchbot_cloud/test_config_flow.py index 47758d50582..1d49b503ef2 100644 --- a/tests/components/switchbot_cloud/test_config_flow.py +++ b/tests/components/switchbot_cloud/test_config_flow.py @@ -32,7 +32,7 @@ async def _fill_out_form_and_assert_entry_created( ) await hass.async_block_till_done() - assert result_configure["type"] == FlowResultType.CREATE_ENTRY + assert result_configure["type"] is FlowResultType.CREATE_ENTRY assert result_configure["title"] == ENTRY_TITLE assert result_configure["data"] == { CONF_API_TOKEN: "test-token", @@ -46,7 +46,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: result_init = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result_init["type"] == FlowResultType.FORM + assert result_init["type"] is FlowResultType.FORM assert not result_init["errors"] await _fill_out_form_and_assert_entry_created( @@ -82,7 +82,7 @@ async def test_form_fails( }, ) - assert result_configure["type"] == FlowResultType.FORM + assert result_configure["type"] is FlowResultType.FORM assert result_configure["errors"] == {"base": message} await hass.async_block_till_done() diff --git a/tests/components/switcher_kis/test_config_flow.py b/tests/components/switcher_kis/test_config_flow.py index e03c8eb645f..913424abae5 100644 --- a/tests/components/switcher_kis/test_config_flow.py +++ b/tests/components/switcher_kis/test_config_flow.py @@ -23,7 +23,7 @@ async def test_import(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_IMPORT} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Switcher" assert result["data"] == {} @@ -51,7 +51,7 @@ async def test_user_setup(hass: HomeAssistant, mock_bridge) -> None: assert mock_bridge.is_running is False assert len(hass.data[DOMAIN][DATA_DISCOVERY].result()) == 2 - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" assert result["errors"] is None @@ -60,7 +60,7 @@ async def test_user_setup(hass: HomeAssistant, mock_bridge) -> None: ): result2 = await hass.config_entries.flow.async_configure(result["flow_id"], {}) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Switcher" assert result2["result"].data == {} @@ -78,13 +78,13 @@ async def test_user_setup_abort_no_devices_found( assert mock_bridge.is_running is False assert len(hass.data[DOMAIN][DATA_DISCOVERY].result()) == 0 - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" assert result["errors"] is None result2 = await hass.config_entries.flow.async_configure(result["flow_id"], {}) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "no_devices_found" @@ -104,5 +104,5 @@ async def test_single_instance(hass: HomeAssistant, source) -> None: DOMAIN, context={"source": source} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" diff --git a/tests/components/syncthing/test_config_flow.py b/tests/components/syncthing/test_config_flow.py index d97226e422c..82cbd85ffaa 100644 --- a/tests/components/syncthing/test_config_flow.py +++ b/tests/components/syncthing/test_config_flow.py @@ -4,10 +4,11 @@ from unittest.mock import patch from aiosyncthing.exceptions import UnauthorizedError -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.syncthing.const import DOMAIN from homeassistant.const import CONF_NAME, CONF_TOKEN, CONF_URL, CONF_VERIFY_SSL from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -30,7 +31,7 @@ async def test_show_setup_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"] == {} assert result["step_id"] == "user" @@ -54,7 +55,7 @@ async def test_flow_successful(hass: HomeAssistant) -> None: CONF_VERIFY_SSL: VERIFY_SSL, }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "http://127.0.0.1:8384" assert result["data"][CONF_NAME] == NAME assert result["data"][CONF_URL] == URL @@ -76,7 +77,7 @@ async def test_flow_already_configured(hass: HomeAssistant) -> None: data=MOCK_ENTRY, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -90,7 +91,7 @@ async def test_flow_invalid_auth(hass: HomeAssistant) -> None: data=MOCK_ENTRY, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"]["token"] == "invalid_auth" @@ -104,5 +105,5 @@ async def test_flow_cannot_connect(hass: HomeAssistant) -> None: data=MOCK_ENTRY, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"]["base"] == "cannot_connect" diff --git a/tests/components/syncthru/test_config_flow.py b/tests/components/syncthru/test_config_flow.py index 90470431ade..b79e63e1ce7 100644 --- a/tests/components/syncthru/test_config_flow.py +++ b/tests/components/syncthru/test_config_flow.py @@ -5,12 +5,13 @@ from unittest.mock import patch from pysyncthru import SyncThruAPINotSupported -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components import ssdp from homeassistant.components.syncthru.config_flow import SyncThru from homeassistant.components.syncthru.const import DOMAIN from homeassistant.const import CONF_NAME, CONF_URL from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry from tests.test_util.aiohttp import AiohttpClientMocker @@ -45,7 +46,7 @@ async def test_show_setup_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" @@ -69,7 +70,7 @@ async def test_already_configured_by_url( data=FIXTURE_USER_INPUT, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_URL] == FIXTURE_USER_INPUT[CONF_URL] assert result["data"][CONF_NAME] == FIXTURE_USER_INPUT[CONF_NAME] assert result["result"].unique_id == udn @@ -84,7 +85,7 @@ async def test_syncthru_not_supported(hass: HomeAssistant) -> None: data=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"] == {CONF_URL: "syncthru_not_supported"} @@ -101,7 +102,7 @@ async def test_unknown_state(hass: HomeAssistant) -> None: data=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"] == {CONF_URL: "unknown_state"} @@ -123,7 +124,7 @@ async def test_success( ) 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] == FIXTURE_USER_INPUT[CONF_URL] assert len(mock_setup_entry.mock_calls) == 1 @@ -151,7 +152,7 @@ async def test_ssdp(hass: HomeAssistant, aioclient_mock: AiohttpClientMocker) -> ), ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" assert CONF_URL in result["data_schema"].schema for k in result["data_schema"].schema: diff --git a/tests/components/synology_dsm/test_config_flow.py b/tests/components/synology_dsm/test_config_flow.py index 67da3712983..483e22f2359 100644 --- a/tests/components/synology_dsm/test_config_flow.py +++ b/tests/components/synology_dsm/test_config_flow.py @@ -12,7 +12,6 @@ from synology_dsm.exceptions import ( SynologyDSMRequestException, ) -from homeassistant import data_entry_flow from homeassistant.components import ssdp, zeroconf from homeassistant.components.synology_dsm.config_flow import CONF_OTP_CODE from homeassistant.components.synology_dsm.const import ( @@ -46,6 +45,7 @@ from homeassistant.const import ( CONF_VERIFY_SSL, ) from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from .consts import ( DEVICE_TOKEN, @@ -154,7 +154,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" with patch( @@ -174,7 +174,7 @@ async def test_user(hass: HomeAssistant, service: MagicMock) -> None: CONF_PASSWORD: PASSWORD, }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["result"].unique_id == SERIAL assert result["title"] == HOST assert result["data"][CONF_HOST] == HOST @@ -205,7 +205,7 @@ async def test_user(hass: HomeAssistant, service: MagicMock) -> None: CONF_PASSWORD: PASSWORD, }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["result"].unique_id == SERIAL_2 assert result["title"] == HOST assert result["data"][CONF_HOST] == HOST @@ -232,7 +232,7 @@ async def test_user_2sa(hass: HomeAssistant, service_2sa: MagicMock) -> None: context={"source": SOURCE_USER}, data={CONF_HOST: HOST, CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "2sa" # Failed the first time because was too slow to enter the code @@ -242,7 +242,7 @@ async def test_user_2sa(hass: HomeAssistant, service_2sa: MagicMock) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_OTP_CODE: "000000"} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "2sa" assert result["errors"] == {CONF_OTP_CODE: "otp_failed"} @@ -258,7 +258,7 @@ async def test_user_2sa(hass: HomeAssistant, service_2sa: MagicMock) -> None: result["flow_id"], {CONF_OTP_CODE: "123456"} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["result"].unique_id == SERIAL assert result["title"] == HOST assert result["data"][CONF_HOST] == HOST @@ -283,7 +283,7 @@ async def test_user_vdsm(hass: HomeAssistant, service_vdsm: 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" with patch( @@ -303,7 +303,7 @@ async def test_user_vdsm(hass: HomeAssistant, service_vdsm: MagicMock) -> None: CONF_PASSWORD: PASSWORD, }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["result"].unique_id == SERIAL assert result["title"] == HOST assert result["data"][CONF_HOST] == HOST @@ -350,7 +350,7 @@ async def test_reauth(hass: HomeAssistant, service: MagicMock) -> None: CONF_PASSWORD: PASSWORD, }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" with patch( @@ -364,7 +364,7 @@ async def test_reauth(hass: HomeAssistant, service: MagicMock) -> None: CONF_PASSWORD: PASSWORD, }, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" @@ -396,7 +396,7 @@ async def test_reconfig_user(hass: HomeAssistant, service: MagicMock) -> None: context={"source": SOURCE_USER}, data={CONF_HOST: HOST, CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reconfigure_successful" @@ -412,7 +412,7 @@ async def test_login_failed(hass: HomeAssistant, service: MagicMock) -> None: context={"source": SOURCE_USER}, data={CONF_HOST: HOST, CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {CONF_USERNAME: "invalid_auth"} @@ -429,7 +429,7 @@ async def test_connection_failed(hass: HomeAssistant, service: MagicMock) -> Non data={CONF_HOST: HOST, CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {CONF_HOST: "cannot_connect"} @@ -444,7 +444,7 @@ async def test_unknown_failed(hass: HomeAssistant, service: MagicMock) -> None: data={CONF_HOST: HOST, CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "unknown"} @@ -462,7 +462,7 @@ async def test_missing_data_after_login( context={"source": SOURCE_USER}, data={CONF_HOST: HOST, CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "missing_data"} @@ -483,7 +483,7 @@ async def test_form_ssdp(hass: HomeAssistant, service: MagicMock) -> None: }, ), ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "link" assert result["errors"] == {} @@ -495,7 +495,7 @@ async def test_form_ssdp(hass: HomeAssistant, service: MagicMock) -> None: result["flow_id"], {CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["result"].unique_id == SERIAL assert result["title"] == "mydsm" assert result["data"][CONF_HOST] == "192.168.1.5" @@ -539,7 +539,7 @@ async def test_reconfig_ssdp(hass: HomeAssistant, service: MagicMock) -> None: }, ), ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reconfigure_successful" @@ -582,7 +582,7 @@ async def test_skip_reconfig_ssdp( }, ), ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -615,7 +615,7 @@ async def test_existing_ssdp(hass: HomeAssistant, service: MagicMock) -> None: }, ), ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -637,7 +637,7 @@ async def test_options_flow(hass: HomeAssistant, service: MagicMock) -> None: assert config_entry.options == {} 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" # Scan interval @@ -646,7 +646,7 @@ async def test_options_flow(hass: HomeAssistant, service: MagicMock) -> None: 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[CONF_SCAN_INTERVAL] == DEFAULT_SCAN_INTERVAL assert config_entry.options[CONF_TIMEOUT] == DEFAULT_TIMEOUT assert config_entry.options[CONF_SNAPSHOT_QUALITY] == DEFAULT_SNAPSHOT_QUALITY @@ -657,7 +657,7 @@ async def test_options_flow(hass: HomeAssistant, service: MagicMock) -> None: result["flow_id"], user_input={CONF_SCAN_INTERVAL: 2, CONF_TIMEOUT: 30, CONF_SNAPSHOT_QUALITY: 0}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options[CONF_SCAN_INTERVAL] == 2 assert config_entry.options[CONF_TIMEOUT] == 30 assert config_entry.options[CONF_SNAPSHOT_QUALITY] == 0 @@ -682,7 +682,7 @@ async def test_discovered_via_zeroconf(hass: HomeAssistant, service: MagicMock) }, ), ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "link" assert result["errors"] == {} @@ -694,7 +694,7 @@ async def test_discovered_via_zeroconf(hass: HomeAssistant, service: MagicMock) result["flow_id"], {CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["result"].unique_id == SERIAL assert result["title"] == "mydsm" assert result["data"][CONF_HOST] == "192.168.1.5" @@ -728,5 +728,5 @@ async def test_discovered_via_zeroconf_missing_mac( properties={}, ), ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_mac_address" diff --git a/tests/components/system_bridge/test_config_flow.py b/tests/components/system_bridge/test_config_flow.py index 0047cc62365..16a6f5d0f56 100644 --- a/tests/components/system_bridge/test_config_flow.py +++ b/tests/components/system_bridge/test_config_flow.py @@ -8,9 +8,10 @@ from systembridgeconnector.exceptions import ( ConnectionErrorException, ) -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.system_bridge.const import DOMAIN from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from . import ( FIXTURE_AUTH_INPUT, @@ -32,7 +33,7 @@ async def test_show_user_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" @@ -42,7 +43,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"] is None with ( @@ -67,7 +68,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"] == "test-bridge" assert result2["data"] == FIXTURE_USER_INPUT assert len(mock_setup_entry.mock_calls) == 1 @@ -79,7 +80,7 @@ async def test_form_cannot_connect(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"] is None with patch( @@ -91,7 +92,7 @@ async def test_form_cannot_connect(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["step_id"] == "user" assert result2["errors"] == {"base": "cannot_connect"} @@ -102,7 +103,7 @@ async def test_form_connection_closed_cannot_connect(hass: HomeAssistant) -> Non 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 ( @@ -123,7 +124,7 @@ async def test_form_connection_closed_cannot_connect(hass: HomeAssistant) -> Non ) await hass.async_block_till_done() - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "user" assert result2["errors"] == {"base": "cannot_connect"} @@ -134,7 +135,7 @@ async def test_form_timeout_cannot_connect(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"] is None with ( @@ -155,7 +156,7 @@ async def test_form_timeout_cannot_connect(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["step_id"] == "user" assert result2["errors"] == {"base": "cannot_connect"} @@ -166,7 +167,7 @@ async def test_form_invalid_auth(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"] is None with ( @@ -187,7 +188,7 @@ async def test_form_invalid_auth(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["step_id"] == "user" assert result2["errors"] == {"base": "invalid_auth"} @@ -198,7 +199,7 @@ async def test_form_uuid_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"] is None with ( @@ -219,7 +220,7 @@ async def test_form_uuid_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["step_id"] == "user" assert result2["errors"] == {"base": "cannot_connect"} @@ -230,7 +231,7 @@ async def test_form_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"] is None with ( @@ -251,7 +252,7 @@ async def test_form_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["step_id"] == "user" assert result2["errors"] == {"base": "unknown"} @@ -262,7 +263,7 @@ async def test_reauth_authorization_error(hass: HomeAssistant) -> None: DOMAIN, context={"source": "reauth"}, data=FIXTURE_USER_INPUT ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "authenticate" with ( @@ -283,7 +284,7 @@ async def test_reauth_authorization_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["step_id"] == "authenticate" assert result2["errors"] == {"base": "invalid_auth"} @@ -294,7 +295,7 @@ async def test_reauth_connection_error(hass: HomeAssistant) -> None: DOMAIN, context={"source": "reauth"}, data=FIXTURE_USER_INPUT ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "authenticate" with patch( @@ -306,7 +307,7 @@ async def test_reauth_connection_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["step_id"] == "authenticate" assert result2["errors"] == {"base": "cannot_connect"} @@ -328,7 +329,7 @@ async def test_reauth_connection_error(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"] == "authenticate" assert result3["errors"] == {"base": "cannot_connect"} @@ -339,7 +340,7 @@ async def test_reauth_connection_closed_error(hass: HomeAssistant) -> None: DOMAIN, context={"source": "reauth"}, data=FIXTURE_USER_INPUT ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "authenticate" with ( @@ -360,7 +361,7 @@ async def test_reauth_connection_closed_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["step_id"] == "authenticate" assert result2["errors"] == {"base": "cannot_connect"} @@ -376,7 +377,7 @@ async def test_reauth_flow(hass: HomeAssistant) -> None: DOMAIN, context={"source": "reauth"}, data=FIXTURE_USER_INPUT ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "authenticate" with ( @@ -401,7 +402,7 @@ 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" @@ -414,7 +415,7 @@ async def test_zeroconf_flow(hass: HomeAssistant) -> None: data=FIXTURE_ZEROCONF, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert not result["errors"] with ( @@ -439,7 +440,7 @@ async def test_zeroconf_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"] == "1.1.1.1" assert result2["data"] == FIXTURE_ZEROCONF_INPUT assert len(mock_setup_entry.mock_calls) == 1 @@ -454,7 +455,7 @@ async def test_zeroconf_cannot_connect(hass: HomeAssistant) -> None: data=FIXTURE_ZEROCONF, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert not result["errors"] with patch( @@ -466,7 +467,7 @@ async def test_zeroconf_cannot_connect(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["step_id"] == "authenticate" assert result2["errors"] == {"base": "cannot_connect"} @@ -480,5 +481,5 @@ async def test_zeroconf_bad_zeroconf_info(hass: HomeAssistant) -> None: data=FIXTURE_ZEROCONF_BAD, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "unknown" diff --git a/tests/components/systemmonitor/test_config_flow.py b/tests/components/systemmonitor/test_config_flow.py index eb6f5778805..bd98099accc 100644 --- a/tests/components/systemmonitor/test_config_flow.py +++ b/tests/components/systemmonitor/test_config_flow.py @@ -25,7 +25,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> 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"], @@ -33,7 +33,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["options"] == {} assert len(mock_setup_entry.mock_calls) == 1 @@ -60,7 +60,7 @@ async def test_import( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["options"] == { "binary_sensor": {"process": ["systemd", "octave-cli"]}, "resources": [ @@ -99,7 +99,7 @@ async def test_form_already_configured( 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"], @@ -107,7 +107,7 @@ async def test_form_already_configured( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -147,7 +147,7 @@ async def test_import_already_configured( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" issue = issue_registry.async_get_issue( @@ -179,7 +179,7 @@ async def test_add_and_remove_processes( 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( @@ -190,7 +190,7 @@ async def test_add_and_remove_processes( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "binary_sensor": { CONF_PROCESS: ["systemd"], @@ -200,7 +200,7 @@ async def test_add_and_remove_processes( # Add another 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( @@ -211,7 +211,7 @@ async def test_add_and_remove_processes( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "binary_sensor": { CONF_PROCESS: ["systemd", "octave-cli"], @@ -230,7 +230,7 @@ async def test_add_and_remove_processes( # Remove one 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( @@ -241,7 +241,7 @@ async def test_add_and_remove_processes( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "binary_sensor": { CONF_PROCESS: ["systemd"], @@ -251,7 +251,7 @@ async def test_add_and_remove_processes( # Remove last 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( @@ -262,7 +262,7 @@ async def test_add_and_remove_processes( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "binary_sensor": {CONF_PROCESS: []}, } diff --git a/tests/components/tado/test_config_flow.py b/tests/components/tado/test_config_flow.py index c2bbe4f37de..c954a4b79af 100644 --- a/tests/components/tado/test_config_flow.py +++ b/tests/components/tado/test_config_flow.py @@ -56,7 +56,7 @@ async def test_form_exceptions( {"username": "test-username", "password": "test-password"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": error} # Test a retry to recover, upon failure @@ -78,7 +78,7 @@ async def test_form_exceptions( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "myhome" assert result["data"] == { "username": "test-username", @@ -95,7 +95,7 @@ async def test_options_flow(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 patch( @@ -108,7 +108,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: result = await hass.config_entries.options.async_init( entry.entry_id, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -117,7 +117,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == {CONF_FALLBACK: CONST_OVERLAY_TADO_DEFAULT} @@ -127,7 +127,7 @@ async def test_create_entry(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"] == {} mock_tado_api = _get_mock_tado_api(getMe={"homes": [{"id": 1, "name": "myhome"}]}) @@ -148,7 +148,7 @@ async def test_create_entry(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"] == "myhome" assert result["data"] == { "username": "test-username", @@ -295,7 +295,7 @@ async def test_import_step(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "username": "test-username", "password": "test-password", @@ -331,7 +331,7 @@ async def test_import_step_existing_entry(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" assert mock_setup_entry.call_count == 0 @@ -353,7 +353,7 @@ async def test_import_step_validation_failed(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "import_failed" @@ -374,7 +374,7 @@ async def test_import_step_device_authentication_failed(hass: HomeAssistant) -> ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "import_failed_invalid_auth" @@ -406,6 +406,6 @@ async def test_import_step_unique_id_configured(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" assert mock_setup_entry.call_count == 0 diff --git a/tests/components/tailscale/test_config_flow.py b/tests/components/tailscale/test_config_flow.py index 5bf814a56d6..86daa40d8dc 100644 --- a/tests/components/tailscale/test_config_flow.py +++ b/tests/components/tailscale/test_config_flow.py @@ -23,7 +23,7 @@ async def test_full_user_flow( 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( @@ -34,7 +34,7 @@ async def test_full_user_flow( }, ) - assert result2.get("type") == FlowResultType.CREATE_ENTRY + assert result2.get("type") is FlowResultType.CREATE_ENTRY assert result2.get("title") == "homeassistant.github" assert result2.get("data") == { CONF_TAILNET: "homeassistant.github", @@ -59,7 +59,7 @@ async def test_full_flow_with_authentication_error( DOMAIN, context={"source": SOURCE_USER} ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "user" mock_tailscale_config_flow.devices.side_effect = TailscaleAuthenticationError @@ -71,7 +71,7 @@ async def test_full_flow_with_authentication_error( }, ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "user" assert result2.get("errors") == {"base": "invalid_auth"} @@ -87,7 +87,7 @@ async def test_full_flow_with_authentication_error( }, ) - assert result3.get("type") == FlowResultType.CREATE_ENTRY + assert result3.get("type") is FlowResultType.CREATE_ENTRY assert result3.get("title") == "homeassistant.github" assert result3.get("data") == { CONF_TAILNET: "homeassistant.github", @@ -113,7 +113,7 @@ async def test_connection_error( }, ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("errors") == {"base": "cannot_connect"} assert len(mock_tailscale_config_flow.devices.mock_calls) == 1 @@ -137,7 +137,7 @@ async def test_reauth_flow( }, data=mock_config_entry.data, ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "reauth_confirm" result2 = await hass.config_entries.flow.async_configure( @@ -146,7 +146,7 @@ async def test_reauth_flow( ) await hass.async_block_till_done() - assert result2.get("type") == FlowResultType.ABORT + assert result2.get("type") is FlowResultType.ABORT assert result2.get("reason") == "reauth_successful" assert mock_config_entry.data == { CONF_TAILNET: "homeassistant.github", @@ -179,7 +179,7 @@ async def test_reauth_with_authentication_error( }, data=mock_config_entry.data, ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "reauth_confirm" mock_tailscale_config_flow.devices.side_effect = TailscaleAuthenticationError @@ -189,7 +189,7 @@ async def test_reauth_with_authentication_error( ) await hass.async_block_till_done() - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "reauth_confirm" assert result2.get("errors") == {"base": "invalid_auth"} @@ -203,7 +203,7 @@ async def test_reauth_with_authentication_error( ) await hass.async_block_till_done() - assert result3.get("type") == FlowResultType.ABORT + assert result3.get("type") is FlowResultType.ABORT assert result3.get("reason") == "reauth_successful" assert mock_config_entry.data == { CONF_TAILNET: "homeassistant.github", @@ -231,7 +231,7 @@ async def test_reauth_api_error( }, data=mock_config_entry.data, ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "reauth_confirm" mock_tailscale_config_flow.devices.side_effect = TailscaleConnectionError @@ -241,6 +241,6 @@ async def test_reauth_api_error( ) await hass.async_block_till_done() - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "reauth_confirm" assert result2.get("errors") == {"base": "cannot_connect"} diff --git a/tests/components/tailwind/test_config_flow.py b/tests/components/tailwind/test_config_flow.py index efd828dcbde..f70ab6e27ff 100644 --- a/tests/components/tailwind/test_config_flow.py +++ b/tests/components/tailwind/test_config_flow.py @@ -40,7 +40,7 @@ async def test_user_flow( 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( @@ -51,7 +51,7 @@ async def test_user_flow( }, ) - assert result2.get("type") == FlowResultType.CREATE_ENTRY + assert result2.get("type") is FlowResultType.CREATE_ENTRY assert result2 == snapshot @@ -81,7 +81,7 @@ async def test_user_flow_errors( }, ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "user" assert result.get("errors") == expected_error @@ -93,7 +93,7 @@ async def test_user_flow_errors( CONF_TOKEN: "123456", }, ) - assert result2.get("type") == FlowResultType.CREATE_ENTRY + assert result2.get("type") is FlowResultType.CREATE_ENTRY async def test_user_flow_unsupported_firmware_version( @@ -110,7 +110,7 @@ async def test_user_flow_unsupported_firmware_version( }, ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "unsupported_firmware" @@ -134,7 +134,7 @@ async def test_user_flow_already_configured( }, ) - 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.1" assert mock_config_entry.data[CONF_TOKEN] == "987654" @@ -166,7 +166,7 @@ async def test_zeroconf_flow( ) assert result.get("step_id") == "zeroconf_confirm" - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM progress = hass.config_entries.flow.async_progress() assert len(progress) == 1 @@ -176,7 +176,7 @@ async def test_zeroconf_flow( result["flow_id"], user_input={CONF_TOKEN: "987654"} ) - assert result2.get("type") == FlowResultType.CREATE_ENTRY + assert result2.get("type") is FlowResultType.CREATE_ENTRY assert result2 == snapshot @@ -205,7 +205,7 @@ async def test_zeroconf_flow_abort_incompatible_properties( ), ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == expected_reason @@ -252,7 +252,7 @@ async def test_zeroconf_flow_errors( }, ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "zeroconf_confirm" assert result2.get("errors") == expected_error @@ -263,7 +263,7 @@ async def test_zeroconf_flow_errors( CONF_TOKEN: "123456", }, ) - assert result3.get("type") == FlowResultType.CREATE_ENTRY + assert result3.get("type") is FlowResultType.CREATE_ENTRY @pytest.mark.usefixtures("mock_tailwind") @@ -297,7 +297,7 @@ async def test_zeroconf_flow_not_discovered_again( ), ) - 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.1" @@ -320,7 +320,7 @@ async def test_reauth_flow( }, data=mock_config_entry.data, ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "reauth_confirm" result2 = await hass.config_entries.flow.async_configure( @@ -329,7 +329,7 @@ async def test_reauth_flow( ) await hass.async_block_till_done() - assert result2.get("type") == FlowResultType.ABORT + assert result2.get("type") is FlowResultType.ABORT assert result2.get("reason") == "reauth_successful" assert mock_config_entry.data[CONF_TOKEN] == "987654" @@ -371,7 +371,7 @@ async def test_reauth_flow_errors( }, ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "reauth_confirm" assert result2.get("errors") == expected_error @@ -383,7 +383,7 @@ async def test_reauth_flow_errors( }, ) - assert result3.get("type") == FlowResultType.ABORT + assert result3.get("type") is FlowResultType.ABORT assert result3.get("reason") == "reauth_successful" @@ -405,7 +405,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.1" @@ -425,5 +425,5 @@ async def test_dhcp_discovery_ignores_unknown(hass: HomeAssistant) -> None: ), ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "unknown" diff --git a/tests/components/tami4/test_config_flow.py b/tests/components/tami4/test_config_flow.py index 341e56bec84..cf81b015254 100644 --- a/tests/components/tami4/test_config_flow.py +++ b/tests/components/tami4/test_config_flow.py @@ -20,7 +20,7 @@ async def test_step_user_valid_number( 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"] == {} @@ -28,7 +28,7 @@ async def test_step_user_valid_number( result["flow_id"], user_input={CONF_PHONE: "+972555555555"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "otp" assert result["errors"] == {} @@ -44,7 +44,7 @@ async def test_step_user_invalid_number( 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"] == {} @@ -52,7 +52,7 @@ async def test_step_user_invalid_number( result["flow_id"], user_input={CONF_PHONE: "+275123"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "invalid_phone"} @@ -74,7 +74,7 @@ async def test_step_user_exception( 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"] == {} @@ -82,7 +82,7 @@ async def test_step_user_exception( result["flow_id"], user_input={CONF_PHONE: "+972555555555"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": expected_error} @@ -99,7 +99,7 @@ async def test_step_otp_valid( 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"] == {} @@ -107,7 +107,7 @@ async def test_step_otp_valid( result["flow_id"], user_input={CONF_PHONE: "+972555555555"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "otp" assert result["errors"] == {} @@ -115,7 +115,7 @@ async def test_step_otp_valid( result["flow_id"], user_input={"otp": "123456"}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Drink Water" assert "refresh_token" in result["data"] @@ -142,7 +142,7 @@ async def test_step_otp_exception( 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"] == {} @@ -150,7 +150,7 @@ async def test_step_otp_exception( result["flow_id"], user_input={CONF_PHONE: "+972555555555"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "otp" assert result["errors"] == {} @@ -158,6 +158,6 @@ async def test_step_otp_exception( result["flow_id"], user_input={"otp": "123456"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "otp" assert result["errors"] == {"base": expected_error} diff --git a/tests/components/tankerkoenig/test_config_flow.py b/tests/components/tankerkoenig/test_config_flow.py index b954598c12a..b255491cb31 100644 --- a/tests/components/tankerkoenig/test_config_flow.py +++ b/tests/components/tankerkoenig/test_config_flow.py @@ -56,7 +56,7 @@ async def test_user(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" with ( @@ -71,13 +71,13 @@ async def test_user(hass: HomeAssistant) -> None: 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"] == "select_station" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_STATIONS_DATA ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_NAME] == "Home" assert result["data"][CONF_API_KEY] == "269534f6-xxxx-xxxx-xxxx-yyyyzzzzxxxx" assert result["data"][CONF_FUEL_TYPES] == ["e5"] @@ -107,14 +107,14 @@ async def test_user_already_configured(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" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_USER_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -123,7 +123,7 @@ async def test_exception_security(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" with patch( @@ -133,7 +133,7 @@ async def test_exception_security(hass: HomeAssistant) -> None: 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"][CONF_API_KEY] == "invalid_auth" @@ -143,7 +143,7 @@ async def test_user_no_stations(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" with patch( @@ -153,7 +153,7 @@ async def test_user_no_stations(hass: HomeAssistant) -> None: 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"][CONF_RADIUS] == "no_stations" @@ -176,7 +176,7 @@ async def test_reauth(hass: HomeAssistant, config_entry: MockConfigEntry) -> Non context={"source": SOURCE_REAUTH, "entry_id": config_entry.entry_id}, data=config_entry.data, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" # re-auth unsuccessful @@ -187,7 +187,7 @@ async def test_reauth(hass: HomeAssistant, config_entry: MockConfigEntry) -> Non CONF_API_KEY: "269534f6-aaaa-bbbb-cccc-yyyyzzzzxxxx", }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["errors"] == {CONF_API_KEY: "invalid_auth"} @@ -199,7 +199,7 @@ async def test_reauth(hass: HomeAssistant, config_entry: MockConfigEntry) -> Non CONF_API_KEY: "269534f6-aaaa-bbbb-cccc-yyyyzzzzxxxx", }, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" mock_setup_entry.assert_called() @@ -224,7 +224,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: return_value=NEARBY_STATIONS, ): result = await hass.config_entries.options.async_init(mock_config.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( @@ -234,7 +234,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: CONF_STATIONS: MOCK_OPTIONS_DATA[CONF_STATIONS], }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert not mock_config.options[CONF_SHOW_ON_MAP] @@ -254,7 +254,7 @@ async def test_options_flow_error(hass: HomeAssistant) -> None: side_effect=TankerkoenigInvalidKeyError("Booom!"), ) as mock_nearby_stations: result = await hass.config_entries.options.async_init(mock_config.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" assert result["errors"] == {"base": "invalid_auth"} @@ -267,5 +267,5 @@ async def test_options_flow_error(hass: HomeAssistant) -> None: CONF_STATIONS: MOCK_OPTIONS_DATA[CONF_STATIONS], }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert not mock_config.options[CONF_SHOW_ON_MAP] diff --git a/tests/components/tautulli/test_config_flow.py b/tests/components/tautulli/test_config_flow.py index e51fbfbad0d..b731067cd72 100644 --- a/tests/components/tautulli/test_config_flow.py +++ b/tests/components/tautulli/test_config_flow.py @@ -21,7 +21,7 @@ async def test_flow_user(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -32,7 +32,7 @@ async def test_flow_user(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"] == NAME assert result2["data"] == CONF_DATA @@ -44,7 +44,7 @@ async def test_flow_user_cannot_connect(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data=CONF_DATA ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"]["base"] == "cannot_connect" @@ -55,7 +55,7 @@ async def test_flow_user_cannot_connect(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"] == NAME assert result2["data"] == CONF_DATA @@ -67,7 +67,7 @@ async def test_flow_user_invalid_auth(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=CONF_DATA ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"]["base"] == "invalid_auth" @@ -78,7 +78,7 @@ async def test_flow_user_invalid_auth(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"] == NAME assert result2["data"] == CONF_DATA @@ -90,7 +90,7 @@ async def test_flow_user_unknown_error(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data=CONF_DATA ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"]["base"] == "unknown" @@ -101,7 +101,7 @@ async def test_flow_user_unknown_error(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"] == NAME assert result2["data"] == CONF_DATA @@ -117,7 +117,7 @@ async def test_flow_user_already_configured(hass: HomeAssistant) -> None: context={"source": SOURCE_USER}, data=CONF_DATA, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -129,7 +129,7 @@ async def test_flow_user_multiple_entries_allowed(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -145,7 +145,7 @@ async def test_flow_user_multiple_entries_allowed(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"] == NAME assert result2["data"] == input @@ -165,7 +165,7 @@ async def test_flow_reauth( }, data=CONF_DATA, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["errors"] == {} @@ -181,7 +181,7 @@ async def test_flow_reauth( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "reauth_successful" assert entry.data == CONF_DATA assert len(mock_entry.mock_calls) == 1 @@ -207,7 +207,7 @@ async def test_flow_reauth_error( result["flow_id"], user_input={CONF_API_KEY: "efgh"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["errors"]["base"] == "invalid_auth" @@ -216,5 +216,5 @@ async def test_flow_reauth_error( result["flow_id"], user_input={CONF_API_KEY: "efgh"}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" diff --git a/tests/components/technove/test_config_flow.py b/tests/components/technove/test_config_flow.py index 72b9b358c89..81e0b32b55b 100644 --- a/tests/components/technove/test_config_flow.py +++ b/tests/components/technove/test_config_flow.py @@ -25,14 +25,14 @@ async def test_full_user_flow_implementation(hass: HomeAssistant) -> None: ) assert result.get("step_id") == "user" - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_HOST: "192.168.1.123"} ) assert result.get("title") == "TechnoVE Station" - assert result.get("type") == FlowResultType.CREATE_ENTRY + assert result.get("type") is FlowResultType.CREATE_ENTRY assert "data" in result assert result["data"][CONF_HOST] == "192.168.1.123" assert "result" in result @@ -53,7 +53,7 @@ async def test_user_device_exists_abort( data={CONF_HOST: "192.168.1.123"}, ) - 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_connection_error(hass: HomeAssistant, mock_technove: MagicMock) - data={CONF_HOST: "example.com"}, ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "user" assert result.get("errors") == {"base": "cannot_connect"} @@ -83,13 +83,13 @@ async def test_full_user_flow_with_error( ) assert result.get("step_id") == "user" - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_HOST: "192.168.1.123"} ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "user" assert result.get("errors") == {"base": "cannot_connect"} @@ -99,7 +99,7 @@ async def test_full_user_flow_with_error( ) assert result.get("title") == "TechnoVE Station" - assert result.get("type") == FlowResultType.CREATE_ENTRY + assert result.get("type") is FlowResultType.CREATE_ENTRY assert "data" in result assert result["data"][CONF_HOST] == "192.168.1.123" assert "result" in result @@ -128,14 +128,14 @@ async def test_full_zeroconf_flow_implementation(hass: HomeAssistant) -> None: assert result.get("description_placeholders") == {CONF_NAME: "TechnoVE Station"} assert result.get("step_id") == "zeroconf_confirm" - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM result2 = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) assert result2.get("title") == "TechnoVE Station" - assert result2.get("type") == FlowResultType.CREATE_ENTRY + assert result2.get("type") is FlowResultType.CREATE_ENTRY assert "data" in result2 assert result2["data"][CONF_HOST] == "192.168.1.123" @@ -165,7 +165,7 @@ async def test_zeroconf_during_onboarding( ) assert result.get("title") == "TechnoVE Station" - assert result.get("type") == FlowResultType.CREATE_ENTRY + assert result.get("type") is FlowResultType.CREATE_ENTRY assert result.get("data") == {CONF_HOST: "192.168.1.123"} assert "result" in result @@ -195,7 +195,7 @@ async def test_zeroconf_connection_error( ), ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "cannot_connect" @@ -211,7 +211,7 @@ async def test_user_station_exists_abort( data={CONF_HOST: "192.168.1.123"}, ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "already_configured" @@ -236,7 +236,7 @@ async def test_zeroconf_without_mac_station_exists_abort( ), ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "already_configured" @@ -262,5 +262,5 @@ async def test_zeroconf_with_mac_station_exists_abort( ) mock_technove.update.assert_not_called() - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "already_configured" diff --git a/tests/components/tedee/test_config_flow.py b/tests/components/tedee/test_config_flow.py index 6e8f02d04bc..1da1e392bf3 100644 --- a/tests/components/tedee/test_config_flow.py +++ b/tests/components/tedee/test_config_flow.py @@ -27,7 +27,7 @@ async def test_flow(hass: HomeAssistant, mock_tedee: MagicMock) -> None: DOMAIN, context={"source": SOURCE_USER} ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result2 = await hass.config_entries.flow.async_configure( result["flow_id"], @@ -37,7 +37,7 @@ async def test_flow(hass: HomeAssistant, mock_tedee: MagicMock) -> None: }, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["data"] == { CONF_HOST: "192.168.1.62", CONF_LOCAL_ACCESS_TOKEN: "token", @@ -56,7 +56,7 @@ async def test_flow_already_configured( DOMAIN, context={"source": SOURCE_USER} ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result2 = await hass.config_entries.flow.async_configure( result["flow_id"], @@ -65,7 +65,7 @@ async def test_flow_already_configured( CONF_LOCAL_ACCESS_TOKEN: "token", }, ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" @@ -91,7 +91,7 @@ async def test_config_flow_errors( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM mock_tedee.get_local_bridge.side_effect = side_effect @@ -103,7 +103,7 @@ async def test_config_flow_errors( }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == error assert len(mock_tedee.get_local_bridge.mock_calls) == 1 @@ -134,5 +134,5 @@ async def test_reauth_flow( CONF_LOCAL_ACCESS_TOKEN: LOCAL_ACCESS_TOKEN, }, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" diff --git a/tests/components/tellduslive/test_config_flow.py b/tests/components/tellduslive/test_config_flow.py index 3cd157fd8b5..c575e7fb5c1 100644 --- a/tests/components/tellduslive/test_config_flow.py +++ b/tests/components/tellduslive/test_config_flow.py @@ -15,6 +15,7 @@ from homeassistant.components.tellduslive import ( from homeassistant.config_entries import SOURCE_DISCOVERY from homeassistant.const import CONF_HOST from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -63,12 +64,12 @@ async def test_abort_if_already_setup(hass: HomeAssistant) -> None: with patch.object(hass.config_entries, "async_entries", return_value=[{}]): result = await flow.async_step_user() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_setup" with patch.object(hass.config_entries, "async_entries", return_value=[{}]): result = await flow.async_step_import(None) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_setup" @@ -77,16 +78,16 @@ async def test_full_flow_implementation(hass: HomeAssistant, mock_tellduslive) - flow = init_config_flow(hass) flow.context = {"source": SOURCE_DISCOVERY} result = await flow.async_step_discovery(["localhost", "tellstick"]) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert len(flow._hosts) == 2 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" result = await flow.async_step_user({"host": "localhost"}) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "auth" assert result["description_placeholders"] == { "auth_url": "https://example.com", @@ -94,7 +95,7 @@ async def test_full_flow_implementation(hass: HomeAssistant, mock_tellduslive) - } result = await flow.async_step_auth("") - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "localhost" assert result["data"]["host"] == "localhost" assert result["data"]["scan_interval"] == 60 @@ -106,7 +107,7 @@ async def test_step_import(hass: HomeAssistant, mock_tellduslive) -> None: flow = init_config_flow(hass) result = await flow.async_step_import({CONF_HOST: DOMAIN, KEY_SCAN_INTERVAL: 0}) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "auth" @@ -117,7 +118,7 @@ async def test_step_import_add_host(hass: HomeAssistant, mock_tellduslive) -> No result = await flow.async_step_import( {CONF_HOST: "localhost", KEY_SCAN_INTERVAL: 0} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" @@ -130,7 +131,7 @@ async def test_step_import_no_config_file( result = await flow.async_step_import( {CONF_HOST: "localhost", KEY_SCAN_INTERVAL: 0} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" @@ -150,7 +151,7 @@ async def test_step_import_load_json_matching_host( result = await flow.async_step_import( {CONF_HOST: "Cloud API", KEY_SCAN_INTERVAL: 0} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" @@ -168,7 +169,7 @@ async def test_step_import_load_json(hass: HomeAssistant, mock_tellduslive) -> N result = await flow.async_step_import( {CONF_HOST: "localhost", KEY_SCAN_INTERVAL: SCAN_INTERVAL} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "localhost" assert result["data"]["host"] == "localhost" assert result["data"]["scan_interval"] == 60 @@ -182,7 +183,7 @@ async def test_step_disco_no_local_api(hass: HomeAssistant, mock_tellduslive) -> flow.context = {"source": SOURCE_DISCOVERY} result = await flow.async_step_discovery(["localhost", "tellstick"]) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "auth" assert len(flow._hosts) == 1 @@ -193,7 +194,7 @@ async def test_step_auth(hass: HomeAssistant, mock_tellduslive) -> None: await flow.async_step_auth() result = await flow.async_step_auth(["localhost", "tellstick"]) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Cloud API" assert result["data"]["host"] == "Cloud API" assert result["data"]["scan_interval"] == 60 @@ -212,7 +213,7 @@ async def test_wrong_auth_flow_implementation( await flow.async_step_auth() result = await flow.async_step_auth("") - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "auth" assert result["errors"]["base"] == "invalid_auth" @@ -222,7 +223,7 @@ async def test_not_pick_host_if_only_one(hass: HomeAssistant, mock_tellduslive) flow = init_config_flow(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"] == "auth" @@ -233,7 +234,7 @@ async def test_abort_if_timeout_generating_auth_url( flow = init_config_flow(hass, side_effect=TimeoutError) result = await flow.async_step_user() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "authorize_url_timeout" @@ -243,7 +244,7 @@ async def test_abort_no_auth_url(hass: HomeAssistant, mock_tellduslive) -> None: flow._get_auth_url = Mock(return_value=False) result = await flow.async_step_user() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "unknown_authorize_url_generation" @@ -254,7 +255,7 @@ async def test_abort_if_exception_generating_auth_url( flow = init_config_flow(hass, side_effect=ValueError) result = await flow.async_step_user() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "unknown_authorize_url_generation" diff --git a/tests/components/template/test_config_flow.py b/tests/components/template/test_config_flow.py index 0a34dff9776..59a2c4f38a3 100644 --- a/tests/components/template/test_config_flow.py +++ b/tests/components/template/test_config_flow.py @@ -72,14 +72,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": template_type}, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == template_type with patch( @@ -95,7 +95,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"] == "My template" assert result["data"] == {} assert result["options"] == { @@ -203,7 +203,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"] == template_type assert get_suggested(result["data_schema"].schema, "state") == old_state_template assert "name" not in result["data_schema"].schema @@ -212,7 +212,7 @@ async def test_options( result["flow_id"], user_input={"state": new_state_template, **options_options}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "name": "My template", "state": new_state_template, @@ -237,14 +237,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": template_type}, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == template_type assert get_suggested(result["data_schema"].schema, "name") is None @@ -301,14 +301,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": template_type}, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == template_type assert result["errors"] is None assert result["preview"] == "template" @@ -442,14 +442,14 @@ async def test_config_flow_preview_bad_input( 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": template_type}, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == template_type assert result["errors"] is None assert result["preview"] == "template" @@ -512,14 +512,14 @@ async def test_config_flow_preview_template_startup_error( 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": template_type}, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == template_type assert result["errors"] is None assert result["preview"] == "template" @@ -595,14 +595,14 @@ async def test_config_flow_preview_template_error( 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": template_type}, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == template_type assert result["errors"] is None assert result["preview"] == "template" @@ -665,14 +665,14 @@ async def test_config_flow_preview_bad_state( 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": template_type}, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == template_type assert result["errors"] is None assert result["preview"] == "template" @@ -773,7 +773,7 @@ async def test_option_flow_preview( 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"] == "template" @@ -830,7 +830,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"] == "template" diff --git a/tests/components/tesla_wall_connector/test_config_flow.py b/tests/components/tesla_wall_connector/test_config_flow.py index 198dcccfe00..84d655a629e 100644 --- a/tests/components/tesla_wall_connector/test_config_flow.py +++ b/tests/components/tesla_wall_connector/test_config_flow.py @@ -19,7 +19,7 @@ async def test_form(mock_wall_connector_version, 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 patch( @@ -32,7 +32,7 @@ async def test_form(mock_wall_connector_version, 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"] == "Tesla Wall Connector" assert result2["data"] == {CONF_HOST: "1.1.1.1"} assert len(mock_setup_entry.mock_calls) == 1 @@ -53,7 +53,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None: {CONF_HOST: "1.1.1.1"}, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -74,7 +74,7 @@ async def test_form_other_error( {CONF_HOST: "1.1.1.1"}, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} @@ -129,7 +129,7 @@ async def test_dhcp_can_finish( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == {CONF_HOST: "1.2.3.4"} diff --git a/tests/components/teslemetry/test_config_flow.py b/tests/components/teslemetry/test_config_flow.py index 3757c331996..f2894c695fa 100644 --- a/tests/components/teslemetry/test_config_flow.py +++ b/tests/components/teslemetry/test_config_flow.py @@ -36,7 +36,7 @@ async def test_form( result1 = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result1["type"] == FlowResultType.FORM + assert result1["type"] is FlowResultType.FORM assert not result1["errors"] with patch( @@ -50,7 +50,7 @@ async def test_form( 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"] == CONFIG @@ -76,7 +76,7 @@ async def test_form_errors(hass: HomeAssistant, side_effect, error, mock_test) - CONFIG, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == error # Complete the flow @@ -85,4 +85,4 @@ async def test_form_errors(hass: HomeAssistant, side_effect, error, mock_test) - result2["flow_id"], CONFIG, ) - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY diff --git a/tests/components/tessie/test_config_flow.py b/tests/components/tessie/test_config_flow.py index e5bcf11efd1..ac3217f864b 100644 --- a/tests/components/tessie/test_config_flow.py +++ b/tests/components/tessie/test_config_flow.py @@ -27,7 +27,7 @@ async def test_form(hass: HomeAssistant, mock_get_state_of_all_vehicles) -> None result1 = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result1["type"] == FlowResultType.FORM + assert result1["type"] is FlowResultType.FORM assert not result1["errors"] with patch( @@ -42,7 +42,7 @@ async def test_form(hass: HomeAssistant, mock_get_state_of_all_vehicles) -> None assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_get_state_of_all_vehicles.mock_calls) == 1 - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Tessie" assert result2["data"] == TEST_CONFIG @@ -70,7 +70,7 @@ async def test_form_errors( TEST_CONFIG, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == error # Complete the flow @@ -79,7 +79,7 @@ async def test_form_errors( result2["flow_id"], TEST_CONFIG, ) - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY async def test_reauth(hass: HomeAssistant, mock_get_state_of_all_vehicles) -> None: @@ -100,7 +100,7 @@ async def test_reauth(hass: HomeAssistant, mock_get_state_of_all_vehicles) -> No data=TEST_CONFIG, ) - assert result1["type"] == FlowResultType.FORM + assert result1["type"] is FlowResultType.FORM assert result1["step_id"] == "reauth_confirm" assert not result1["errors"] @@ -116,7 +116,7 @@ async def test_reauth(hass: HomeAssistant, mock_get_state_of_all_vehicles) -> No assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_get_state_of_all_vehicles.mock_calls) == 1 - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "reauth_successful" assert mock_entry.data == TEST_CONFIG @@ -153,7 +153,7 @@ async def test_reauth_errors( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == error # Complete the flow @@ -163,6 +163,6 @@ async def test_reauth_errors( TEST_CONFIG, ) assert "errors" not in result3 - assert result3["type"] == FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "reauth_successful" assert mock_entry.data == TEST_CONFIG diff --git a/tests/components/thermobeacon/test_config_flow.py b/tests/components/thermobeacon/test_config_flow.py index a63ccf08963..a26a2b70c5e 100644 --- a/tests/components/thermobeacon/test_config_flow.py +++ b/tests/components/thermobeacon/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=THERMOBEACON_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch( "homeassistant.components.thermobeacon.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"] == "Lanyard/mini hygrometer EEFF" assert result2["data"] == {} assert result2["result"].unique_id == "aa:bb:cc:dd:ee:ff" @@ -40,7 +40,7 @@ async def test_async_step_bluetooth_not_thermobeacon(hass: HomeAssistant) -> Non context={"source": config_entries.SOURCE_BLUETOOTH}, data=NOT_THERMOBEACON_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.thermobeacon.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": "aa:bb:cc:dd:ee:ff"}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Lanyard/mini hygrometer EEFF" assert result2["data"] == {} assert result2["result"].unique_id == "aa:bb:cc:dd:ee:ff" @@ -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": "aa:bb:cc:dd:ee:ff"}, ) - 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=THERMOBEACON_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=THERMOBEACON_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=THERMOBEACON_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=THERMOBEACON_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.thermobeacon.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": "aa:bb:cc:dd:ee:ff"}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Lanyard/mini hygrometer EEFF" assert result2["data"] == {} assert result2["result"].unique_id == "aa:bb:cc:dd:ee:ff" diff --git a/tests/components/thermopro/test_config_flow.py b/tests/components/thermopro/test_config_flow.py index 0ee86cd5067..9b9fdd67334 100644 --- a/tests/components/thermopro/test_config_flow.py +++ b/tests/components/thermopro/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=TP357_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch( "homeassistant.components.thermopro.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"] == "TP357 (2142) AC3D" assert result2["data"] == {} assert result2["result"].unique_id == "4125DDBA-2774-4851-9889-6AADDD4CAC3D" @@ -40,7 +40,7 @@ async def test_async_step_bluetooth_not_thermopro(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=NOT_THERMOPRO_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.thermopro.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"] == "TP357 (2142) AC3D" 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=TP357_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=TP357_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=TP357_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=TP357_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.thermopro.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"] == "TP357 (2142) AC3D" assert result2["data"] == {} assert result2["result"].unique_id == "4125DDBA-2774-4851-9889-6AADDD4CAC3D" diff --git a/tests/components/thread/test_config_flow.py b/tests/components/thread/test_config_flow.py index 9f4930947ef..c31a1937d45 100644 --- a/tests/components/thread/test_config_flow.py +++ b/tests/components/thread/test_config_flow.py @@ -42,7 +42,7 @@ async def test_import(hass: HomeAssistant) -> None: thread.DOMAIN, context={"source": "import"} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Thread" assert result["data"] == {} assert result["options"] == {} @@ -65,7 +65,7 @@ async def test_import_then_zeroconf(hass: HomeAssistant) -> None: thread.DOMAIN, context={"source": "import"} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY with patch( "homeassistant.components.thread.async_setup_entry", @@ -75,7 +75,7 @@ async def test_import_then_zeroconf(hass: HomeAssistant) -> None: thread.DOMAIN, context={"source": "zeroconf"}, data=TEST_ZEROCONF_RECORD ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert len(mock_setup_entry.mock_calls) == 0 @@ -90,7 +90,7 @@ async def test_user(hass: HomeAssistant) -> None: thread.DOMAIN, context={"source": "user"} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Thread" assert result["data"] == {} assert result["options"] == {} @@ -108,7 +108,7 @@ async def test_zeroconf(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( thread.DOMAIN, context={"source": "zeroconf"}, data=TEST_ZEROCONF_RECORD ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None assert result["step_id"] == "confirm" @@ -117,7 +117,7 @@ async def test_zeroconf(hass: HomeAssistant) -> None: return_value=True, ) as mock_setup_entry: 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"] == "Thread" assert result["data"] == {} assert result["options"] == {} @@ -144,7 +144,7 @@ async def test_zeroconf_setup_onboarding(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( thread.DOMAIN, context={"source": "zeroconf"}, data=TEST_ZEROCONF_RECORD ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Thread" assert result["data"] == {} assert result["options"] == {} @@ -161,7 +161,7 @@ async def test_zeroconf_then_import(hass: HomeAssistant) -> None: return_value=True, ) as mock_setup_entry: result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY with patch( "homeassistant.components.thread.async_setup_entry", @@ -171,6 +171,6 @@ async def test_zeroconf_then_import(hass: HomeAssistant) -> None: thread.DOMAIN, context={"source": "import"} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert len(mock_setup_entry.mock_calls) == 0 diff --git a/tests/components/threshold/test_config_flow.py b/tests/components/threshold/test_config_flow.py index 726fa04cef0..88c970d5c2c 100644 --- a/tests/components/threshold/test_config_flow.py +++ b/tests/components/threshold/test_config_flow.py @@ -19,7 +19,7 @@ async def test_config_flow(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 patch( @@ -37,7 +37,7 @@ async def test_config_flow(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"] == "My threshold sensor" assert result["data"] == {} assert result["options"] == { @@ -69,7 +69,7 @@ async def test_fail(hass: HomeAssistant, extra_input_data, error) -> 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 result = await hass.config_entries.flow.async_configure( @@ -81,7 +81,7 @@ async def test_fail(hass: HomeAssistant, extra_input_data, error) -> None: }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": error} @@ -119,7 +119,7 @@ async def test_options(hass: HomeAssistant) -> 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, "hysteresis") == 0.0 @@ -133,7 +133,7 @@ async def test_options(hass: HomeAssistant) -> None: "upper": 20.0, }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "entity_id": input_sensor, "hysteresis": 0.0, diff --git a/tests/components/tibber/test_config_flow.py b/tests/components/tibber/test_config_flow.py index b6c616c5cf0..28b590a29d2 100644 --- a/tests/components/tibber/test_config_flow.py +++ b/tests/components/tibber/test_config_flow.py @@ -33,7 +33,7 @@ async def test_show_config_form(recorder_mock: Recorder, 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" @@ -56,7 +56,7 @@ async def test_create_entry(recorder_mock: Recorder, hass: HomeAssistant) -> Non DOMAIN, context={"source": config_entries.SOURCE_USER}, data=test_data ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == title assert result["data"] == test_data @@ -92,7 +92,7 @@ async def test_create_entry_exceptions( DOMAIN, context={"source": config_entries.SOURCE_USER}, data=test_data ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"][CONF_ACCESS_TOKEN] == expected_error @@ -109,5 +109,5 @@ async def test_flow_entry_already_exists( DOMAIN, context={"source": config_entries.SOURCE_USER}, data=test_data ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/tile/test_config_flow.py b/tests/components/tile/test_config_flow.py index 5d269bfee5d..87fe976ca3f 100644 --- a/tests/components/tile/test_config_flow.py +++ b/tests/components/tile/test_config_flow.py @@ -5,11 +5,11 @@ from unittest.mock import AsyncMock, patch import pytest from pytile.errors import InvalidAuthError, TileError -from homeassistant import data_entry_flow from homeassistant.components.tile import DOMAIN from homeassistant.config_entries import SOURCE_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 .conftest import TEST_PASSWORD, TEST_USERNAME @@ -28,7 +28,7 @@ async def test_create_entry( 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 errors that can arise: @@ -38,7 +38,7 @@ async def test_create_entry( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=config ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == errors @@ -46,7 +46,7 @@ async def test_create_entry( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=config ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == TEST_USERNAME assert result["data"] == { CONF_USERNAME: TEST_USERNAME, @@ -59,7 +59,7 @@ async def test_duplicate_error(hass: HomeAssistant, config, setup_config_entry) 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" @@ -68,7 +68,7 @@ async def test_import_entry(hass: HomeAssistant, config, mock_pytile) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_IMPORT}, data=config ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == TEST_USERNAME assert result["data"] == { CONF_USERNAME: TEST_USERNAME, @@ -86,12 +86,12 @@ async def test_step_reauth( assert result["step_id"] == "reauth_confirm" 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"] == "reauth_confirm" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_PASSWORD: "password"} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert len(hass.config_entries.async_entries()) == 1 diff --git a/tests/components/tilt_ble/test_config_flow.py b/tests/components/tilt_ble/test_config_flow.py index b9623f9700d..fd996228034 100644 --- a/tests/components/tilt_ble/test_config_flow.py +++ b/tests/components/tilt_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=TILT_GREEN_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch( "homeassistant.components.tilt_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"] == "Tilt Green" assert result2["data"] == {} assert result2["result"].unique_id == "F6:0F:28:F2:1F:CB" @@ -40,7 +40,7 @@ async def test_async_step_bluetooth_not_tilt(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=NOT_TILT_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.tilt_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": "F6:0F:28:F2:1F:CB"}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Tilt Green" assert result2["data"] == {} assert result2["result"].unique_id == "F6:0F:28:F2:1F:CB" @@ -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": "F6:0F:28:F2:1F:CB"}, ) - 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=TILT_GREEN_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=TILT_GREEN_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=TILT_GREEN_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=TILT_GREEN_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.tilt_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": "F6:0F:28:F2:1F:CB"}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Tilt Green" assert result2["data"] == {} assert result2["result"].unique_id == "F6:0F:28:F2:1F:CB" diff --git a/tests/components/time_date/test_config_flow.py b/tests/components/time_date/test_config_flow.py index 7402fc529d1..9f25b572014 100644 --- a/tests/components/time_date/test_config_flow.py +++ b/tests/components/time_date/test_config_flow.py @@ -25,7 +25,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 result = await hass.config_entries.flow.async_configure( result["flow_id"], @@ -34,7 +34,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: await hass.async_block_till_done() assert len(mock_setup_entry.mock_calls) == 1 - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY async def test_user_flow_does_not_allow_beat( @@ -45,7 +45,7 @@ async def test_user_flow_does_not_allow_beat( 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 pytest.raises(vol.Invalid): await hass.config_entries.flow.async_configure( @@ -65,13 +65,13 @@ async def test_single_instance(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 result = await hass.config_entries.flow.async_configure( result["flow_id"], {"display_options": "time"}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -88,7 +88,7 @@ async def test_timezone_not_set(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "timezone_not_exist"} @@ -104,7 +104,7 @@ 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.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] is None assert result["preview"] == "time_date" diff --git a/tests/components/tod/test_config_flow.py b/tests/components/tod/test_config_flow.py index c56accf103c..15c0229c653 100644 --- a/tests/components/tod/test_config_flow.py +++ b/tests/components/tod/test_config_flow.py @@ -18,7 +18,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( @@ -35,7 +35,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 tod" assert result["data"] == {} assert result["options"] == { @@ -85,7 +85,7 @@ async def test_options(hass: HomeAssistant) -> 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, "after_time") == "10:00" @@ -98,7 +98,7 @@ async def test_options(hass: HomeAssistant) -> None: "before_time": "17:05", }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "after_time": "10:00", "before_time": "17:05", diff --git a/tests/components/todoist/test_config_flow.py b/tests/components/todoist/test_config_flow.py index 141f12269de..46ae0e24fba 100644 --- a/tests/components/todoist/test_config_flow.py +++ b/tests/components/todoist/test_config_flow.py @@ -35,7 +35,7 @@ async def test_form( 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 not result.get("errors") result2 = await hass.config_entries.flow.async_configure( @@ -46,7 +46,7 @@ async def test_form( ) 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") == "Todoist" assert result2.get("data") == { CONF_TOKEN: TOKEN, @@ -68,7 +68,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None: }, ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("errors") == {"base": "invalid_api_key"} @@ -86,7 +86,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None: }, ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("errors") == {"base": "cannot_connect"} @@ -106,7 +106,7 @@ async def test_unknown_error(hass: HomeAssistant, api: AsyncMock) -> None: }, ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("errors") == {"base": "unknown"} @@ -119,5 +119,5 @@ async def test_already_configured(hass: HomeAssistant, setup_integration: None) 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") == "single_instance_allowed" diff --git a/tests/components/tolo/test_config_flow.py b/tests/components/tolo/test_config_flow.py index 711ded3880b..9dcca4b704f 100644 --- a/tests/components/tolo/test_config_flow.py +++ b/tests/components/tolo/test_config_flow.py @@ -46,7 +46,7 @@ async def test_user_with_timed_out_host(hass: HomeAssistant, toloclient: Mock) - data={CONF_HOST: "127.0.0.1"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "cannot_connect"} @@ -59,7 +59,7 @@ async def test_user_walkthrough( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" toloclient().get_status.side_effect = lambda *args, **kwargs: None @@ -69,7 +69,7 @@ async def test_user_walkthrough( user_input={CONF_HOST: "127.0.0.2"}, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "user" assert result2["errors"] == {"base": "cannot_connect"} @@ -80,7 +80,7 @@ async def test_user_walkthrough( user_input={CONF_HOST: "127.0.0.1"}, ) - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == "TOLO Sauna" assert result3["data"][CONF_HOST] == "127.0.0.1" @@ -94,7 +94,7 @@ async def test_dhcp( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_DHCP}, data=MOCK_DHCP_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( @@ -102,7 +102,7 @@ async def test_dhcp( user_input={}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "TOLO Sauna" assert result["data"][CONF_HOST] == "127.0.0.2" assert result["result"].unique_id == "00:11:22:33:44:55" @@ -115,4 +115,4 @@ async def test_dhcp_invalid_device(hass: HomeAssistant, toloclient: Mock) -> Non result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_DHCP}, data=MOCK_DHCP_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT diff --git a/tests/components/tomorrowio/test_config_flow.py b/tests/components/tomorrowio/test_config_flow.py index 5d4d2e3b43b..d280e8a5182 100644 --- a/tests/components/tomorrowio/test_config_flow.py +++ b/tests/components/tomorrowio/test_config_flow.py @@ -9,7 +9,6 @@ from pytomorrowio.exceptions import ( UnknownException, ) -from homeassistant import data_entry_flow from homeassistant.components.tomorrowio.config_flow import ( _get_config_schema, _get_unique_id, @@ -30,6 +29,7 @@ from homeassistant.const import ( CONF_RADIUS, ) from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from homeassistant.setup import async_setup_component from .const import API_KEY, MIN_CONFIG @@ -42,7 +42,7 @@ async def test_user_flow_minimum_fields(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" result = await hass.config_entries.flow.async_configure( @@ -50,7 +50,7 @@ async def test_user_flow_minimum_fields(hass: HomeAssistant) -> None: user_input=_get_config_schema(hass, SOURCE_USER, MIN_CONFIG)(MIN_CONFIG), ) - 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_NAME] == DEFAULT_NAME assert result["data"][CONF_API_KEY] == API_KEY @@ -75,7 +75,7 @@ async def test_user_flow_minimum_fields_in_zone(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" result = await hass.config_entries.flow.async_configure( @@ -83,7 +83,7 @@ async def test_user_flow_minimum_fields_in_zone(hass: HomeAssistant) -> None: user_input=_get_config_schema(hass, SOURCE_USER, MIN_CONFIG)(MIN_CONFIG), ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == f"{DEFAULT_NAME} - Home" assert result["data"][CONF_NAME] == f"{DEFAULT_NAME} - Home" assert result["data"][CONF_API_KEY] == API_KEY @@ -109,7 +109,7 @@ async def test_user_flow_same_unique_ids(hass: HomeAssistant) -> None: data=user_input, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -125,7 +125,7 @@ async def test_user_flow_cannot_connect(hass: HomeAssistant) -> None: data=_get_config_schema(hass, SOURCE_USER, MIN_CONFIG)(MIN_CONFIG), ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} @@ -141,7 +141,7 @@ async def test_user_flow_invalid_api(hass: HomeAssistant) -> None: data=_get_config_schema(hass, SOURCE_USER, MIN_CONFIG)(MIN_CONFIG), ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {CONF_API_KEY: "invalid_api_key"} @@ -157,7 +157,7 @@ async def test_user_flow_rate_limited(hass: HomeAssistant) -> None: data=_get_config_schema(hass, SOURCE_USER, MIN_CONFIG)(MIN_CONFIG), ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {CONF_API_KEY: "rate_limited"} @@ -173,7 +173,7 @@ async def test_user_flow_unknown_exception(hass: HomeAssistant) -> None: data=_get_config_schema(hass, SOURCE_USER, MIN_CONFIG)(MIN_CONFIG), ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "unknown"} @@ -197,14 +197,14 @@ async def test_options_flow(hass: HomeAssistant) -> None: result = await hass.config_entries.options.async_init(entry.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( result["flow_id"], user_input={CONF_TIMESTEP: 1} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "" assert result["data"][CONF_TIMESTEP] == 1 assert entry.options[CONF_TIMESTEP] == 1 diff --git a/tests/components/toon/test_config_flow.py b/tests/components/toon/test_config_flow.py index 3e8f7fa2624..7bda813e447 100644 --- a/tests/components/toon/test_config_flow.py +++ b/tests/components/toon/test_config_flow.py @@ -5,12 +5,12 @@ from unittest.mock import patch from toonapi import Agreement, ToonError -from homeassistant import data_entry_flow from homeassistant.components.toon.const import CONF_AGREEMENT, CONF_MIGRATE, DOMAIN from homeassistant.config import async_process_ha_core_config from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_USER from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from homeassistant.helpers import config_entry_oauth2_flow from homeassistant.setup import async_setup_component @@ -41,7 +41,7 @@ async def test_abort_if_no_configuration(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "missing_configuration" @@ -58,7 +58,7 @@ async def test_full_flow_implementation( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "pick_implementation" state = config_entry_oauth2_flow._encode_jwt( @@ -73,7 +73,7 @@ async def test_full_flow_implementation( result["flow_id"], {"implementation": "eneco"} ) - assert result2["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP + assert result2["type"] is FlowResultType.EXTERNAL_STEP assert result2["url"] == ( "https://api.toon.eu/authorize" "?response_type=code&client_id=client" @@ -149,7 +149,7 @@ async def test_no_agreements( with patch("toonapi.Toon.agreements", return_value=[]): result3 = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result3["type"] == data_entry_flow.FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "no_agreements" @@ -195,7 +195,7 @@ async def test_multiple_agreements( ): result3 = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result3["type"] == data_entry_flow.FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["step_id"] == "agreement" result4 = await hass.config_entries.flow.async_configure( @@ -244,7 +244,7 @@ async def test_agreement_already_set_up( with patch("toonapi.Toon.agreements", return_value=[Agreement(agreement_id=123)]): result3 = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result3["type"] == data_entry_flow.FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "already_configured" @@ -286,7 +286,7 @@ async def test_toon_abort( with patch("toonapi.Toon.agreements", side_effect=ToonError): result2 = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result2["type"] == data_entry_flow.FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "connection_error" @@ -300,7 +300,7 @@ async def test_import(hass: HomeAssistant, current_request_with_host: None) -> N DOMAIN, context={"source": SOURCE_IMPORT} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_in_progress" @@ -350,7 +350,7 @@ async def test_import_migration( with patch("toonapi.Toon.agreements", return_value=[Agreement(agreement_id=123)]): result = await hass.config_entries.flow.async_configure(flows[0]["flow_id"]) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY entries = hass.config_entries.async_entries(DOMAIN) assert len(entries) == 1 diff --git a/tests/components/totalconnect/test_config_flow.py b/tests/components/totalconnect/test_config_flow.py index 940542bf3ad..98de748faea 100644 --- a/tests/components/totalconnect/test_config_flow.py +++ b/tests/components/totalconnect/test_config_flow.py @@ -4,7 +4,6 @@ from unittest.mock import patch from total_connect_client.exceptions import AuthenticationError -from homeassistant import data_entry_flow from homeassistant.components.totalconnect.const import ( AUTO_BYPASS, CONF_USERCODES, @@ -13,6 +12,7 @@ from homeassistant.components.totalconnect.const import ( from homeassistant.config_entries import SOURCE_REAUTH, SOURCE_USER from homeassistant.const import CONF_PASSWORD from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from .common import ( CONFIG_DATA, @@ -39,7 +39,7 @@ async def test_user(hass: HomeAssistant) -> None: data=None, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" @@ -71,7 +71,7 @@ async def test_user_show_locations(hass: HomeAssistant) -> None: ) # first it should show the locations form - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "locations" # client should have sent four requests for init assert mock_request.call_count == 4 @@ -81,7 +81,7 @@ async def test_user_show_locations(hass: HomeAssistant) -> None: result["flow_id"], user_input={CONF_USERCODES: "bad"}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "locations" # client should have sent 5th request to validate usercode assert mock_request.call_count == 5 @@ -91,7 +91,7 @@ async def test_user_show_locations(hass: HomeAssistant) -> None: result2["flow_id"], user_input={CONF_USERCODES: "7890"}, ) - assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY # client should have sent another request to validate usercode assert mock_request.call_count == 6 @@ -112,7 +112,7 @@ async def test_abort_if_already_setup(hass: HomeAssistant) -> None: data=CONFIG_DATA, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -128,7 +128,7 @@ async def test_login_failed(hass: HomeAssistant) -> None: data=CONFIG_DATA, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "invalid_auth"} @@ -144,7 +144,7 @@ async def test_reauth(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_REAUTH}, data=entry.data ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" with ( @@ -161,7 +161,7 @@ async def test_reauth(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_PASSWORD: "password"} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["errors"] == {"base": "invalid_auth"} @@ -171,7 +171,7 @@ async def test_reauth(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_PASSWORD: "password"} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" await hass.async_block_till_done() @@ -205,7 +205,7 @@ async def test_no_locations(hass: HomeAssistant) -> None: context={"source": SOURCE_USER}, data=CONFIG_DATA_NO_USERCODES, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_locations" await hass.async_block_till_done() @@ -236,14 +236,14 @@ 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( result["flow_id"], user_input={AUTO_BYPASS: True} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == {AUTO_BYPASS: True} await hass.async_block_till_done() diff --git a/tests/components/tplink/test_config_flow.py b/tests/components/tplink/test_config_flow.py index 4c1cc999f16..4e80ce3e890 100644 --- a/tests/components/tplink/test_config_flow.py +++ b/tests/components/tplink/test_config_flow.py @@ -102,7 +102,7 @@ async def test_discovery(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 not result["errors"] @@ -110,7 +110,7 @@ async def test_discovery(hass: HomeAssistant) -> None: result2 = await hass.config_entries.flow.async_configure(result["flow_id"], {}) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "no_devices_found" @@ -661,7 +661,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"] == "cannot_connect" @@ -1104,7 +1104,7 @@ async def test_pick_device_errors( CONF_PASSWORD: "fake_password", }, ) - assert result4["type"] == FlowResultType.CREATE_ENTRY + assert result4["type"] is FlowResultType.CREATE_ENTRY assert result4["context"]["unique_id"] == MAC_ADDRESS diff --git a/tests/components/tplink_omada/test_config_flow.py b/tests/components/tplink_omada/test_config_flow.py index 230f0d2a68e..08606fe126c 100644 --- a/tests/components/tplink_omada/test_config_flow.py +++ b/tests/components/tplink_omada/test_config_flow.py @@ -43,7 +43,7 @@ async def test_form_single_site(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 ( @@ -64,7 +64,7 @@ async def test_form_single_site(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"] == "OC200 (Display Name)" assert result2["data"] == MOCK_ENTRY_DATA assert len(mock_setup_entry.mock_calls) == 1 @@ -76,7 +76,7 @@ async def test_form_multiple_sites(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"] == {} @@ -100,7 +100,7 @@ async def test_form_multiple_sites(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "site" with patch( @@ -115,7 +115,7 @@ async def test_form_multiple_sites(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"] == "OC200 (Site 2)" assert result3["data"] == { "host": "https://fake.omada.host", @@ -142,7 +142,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None: MOCK_USER_DATA, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "invalid_auth"} @@ -161,7 +161,7 @@ async def test_form_api_error(hass: HomeAssistant) -> None: MOCK_USER_DATA, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} @@ -180,7 +180,7 @@ async def test_form_generic_exception(hass: HomeAssistant) -> None: MOCK_USER_DATA, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} @@ -199,7 +199,7 @@ async def test_form_unsupported_controller(hass: HomeAssistant) -> None: MOCK_USER_DATA, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unsupported_controller"} @@ -218,7 +218,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None: MOCK_USER_DATA, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -237,7 +237,7 @@ async def test_form_no_sites(hass: HomeAssistant) -> None: MOCK_USER_DATA, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "no_sites_found"} @@ -260,7 +260,7 @@ async def test_async_step_reauth_success(hass: HomeAssistant) -> None: data=mock_entry.data, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" with patch( @@ -274,7 +274,7 @@ async def test_async_step_reauth_success(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" mocked_validate.assert_called_once_with( hass, @@ -307,7 +307,7 @@ async def test_async_step_reauth_invalid_auth(hass: HomeAssistant) -> None: data=mock_entry.data, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" with patch( @@ -319,7 +319,7 @@ async def test_async_step_reauth_invalid_auth(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result2["errors"] == {"base": "invalid_auth"} diff --git a/tests/components/traccar_server/test_config_flow.py b/tests/components/traccar_server/test_config_flow.py index c412830066d..5652d2c77be 100644 --- a/tests/components/traccar_server/test_config_flow.py +++ b/tests/components/traccar_server/test_config_flow.py @@ -39,7 +39,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["errors"] == {} result = await hass.config_entries.flow.async_configure( @@ -52,7 +52,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"] == "1.1.1.1:8082" assert result["data"] == { CONF_HOST: "1.1.1.1", @@ -94,7 +94,7 @@ async def test_form_cannot_connect( }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": error} mock_traccar_api_client.get_server.side_effect = None @@ -109,7 +109,7 @@ async def test_form_cannot_connect( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "1.1.1.1:8082" assert result["data"] == { CONF_HOST: "1.1.1.1", @@ -143,7 +143,7 @@ async def test_options( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert mock_config_entry.options == { CONF_MAX_ACCURACY: 2.0, CONF_EVENTS: [], @@ -238,7 +238,7 @@ async def test_import_from_yaml( context={"source": config_entries.SOURCE_IMPORT}, data=PLATFORM_SCHEMA({"platform": "traccar", **imported}), ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == f"{data[CONF_HOST]}:{data[CONF_PORT]}" assert result["data"] == data assert result["options"] == options @@ -269,7 +269,7 @@ async def test_abort_import_already_configured(hass: HomeAssistant) -> None: ), ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -296,5 +296,5 @@ async def test_abort_already_configured( }, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/tradfri/test_config_flow.py b/tests/components/tradfri/test_config_flow.py index fd3d85461b1..af2fdc22d2a 100644 --- a/tests/components/tradfri/test_config_flow.py +++ b/tests/components/tradfri/test_config_flow.py @@ -5,10 +5,11 @@ from unittest.mock import AsyncMock, patch import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components import zeroconf from homeassistant.components.tradfri import config_flow from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from . import TRADFRI_PATH @@ -38,7 +39,7 @@ async def test_already_paired(hass: HomeAssistant, mock_entry_setup) -> None: result["flow_id"], {"host": "123.123.123.123", "security_code": "abcd"} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_authenticate"} @@ -58,7 +59,7 @@ async def test_user_connection_successful( assert len(mock_entry_setup.mock_calls) == 1 - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["result"].data == { "host": "123.123.123.123", "gateway_id": "bla", @@ -81,7 +82,7 @@ async def test_user_connection_timeout( assert len(mock_entry_setup.mock_calls) == 0 - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "timeout"} @@ -101,7 +102,7 @@ async def test_user_connection_bad_key( assert len(mock_entry_setup.mock_calls) == 0 - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"security_code": "invalid_security_code"} @@ -131,7 +132,7 @@ async def test_discovery_connection( assert len(mock_entry_setup.mock_calls) == 1 - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["result"].unique_id == "homekit-id" assert result["result"].data == { "host": "123.123.123.123", @@ -160,7 +161,7 @@ async def test_discovery_duplicate_aborted(hass: HomeAssistant) -> None: ), ) - assert flow["type"] == data_entry_flow.FlowResultType.ABORT + assert flow["type"] is FlowResultType.ABORT assert flow["reason"] == "already_configured" assert entry.data["host"] == "123.123.123.124" @@ -184,7 +185,7 @@ async def test_duplicate_discovery( ), ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result2 = await hass.config_entries.flow.async_init( "tradfri", @@ -200,7 +201,7 @@ async def test_duplicate_discovery( ), ) - assert result2["type"] == data_entry_flow.FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT async def test_discovery_updates_unique_id(hass: HomeAssistant) -> None: @@ -225,7 +226,7 @@ async def test_discovery_updates_unique_id(hass: HomeAssistant) -> None: ), ) - assert flow["type"] == data_entry_flow.FlowResultType.ABORT + assert flow["type"] is FlowResultType.ABORT assert flow["reason"] == "already_configured" assert entry.unique_id == "homekit-id" diff --git a/tests/components/trafikverket_camera/test_config_flow.py b/tests/components/trafikverket_camera/test_config_flow.py index eb14636d6c9..8162db076fa 100644 --- a/tests/components/trafikverket_camera/test_config_flow.py +++ b/tests/components/trafikverket_camera/test_config_flow.py @@ -23,7 +23,7 @@ async def test_form(hass: HomeAssistant, get_camera: CameraInfo) -> 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, get_camera: CameraInfo) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Test Camera" assert result2["data"] == { "api_key": "1234567890", @@ -63,7 +63,7 @@ async def test_form_multiple_cameras( 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 patch( @@ -97,7 +97,7 @@ async def test_form_multiple_cameras( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Test Camera2" assert result["data"] == { "api_key": "1234567890", @@ -115,7 +115,7 @@ async def test_form_no_location_data( 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 ( @@ -137,7 +137,7 @@ async def test_form_no_location_data( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Test Camera" assert result2["data"] == { "api_key": "1234567890", @@ -175,7 +175,7 @@ async def test_flow_fails( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result4["type"] == FlowResultType.FORM + assert result4["type"] is FlowResultType.FORM assert result4["step_id"] == config_entries.SOURCE_USER with patch( @@ -216,7 +216,7 @@ async def test_reauth_flow(hass: HomeAssistant) -> None: data=entry.data, ) assert result["step_id"] == "reauth_confirm" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with ( @@ -234,7 +234,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 entry.data == { "api_key": "1234567891", @@ -299,7 +299,7 @@ async def test_reauth_flow_error( await hass.async_block_till_done() assert result2["step_id"] == "reauth_confirm" - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {error_key: p_error} with ( @@ -317,7 +317,7 @@ async def test_reauth_flow_error( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "reauth_successful" assert entry.data == { "api_key": "1234567891", diff --git a/tests/components/trafikverket_ferry/test_config_flow.py b/tests/components/trafikverket_ferry/test_config_flow.py index 2a0a0ae6cd6..1c170a917cc 100644 --- a/tests/components/trafikverket_ferry/test_config_flow.py +++ b/tests/components/trafikverket_ferry/test_config_flow.py @@ -27,7 +27,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 ( @@ -51,7 +51,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"] == "Ekerö to Slagsta at 10:00" assert result2["data"] == { "api_key": "1234567890", @@ -92,7 +92,7 @@ async def test_flow_fails( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result4["type"] == FlowResultType.FORM + assert result4["type"] is FlowResultType.FORM assert result4["step_id"] == config_entries.SOURCE_USER with patch( @@ -138,7 +138,7 @@ async def test_reauth_flow(hass: HomeAssistant) -> None: data=entry.data, ) assert result["step_id"] == "reauth_confirm" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with ( @@ -156,7 +156,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 entry.data == { "api_key": "1234567891", @@ -224,7 +224,7 @@ async def test_reauth_flow_error( await hass.async_block_till_done() assert result2["step_id"] == "reauth_confirm" - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": p_error} with ( @@ -242,7 +242,7 @@ async def test_reauth_flow_error( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "reauth_successful" assert entry.data == { "api_key": "1234567891", diff --git a/tests/components/trafikverket_train/test_config_flow.py b/tests/components/trafikverket_train/test_config_flow.py index 3a5afa7431c..a6ba82a85bc 100644 --- a/tests/components/trafikverket_train/test_config_flow.py +++ b/tests/components/trafikverket_train/test_config_flow.py @@ -34,7 +34,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 ( @@ -61,7 +61,7 @@ async def test_form(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"] == "Stockholm C to Uppsala C at 10:00" assert result["data"] == { "api_key": "1234567890", @@ -98,7 +98,7 @@ async def test_form_entry_already_exist(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 ( @@ -125,7 +125,7 @@ async def test_form_entry_already_exist(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" @@ -158,7 +158,7 @@ async def test_flow_fails( 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 ( @@ -203,7 +203,7 @@ async def test_flow_fails_departures( 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 ( @@ -256,7 +256,7 @@ async def test_reauth_flow(hass: HomeAssistant) -> None: data=entry.data, ) assert result["step_id"] == "reauth_confirm" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with ( @@ -277,7 +277,7 @@ async def test_reauth_flow(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert entry.data == { "api_key": "1234567891", @@ -354,7 +354,7 @@ async def test_reauth_flow_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"] == {"base": p_error} with ( @@ -375,7 +375,7 @@ async def test_reauth_flow_error( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert entry.data == { "api_key": "1234567891", @@ -444,7 +444,7 @@ async def test_reauth_flow_error_departures( 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"] == {"base": p_error} with ( @@ -465,7 +465,7 @@ async def test_reauth_flow_error_departures( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert entry.data == { "api_key": "1234567891", @@ -515,7 +515,7 @@ async def test_options_flow( result = await hass.config_entries.options.async_init(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( @@ -524,12 +524,12 @@ async def test_options_flow( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == {"filter_product": "SJ RegionaltÄg"} result = await hass.config_entries.options.async_init(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( @@ -538,5 +538,5 @@ async def test_options_flow( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == {"filter_product": None} diff --git a/tests/components/trafikverket_weatherstation/test_config_flow.py b/tests/components/trafikverket_weatherstation/test_config_flow.py index 4a1c50cbaf1..d2bd794daf7 100644 --- a/tests/components/trafikverket_weatherstation/test_config_flow.py +++ b/tests/components/trafikverket_weatherstation/test_config_flow.py @@ -87,7 +87,7 @@ async def test_flow_fails( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result4["type"] == FlowResultType.FORM + assert result4["type"] is FlowResultType.FORM assert result4["step_id"] == config_entries.SOURCE_USER with patch( @@ -125,7 +125,7 @@ async def test_reauth_flow(hass: HomeAssistant) -> None: data=entry.data, ) assert result["step_id"] == "reauth_confirm" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with ( @@ -143,7 +143,7 @@ async def test_reauth_flow(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert entry.data == {"api_key": "1234567891", "station": "Vallby"} @@ -191,7 +191,7 @@ async def test_reauth_flow_fails( data=entry.data, ) assert result["step_id"] == "reauth_confirm" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with patch( @@ -204,5 +204,5 @@ async def test_reauth_flow_fails( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": base_error} diff --git a/tests/components/transmission/test_config_flow.py b/tests/components/transmission/test_config_flow.py index 0e184ffc96b..e6c523bf1f6 100644 --- a/tests/components/transmission/test_config_flow.py +++ b/tests/components/transmission/test_config_flow.py @@ -32,7 +32,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 with patch( "homeassistant.components.transmission.async_setup_entry", @@ -44,7 +44,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"] == "Transmission" assert result2["data"] == MOCK_CONFIG_DATA assert len(mock_setup_entry.mock_calls) == 1 @@ -60,7 +60,7 @@ async def test_device_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 result2 = await hass.config_entries.flow.async_configure( result["flow_id"], @@ -68,7 +68,7 @@ async def test_device_already_configured( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" @@ -90,14 +90,14 @@ async def test_options(hass: HomeAssistant) -> None: result = await hass.config_entries.options.async_init(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={"limit": 20} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"]["limit"] == 20 assert result["data"]["order"] == "oldest_first" @@ -115,7 +115,7 @@ async def test_error_on_wrong_credentials( result["flow_id"], MOCK_CONFIG_DATA, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == { "username": "invalid_auth", "password": "invalid_auth", @@ -133,7 +133,7 @@ async def test_unexpected_error(hass: HomeAssistant, mock_api: MagicMock) -> Non result["flow_id"], MOCK_CONFIG_DATA, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -151,7 +151,7 @@ async def test_error_on_connection_failure( MOCK_CONFIG_DATA, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -169,7 +169,7 @@ async def test_reauth_success(hass: HomeAssistant) -> None: data=MOCK_CONFIG_DATA, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["description_placeholders"] == {"username": "user"} @@ -184,7 +184,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" assert len(mock_setup_entry.mock_calls) == 1 @@ -206,7 +206,7 @@ async def test_reauth_failed(hass: HomeAssistant, mock_api: MagicMock) -> None: data=MOCK_CONFIG_DATA, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["description_placeholders"] == {"username": "user"} @@ -218,7 +218,7 @@ async def test_reauth_failed(hass: HomeAssistant, mock_api: MagicMock) -> None: }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"password": "invalid_auth"} @@ -241,7 +241,7 @@ async def test_reauth_failed_connection_error( data=MOCK_CONFIG_DATA, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["description_placeholders"] == {"username": "user"} @@ -253,5 +253,5 @@ async def test_reauth_failed_connection_error( }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} diff --git a/tests/components/trend/test_config_flow.py b/tests/components/trend/test_config_flow.py index baccc396bf1..fb82589b3ce 100644 --- a/tests/components/trend/test_config_flow.py +++ b/tests/components/trend/test_config_flow.py @@ -20,7 +20,7 @@ async def test_form(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"], @@ -28,7 +28,7 @@ async def test_form(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM # test step 2 of config flow: settings of trend sensor with patch( @@ -42,7 +42,7 @@ async def test_form(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"] == "CPU Temperature rising" assert result["data"] == {} assert result["options"] == { @@ -57,7 +57,7 @@ async def test_options(hass: HomeAssistant, config_entry: MockConfigEntry) -> No 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"] == "init" result = await hass.config_entries.options.async_configure( @@ -69,7 +69,7 @@ async def test_options(hass: HomeAssistant, config_entry: MockConfigEntry) -> No ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "min_samples": 30, "max_samples": 50, diff --git a/tests/components/tuya/test_config_flow.py b/tests/components/tuya/test_config_flow.py index 646d6a09f12..6e971262bc8 100644 --- a/tests/components/tuya/test_config_flow.py +++ b/tests/components/tuya/test_config_flow.py @@ -28,7 +28,7 @@ async def test_user_flow( 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( @@ -36,7 +36,7 @@ async def test_user_flow( user_input={CONF_USER_CODE: "12345"}, ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "scan" result3 = await hass.config_entries.flow.async_configure( @@ -44,7 +44,7 @@ async def test_user_flow( user_input={}, ) - assert result3.get("type") == FlowResultType.CREATE_ENTRY + assert result3.get("type") is FlowResultType.CREATE_ENTRY assert result3 == snapshot @@ -58,7 +58,7 @@ async def test_user_flow_failed_qr_code( context={"source": SOURCE_USER}, ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "user" # Something went wrong getting the QR code (like an invalid user code) @@ -69,7 +69,7 @@ async def test_user_flow_failed_qr_code( user_input={CONF_USER_CODE: "12345"}, ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("errors") == {"base": "login_error"} # This time it worked out @@ -86,7 +86,7 @@ async def test_user_flow_failed_qr_code( user_input={}, ) - assert result3.get("type") == FlowResultType.CREATE_ENTRY + assert result3.get("type") is FlowResultType.CREATE_ENTRY async def test_user_flow_failed_scan( @@ -99,7 +99,7 @@ async def test_user_flow_failed_scan( 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( @@ -107,7 +107,7 @@ async def test_user_flow_failed_scan( user_input={CONF_USER_CODE: "12345"}, ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "scan" # Access has been denied, or the code hasn't been scanned yet @@ -122,7 +122,7 @@ async def test_user_flow_failed_scan( user_input={}, ) - assert result3.get("type") == FlowResultType.FORM + assert result3.get("type") is FlowResultType.FORM assert result3.get("errors") == {"base": "login_error"} # This time it worked out @@ -133,7 +133,7 @@ async def test_user_flow_failed_scan( user_input={}, ) - assert result4.get("type") == FlowResultType.CREATE_ENTRY + assert result4.get("type") is FlowResultType.CREATE_ENTRY @pytest.mark.usefixtures("mock_tuya_login_control") @@ -155,7 +155,7 @@ async def test_reauth_flow( data=mock_config_entry.data, ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "scan" result2 = await hass.config_entries.flow.async_configure( @@ -163,7 +163,7 @@ async def test_reauth_flow( user_input={}, ) - assert result2.get("type") == FlowResultType.ABORT + assert result2.get("type") is FlowResultType.ABORT assert result2.get("reason") == "reauth_successful" assert mock_config_entry == snapshot @@ -195,7 +195,7 @@ async def test_reauth_flow_migration( data=mock_old_config_entry.data, ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "reauth_user_code" result2 = await hass.config_entries.flow.async_configure( @@ -203,7 +203,7 @@ async def test_reauth_flow_migration( user_input={CONF_USER_CODE: "12345"}, ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "scan" result3 = await hass.config_entries.flow.async_configure( @@ -211,7 +211,7 @@ async def test_reauth_flow_migration( user_input={}, ) - assert result3.get("type") == FlowResultType.ABORT + assert result3.get("type") is FlowResultType.ABORT assert result3.get("reason") == "reauth_successful" # Ensure the old data is gone, new data is present @@ -247,7 +247,7 @@ async def test_reauth_flow_failed_qr_code( user_input={CONF_USER_CODE: "12345"}, ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("errors") == {"base": "login_error"} # This time it worked out @@ -264,5 +264,5 @@ async def test_reauth_flow_failed_qr_code( user_input={}, ) - assert result3.get("type") == FlowResultType.ABORT + assert result3.get("type") is FlowResultType.ABORT assert result3.get("reason") == "reauth_successful" diff --git a/tests/components/twentemilieu/test_config_flow.py b/tests/components/twentemilieu/test_config_flow.py index e272ce38bee..dbc01c69acb 100644 --- a/tests/components/twentemilieu/test_config_flow.py +++ b/tests/components/twentemilieu/test_config_flow.py @@ -30,7 +30,7 @@ async def test_full_user_flow(hass: HomeAssistant, snapshot: SnapshotAssertion) 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( @@ -42,7 +42,7 @@ async def test_full_user_flow(hass: HomeAssistant, snapshot: SnapshotAssertion) }, ) - assert result2.get("type") == FlowResultType.CREATE_ENTRY + assert result2.get("type") is FlowResultType.CREATE_ENTRY assert result2 == snapshot @@ -60,7 +60,7 @@ async def test_invalid_address( DOMAIN, context={"source": SOURCE_USER} ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "user" mock_twentemilieu.unique_id.side_effect = TwenteMilieuAddressError @@ -72,7 +72,7 @@ async def test_invalid_address( }, ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "user" assert result2.get("errors") == {"base": "invalid_address"} @@ -85,7 +85,7 @@ async def test_invalid_address( }, ) - assert result3.get("type") == FlowResultType.CREATE_ENTRY + assert result3.get("type") is FlowResultType.CREATE_ENTRY assert result3 == snapshot @@ -106,7 +106,7 @@ async def test_connection_error( }, ) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "user" assert result.get("errors") == {"base": "cannot_connect"} @@ -128,5 +128,5 @@ async def test_address_already_set_up( }, ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "already_configured" diff --git a/tests/components/twitch/test_config_flow.py b/tests/components/twitch/test_config_flow.py index 4b6834ba544..f9d8be4a5d2 100644 --- a/tests/components/twitch/test_config_flow.py +++ b/tests/components/twitch/test_config_flow.py @@ -67,7 +67,7 @@ async def test_full_flow( assert len(hass.config_entries.async_entries(DOMAIN)) == 1 - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "channel123" assert "result" in result assert "token" in result["result"].data @@ -98,7 +98,7 @@ async def test_already_configured( ): 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" @@ -121,7 +121,7 @@ async def test_reauth( }, data=config_entry.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(result["flow_id"], {}) @@ -130,7 +130,7 @@ async def test_reauth( 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" @@ -195,7 +195,7 @@ async def test_reauth_wrong_account( }, data=config_entry.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(result["flow_id"], {}) @@ -204,7 +204,7 @@ async def test_reauth_wrong_account( 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"] == "wrong_account" @@ -229,7 +229,7 @@ async def test_import( "channels": ["channel123"], }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "channel123" assert "result" in result assert "token" in result["result"].data @@ -261,7 +261,7 @@ async def test_import_invalid_token( "channels": ["channel123"], }, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "invalid_token" issue_registry = ir.async_get(hass) assert len(issue_registry.issues) == 1 @@ -290,7 +290,7 @@ async def test_import_already_imported( "channels": ["channel123"], }, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" issue_registry = ir.async_get(hass) assert len(issue_registry.issues) == 1