diff --git a/tests/components/homekit_controller/test_config_flow.py b/tests/components/homekit_controller/test_config_flow.py index e72d9452e522ef2fcc49501d15872691d6541557..ff9b89473d6785ef24c548f1e00f6e772979203c 100644 --- a/tests/components/homekit_controller/test_config_flow.py +++ b/tests/components/homekit_controller/test_config_flow.py @@ -15,11 +15,7 @@ from homeassistant.components import zeroconf from homeassistant.components.homekit_controller import config_flow from homeassistant.components.homekit_controller.const import KNOWN_DEVICES from homeassistant.components.homekit_controller.storage import async_get_entity_storage -from homeassistant.data_entry_flow import ( - RESULT_TYPE_ABORT, - RESULT_TYPE_FORM, - FlowResultType, -) +from homeassistant.data_entry_flow import FlowResultType from homeassistant.helpers import device_registry from homeassistant.helpers.service_info.bluetooth import BluetoothServiceInfo @@ -1017,7 +1013,7 @@ async def test_discovery_no_bluetooth_support(hass, controller): context={"source": config_entries.SOURCE_BLUETOOTH}, data=HK_BLUETOOTH_SERVICE_INFO_NOT_DISCOVERED, ) - assert result["type"] == RESULT_TYPE_ABORT + assert result["type"] == FlowResultType.ABORT assert result["reason"] == "ignored_model" @@ -1032,7 +1028,7 @@ async def test_bluetooth_not_homekit(hass, controller): context={"source": config_entries.SOURCE_BLUETOOTH}, data=NOT_HK_BLUETOOTH_SERVICE_INFO, ) - assert result["type"] == RESULT_TYPE_ABORT + assert result["type"] == FlowResultType.ABORT assert result["reason"] == "ignored_model" @@ -1047,7 +1043,7 @@ async def test_bluetooth_valid_device_no_discovery(hass, controller): context={"source": config_entries.SOURCE_BLUETOOTH}, data=HK_BLUETOOTH_SERVICE_INFO_NOT_DISCOVERED, ) - assert result["type"] == RESULT_TYPE_ABORT + assert result["type"] == FlowResultType.ABORT assert result["reason"] == "accessory_not_found_error" @@ -1065,7 +1061,7 @@ async def test_bluetooth_valid_device_discovery_paired(hass, controller): data=HK_BLUETOOTH_SERVICE_INFO_DISCOVERED_PAIRED, ) - assert result["type"] == RESULT_TYPE_ABORT + assert result["type"] == FlowResultType.ABORT assert result["reason"] == "already_paired" @@ -1084,7 +1080,7 @@ async def test_bluetooth_valid_device_discovery_unpaired(hass, controller): data=HK_BLUETOOTH_SERVICE_INFO_DISCOVERED_UNPAIRED, ) - assert result["type"] == RESULT_TYPE_FORM + assert result["type"] == FlowResultType.FORM assert result["step_id"] == "pair" assert storage.get_map("00:00:00:00:00:00") is None @@ -1095,7 +1091,7 @@ async def test_bluetooth_valid_device_discovery_unpaired(hass, controller): } result2 = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result2["type"] == RESULT_TYPE_FORM + assert result2["type"] == FlowResultType.FORM result3 = await hass.config_entries.flow.async_configure( result2["flow_id"], user_input={"pairing_code": "111-22-333"} ) diff --git a/tests/components/lacrosse_view/test_config_flow.py b/tests/components/lacrosse_view/test_config_flow.py index 82178f2801bce47096b95f2a22f5d2b167ad9648..dc55f02bff85d0d4c0d461c83deffb8bd19e66e8 100644 --- a/tests/components/lacrosse_view/test_config_flow.py +++ b/tests/components/lacrosse_view/test_config_flow.py @@ -6,7 +6,7 @@ from lacrosse_view import Location, LoginError from homeassistant import config_entries from homeassistant.components.lacrosse_view.const import DOMAIN from homeassistant.core import HomeAssistant -from homeassistant.data_entry_flow import RESULT_TYPE_CREATE_ENTRY, RESULT_TYPE_FORM +from homeassistant.data_entry_flow import RESULT_TYPE_CREATE_ENTRY, FlowResultType async def test_form(hass: HomeAssistant) -> None: @@ -14,7 +14,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"] == RESULT_TYPE_FORM + assert result["type"] == FlowResultType.FORM assert result["errors"] is None with patch("lacrosse_view.LaCrosse.login", return_value=True,), patch( @@ -30,7 +30,7 @@ async def test_form(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == RESULT_TYPE_FORM + assert result2["type"] == FlowResultType.FORM assert result2["step_id"] == "location" assert result2["errors"] is None @@ -75,7 +75,7 @@ async def test_form_auth_false(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == RESULT_TYPE_FORM + assert result2["type"] == FlowResultType.FORM assert result2["errors"] == {"base": "invalid_auth"} @@ -94,7 +94,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == RESULT_TYPE_FORM + assert result2["type"] == FlowResultType.FORM assert result2["errors"] == {"base": "invalid_auth"} @@ -115,7 +115,7 @@ async def test_form_login_first(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == RESULT_TYPE_FORM + assert result2["type"] == FlowResultType.FORM assert result2["errors"] == {"base": "invalid_auth"} @@ -137,7 +137,7 @@ async def test_form_no_locations(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == RESULT_TYPE_FORM + assert result2["type"] == FlowResultType.FORM assert result2["errors"] == {"base": "no_locations"} @@ -159,5 +159,5 @@ async def test_form_unexpected_error(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == RESULT_TYPE_FORM + assert result2["type"] == FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} diff --git a/tests/components/lifx/test_config_flow.py b/tests/components/lifx/test_config_flow.py index f007e9ee0e879281f26dcead4a8a473397daf65f..b346233874a0ca0f9bbd1363557bc3837c4c5206 100644 --- a/tests/components/lifx/test_config_flow.py +++ b/tests/components/lifx/test_config_flow.py @@ -10,7 +10,7 @@ from homeassistant.components.lifx import DOMAIN from homeassistant.components.lifx.const import CONF_SERIAL from homeassistant.const import CONF_DEVICE, CONF_HOST from homeassistant.core import HomeAssistant -from homeassistant.data_entry_flow import RESULT_TYPE_ABORT, RESULT_TYPE_FORM +from homeassistant.data_entry_flow import FlowResultType from . import ( DEFAULT_ENTRY_TITLE, @@ -332,7 +332,7 @@ async def test_discovered_by_discovery_and_dhcp(hass): data={CONF_HOST: IP_ADDRESS, CONF_SERIAL: SERIAL}, ) await hass.async_block_till_done() - assert result["type"] == RESULT_TYPE_FORM + assert result["type"] == FlowResultType.FORM assert result["errors"] is None with _patch_discovery(), _patch_config_flow_try_connect(): @@ -344,7 +344,7 @@ async def test_discovered_by_discovery_and_dhcp(hass): ), ) await hass.async_block_till_done() - assert result2["type"] == RESULT_TYPE_ABORT + assert result2["type"] == FlowResultType.ABORT assert result2["reason"] == "already_in_progress" with _patch_discovery(), _patch_config_flow_try_connect(): @@ -356,7 +356,7 @@ async def test_discovered_by_discovery_and_dhcp(hass): ), ) await hass.async_block_till_done() - assert result3["type"] == RESULT_TYPE_ABORT + assert result3["type"] == FlowResultType.ABORT assert result3["reason"] == "already_in_progress" with _patch_discovery(no_device=True), _patch_config_flow_try_connect( @@ -370,7 +370,7 @@ async def test_discovered_by_discovery_and_dhcp(hass): ), ) await hass.async_block_till_done() - assert result3["type"] == RESULT_TYPE_ABORT + assert result3["type"] == FlowResultType.ABORT assert result3["reason"] == "cannot_connect" @@ -408,7 +408,7 @@ async def test_discovered_by_dhcp_or_discovery(hass, source, data): ) await hass.async_block_till_done() - assert result["type"] == RESULT_TYPE_FORM + assert result["type"] == FlowResultType.FORM assert result["errors"] is None with _patch_discovery(), _patch_config_flow_try_connect(), patch( @@ -462,7 +462,7 @@ async def test_discovered_by_dhcp_or_discovery_failed_to_get_device(hass, source DOMAIN, context={"source": source}, data=data ) await hass.async_block_till_done() - assert result["type"] == RESULT_TYPE_ABORT + assert result["type"] == FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -483,7 +483,7 @@ async def test_discovered_by_dhcp_updates_ip(hass): ), ) await hass.async_block_till_done() - assert result["type"] == RESULT_TYPE_ABORT + assert result["type"] == FlowResultType.ABORT assert result["reason"] == "already_configured" assert config_entry.data[CONF_HOST] == IP_ADDRESS diff --git a/tests/components/simplisafe/test_config_flow.py b/tests/components/simplisafe/test_config_flow.py index cf92ed94d4107b2dab24563890d64026725bc452..fe803ba187e9b8b912d1a3727d49bdd556f3c75e 100644 --- a/tests/components/simplisafe/test_config_flow.py +++ b/tests/components/simplisafe/test_config_flow.py @@ -10,6 +10,7 @@ from homeassistant.components.simplisafe import DOMAIN from homeassistant.components.simplisafe.config_flow import CONF_AUTH_CODE from homeassistant.config_entries import SOURCE_REAUTH, SOURCE_USER from homeassistant.const import CONF_CODE, CONF_TOKEN, CONF_USERNAME +from homeassistant.data_entry_flow import FlowResultType VALID_AUTH_CODE = "code12345123451234512345123451234512345123451" @@ -23,12 +24,12 @@ async def test_duplicate_error(config_entry, hass, setup_simplisafe): DOMAIN, context={"source": SOURCE_USER} ) assert result["step_id"] == "user" - assert result["type"] == data_entry_flow.RESULT_TYPE_FORM + assert result["type"] == FlowResultType.FORM result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_AUTH_CODE: VALID_AUTH_CODE} ) - assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT + assert result["type"] == data_entry_flow.FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -38,12 +39,12 @@ async def test_invalid_auth_code_length(hass): DOMAIN, context={"source": SOURCE_USER} ) assert result["step_id"] == "user" - assert result["type"] == data_entry_flow.RESULT_TYPE_FORM + assert result["type"] == FlowResultType.FORM result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_AUTH_CODE: "too_short_code"} ) - assert result["type"] == data_entry_flow.RESULT_TYPE_FORM + assert result["type"] == FlowResultType.FORM assert result["errors"] == {CONF_AUTH_CODE: "invalid_auth_code_length"} @@ -57,13 +58,13 @@ async def test_invalid_credentials(hass): DOMAIN, context={"source": SOURCE_USER} ) assert result["step_id"] == "user" - assert result["type"] == data_entry_flow.RESULT_TYPE_FORM + assert result["type"] == FlowResultType.FORM result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_AUTH_CODE: VALID_AUTH_CODE}, ) - assert result["type"] == data_entry_flow.RESULT_TYPE_FORM + assert result["type"] == FlowResultType.FORM assert result["errors"] == {CONF_AUTH_CODE: "invalid_auth"} @@ -75,7 +76,7 @@ async def test_options_flow(config_entry, hass): 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.RESULT_TYPE_FORM + assert result["type"] == FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -101,7 +102,7 @@ async def test_step_reauth(config_entry, hass, setup_simplisafe): result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_AUTH_CODE: VALID_AUTH_CODE} ) - assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT + assert result["type"] == data_entry_flow.FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert len(hass.config_entries.async_entries()) == 1 @@ -125,7 +126,7 @@ async def test_step_reauth_wrong_account(config_entry, hass, setup_simplisafe): result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_AUTH_CODE: VALID_AUTH_CODE} ) - assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT + assert result["type"] == data_entry_flow.FlowResultType.ABORT assert result["reason"] == "wrong_account" @@ -177,10 +178,10 @@ async def test_unknown_error(hass, setup_simplisafe): DOMAIN, context={"source": SOURCE_USER} ) assert result["step_id"] == "user" - assert result["type"] == data_entry_flow.RESULT_TYPE_FORM + assert result["type"] == FlowResultType.FORM result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_AUTH_CODE: VALID_AUTH_CODE} ) - assert result["type"] == data_entry_flow.RESULT_TYPE_FORM + assert result["type"] == FlowResultType.FORM assert result["errors"] == {"base": "unknown"}