diff --git a/tests/components/kaleidescape/test_config_flow.py b/tests/components/kaleidescape/test_config_flow.py index 8171ed0955b..5d9f8dba146 100644 --- a/tests/components/kaleidescape/test_config_flow.py +++ b/tests/components/kaleidescape/test_config_flow.py @@ -21,7 +21,7 @@ async def test_user_config_flow_success( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" result = await hass.config_entries.flow.async_configure( @@ -29,7 +29,7 @@ async def test_user_config_flow_success( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert "data" in result assert result["data"][CONF_HOST] == MOCK_HOST @@ -44,7 +44,7 @@ async def test_user_config_flow_bad_connect_errors( DOMAIN, context={"source": SOURCE_USER}, data={CONF_HOST: MOCK_HOST} ) - 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_config_flow_unsupported_device_errors( DOMAIN, context={"source": SOURCE_USER}, data={CONF_HOST: MOCK_HOST} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "unsupported"} @@ -71,7 +71,7 @@ async def test_user_config_flow_device_exists_abort( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data={CONF_HOST: MOCK_HOST} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -83,7 +83,7 @@ async def test_ssdp_config_flow_success( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_SSDP}, data=discovery_info ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "discovery_confirm" result = await hass.config_entries.flow.async_configure( @@ -91,7 +91,7 @@ async def test_ssdp_config_flow_success( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert "data" in result assert result["data"][CONF_HOST] == MOCK_HOST @@ -107,7 +107,7 @@ async def test_ssdp_config_flow_bad_connect_aborts( DOMAIN, context={"source": SOURCE_SSDP}, data=discovery_info ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -122,5 +122,5 @@ async def test_ssdp_config_flow_unsupported_device_aborts( DOMAIN, context={"source": SOURCE_SSDP}, data=discovery_info ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "unsupported" diff --git a/tests/components/keenetic_ndms2/test_config_flow.py b/tests/components/keenetic_ndms2/test_config_flow.py index e1cb083dc73..18bacc3a32c 100644 --- a/tests/components/keenetic_ndms2/test_config_flow.py +++ b/tests/components/keenetic_ndms2/test_config_flow.py @@ -7,11 +7,12 @@ from ndms2_client import ConnectionException from ndms2_client.client import InterfaceInfo, RouterInfo import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components import keenetic_ndms2 as keenetic, ssdp from homeassistant.components.keenetic_ndms2 import const from homeassistant.const import CONF_HOST, CONF_SOURCE from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from . import MOCK_DATA, MOCK_NAME, MOCK_OPTIONS, MOCK_SSDP_DISCOVERY_INFO @@ -51,7 +52,7 @@ async def test_flow_works(hass: HomeAssistant, connect) -> None: result = await hass.config_entries.flow.async_init( keenetic.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with patch( @@ -63,7 +64,7 @@ async def test_flow_works(hass: HomeAssistant, connect) -> 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"] == MOCK_NAME assert result2["data"] == MOCK_DATA assert len(mock_setup_entry.mock_calls) == 1 @@ -98,7 +99,7 @@ async def test_options(hass: HomeAssistant) -> None: result = await hass.config_entries.options.async_init(entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" result2 = await hass.config_entries.options.async_configure( @@ -106,7 +107,7 @@ async def test_options(hass: HomeAssistant) -> None: user_input=MOCK_OPTIONS, ) - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["data"] == MOCK_OPTIONS @@ -126,7 +127,7 @@ async def test_host_already_configured(hass: HomeAssistant, connect) -> None: result["flow_id"], user_input=MOCK_DATA ) - assert result2["type"] == data_entry_flow.FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" @@ -139,7 +140,7 @@ async def test_connection_error(hass: HomeAssistant, connect_error) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_DATA ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} @@ -153,7 +154,7 @@ async def test_ssdp_works(hass: HomeAssistant, connect) -> None: data=discovery_info, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with patch( @@ -168,7 +169,7 @@ async def test_ssdp_works(hass: HomeAssistant, connect) -> 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"] == MOCK_NAME assert result2["data"] == MOCK_DATA assert len(mock_setup_entry.mock_calls) == 1 @@ -189,7 +190,7 @@ async def test_ssdp_already_configured(hass: HomeAssistant) -> None: data=discovery_info, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -210,7 +211,7 @@ async def test_ssdp_ignored(hass: HomeAssistant) -> None: data=discovery_info, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -236,7 +237,7 @@ async def test_ssdp_update_host(hass: HomeAssistant) -> None: data=discovery_info, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert entry.data[CONF_HOST] == new_ip @@ -254,7 +255,7 @@ async def test_ssdp_reject_no_udn(hass: HomeAssistant) -> None: data=discovery_info, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_udn" @@ -270,5 +271,5 @@ async def test_ssdp_reject_non_keenetic(hass: HomeAssistant) -> None: data=discovery_info, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_keenetic_ndms2" diff --git a/tests/components/kegtron/test_config_flow.py b/tests/components/kegtron/test_config_flow.py index 4e21dc238bc..fe5cc0e5e5e 100644 --- a/tests/components/kegtron/test_config_flow.py +++ b/tests/components/kegtron/test_config_flow.py @@ -23,13 +23,13 @@ async def test_async_step_bluetooth_valid_device(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=KEGTRON_KT100_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch("homeassistant.components.kegtron.async_setup_entry", return_value=True): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Kegtron KT-100 9B75" assert result2["data"] == {} assert result2["result"].unique_id == "D0:CF:5E:5C:9B:75" @@ -42,7 +42,7 @@ async def test_async_step_bluetooth_not_kegtron(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=NOT_KEGTRON_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_supported" @@ -52,7 +52,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" @@ -66,14 +66,14 @@ async def test_async_step_user_with_found_devices(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with patch("homeassistant.components.kegtron.async_setup_entry", return_value=True): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={"address": "D0:CF:5E:5C:9B:75"}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Kegtron KT-200 9B75" assert result2["data"] == {} assert result2["result"].unique_id == "D0:CF:5E:5C:9B:75" @@ -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( @@ -103,7 +103,7 @@ async def test_async_step_user_device_added_between_steps(hass: HomeAssistant) - result["flow_id"], user_input={"address": "D0:CF:5E:5C:9B:75"}, ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" @@ -125,7 +125,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" @@ -142,7 +142,7 @@ async def test_async_step_bluetooth_devices_already_setup(hass: HomeAssistant) - context={"source": config_entries.SOURCE_BLUETOOTH}, data=KEGTRON_KT100_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -153,7 +153,7 @@ async def test_async_step_bluetooth_already_in_progress(hass: HomeAssistant) -> context={"source": config_entries.SOURCE_BLUETOOTH}, data=KEGTRON_KT100_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( @@ -161,7 +161,7 @@ async def test_async_step_bluetooth_already_in_progress(hass: HomeAssistant) -> context={"source": config_entries.SOURCE_BLUETOOTH}, data=KEGTRON_KT100_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_in_progress" @@ -174,7 +174,7 @@ async def test_async_step_user_takes_precedence_over_discovery( context={"source": config_entries.SOURCE_BLUETOOTH}, data=KEGTRON_KT100_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch( @@ -185,14 +185,14 @@ async def test_async_step_user_takes_precedence_over_discovery( DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM with patch("homeassistant.components.kegtron.async_setup_entry", return_value=True): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={"address": "D0:CF:5E:5C:9B:75"}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Kegtron KT-100 9B75" assert result2["data"] == {} assert result2["result"].unique_id == "D0:CF:5E:5C:9B:75" diff --git a/tests/components/keymitt_ble/test_config_flow.py b/tests/components/keymitt_ble/test_config_flow.py index 7e60bdfca53..029b50b9728 100644 --- a/tests/components/keymitt_ble/test_config_flow.py +++ b/tests/components/keymitt_ble/test_config_flow.py @@ -33,7 +33,7 @@ async def test_bluetooth_discovery(hass: HomeAssistant) -> None: context={"source": SOURCE_BLUETOOTH}, data=SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" with patch_async_setup_entry() as mock_setup_entry, patch_microbot_api(): @@ -43,7 +43,7 @@ async def test_bluetooth_discovery(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert len(mock_setup_entry.mock_calls) == 0 @@ -64,7 +64,7 @@ async def test_bluetooth_discovery_already_setup(hass: HomeAssistant) -> None: context={"source": SOURCE_BLUETOOTH}, data=SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -78,7 +78,7 @@ async def test_user_setup(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" assert result["errors"] == {} @@ -89,7 +89,7 @@ async def test_user_setup(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "link" assert result2["errors"] is None @@ -100,7 +100,7 @@ async def test_user_setup(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["result"].data == { CONF_ADDRESS: "aa:bb:cc:dd:ee:ff", CONF_ACCESS_TOKEN: ANY, @@ -125,7 +125,7 @@ async def test_user_setup_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" @@ -141,7 +141,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" @@ -158,7 +158,7 @@ async def test_no_link(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"] == "init" assert result["errors"] == {} @@ -168,7 +168,7 @@ async def test_no_link(hass: HomeAssistant) -> None: USER_INPUT, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "link" with ( patch( @@ -183,7 +183,7 @@ async def test_no_link(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["step_id"] == "link" assert result3["errors"] == {"base": "linking"} diff --git a/tests/components/kitchen_sink/test_config_flow.py b/tests/components/kitchen_sink/test_config_flow.py index 86c1698669e..e530ed0e6f3 100644 --- a/tests/components/kitchen_sink/test_config_flow.py +++ b/tests/components/kitchen_sink/test_config_flow.py @@ -2,9 +2,10 @@ from unittest.mock import patch -from homeassistant import config_entries, data_entry_flow, setup +from homeassistant import config_entries, setup from homeassistant.components.kitchen_sink import DOMAIN from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from homeassistant.setup import async_setup_component @@ -30,7 +31,7 @@ async def test_import_once(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_IMPORT}, data={}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Kitchen Sink" assert result["data"] == {} assert result["options"] == {} @@ -45,7 +46,7 @@ async def test_import_once(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_IMPORT}, data={}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" mock_setup_entry.assert_not_called() @@ -63,5 +64,5 @@ async def test_reauth(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_configure(flows[0]["flow_id"], {}) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" diff --git a/tests/components/kmtronic/test_config_flow.py b/tests/components/kmtronic/test_config_flow.py index 222bb8bead2..a59821b4ec5 100644 --- a/tests/components/kmtronic/test_config_flow.py +++ b/tests/components/kmtronic/test_config_flow.py @@ -6,10 +6,11 @@ from unittest.mock import AsyncMock, Mock, patch from aiohttp import ClientConnectorError, ClientResponseError import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.kmtronic.const import CONF_REVERSE, DOMAIN from homeassistant.config_entries import ConfigEntryState from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry from tests.test_util.aiohttp import AiohttpClientMocker @@ -74,14 +75,14 @@ async def test_form_options( assert config_entry.state is ConfigEntryState.LOADED 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_REVERSE: True} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == {CONF_REVERSE: True} await hass.async_block_till_done() diff --git a/tests/components/knx/test_config_flow.py b/tests/components/knx/test_config_flow.py index f5b3d9595d0..44d5b8bcf80 100644 --- a/tests/components/knx/test_config_flow.py +++ b/tests/components/knx/test_config_flow.py @@ -163,7 +163,7 @@ async def test_routing_setup( 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"] result2 = await hass.config_entries.flow.async_configure( @@ -172,7 +172,7 @@ async def test_routing_setup( CONF_KNX_CONNECTION_TYPE: CONF_KNX_ROUTING, }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "routing" assert result2["errors"] == {"base": "no_router_discovered"} @@ -185,7 +185,7 @@ async def test_routing_setup( }, ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == "Routing as 1.1.110" assert result3["data"] == { **DEFAULT_ENTRY_DATA, @@ -217,7 +217,7 @@ async def test_routing_setup_advanced( "show_advanced_options": True, }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert not result["errors"] result2 = await hass.config_entries.flow.async_configure( @@ -226,7 +226,7 @@ async def test_routing_setup_advanced( CONF_KNX_CONNECTION_TYPE: CONF_KNX_ROUTING, }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "routing" assert result2["errors"] == {"base": "no_router_discovered"} @@ -240,7 +240,7 @@ async def test_routing_setup_advanced( CONF_KNX_LOCAL_IP: "no_local_ip", }, ) - assert result_invalid_input["type"] == FlowResultType.FORM + assert result_invalid_input["type"] is FlowResultType.FORM assert result_invalid_input["step_id"] == "routing" assert result_invalid_input["errors"] == { CONF_KNX_MCAST_GRP: "invalid_ip_address", @@ -260,7 +260,7 @@ async def test_routing_setup_advanced( }, ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == "Routing as 1.1.110" assert result3["data"] == { **DEFAULT_ENTRY_DATA, @@ -288,7 +288,7 @@ async def test_routing_secure_manual_setup( 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"] result2 = await hass.config_entries.flow.async_configure( @@ -297,7 +297,7 @@ async def test_routing_secure_manual_setup( CONF_KNX_CONNECTION_TYPE: CONF_KNX_ROUTING, }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "routing" assert result2["errors"] == {"base": "no_router_discovered"} @@ -310,14 +310,14 @@ async def test_routing_secure_manual_setup( CONF_KNX_ROUTING_SECURE: True, }, ) - assert result3["type"] == FlowResultType.MENU + assert result3["type"] is FlowResultType.MENU assert result3["step_id"] == "secure_key_source_menu_routing" result4 = await hass.config_entries.flow.async_configure( result3["flow_id"], {"next_step_id": "secure_routing_manual"}, ) - assert result4["type"] == FlowResultType.FORM + assert result4["type"] is FlowResultType.FORM assert result4["step_id"] == "secure_routing_manual" assert not result4["errors"] @@ -328,7 +328,7 @@ async def test_routing_secure_manual_setup( CONF_KNX_ROUTING_SYNC_LATENCY_TOLERANCE: 2000, }, ) - assert result_invalid_key1["type"] == FlowResultType.FORM + assert result_invalid_key1["type"] is FlowResultType.FORM assert result_invalid_key1["step_id"] == "secure_routing_manual" assert result_invalid_key1["errors"] == {"backbone_key": "invalid_backbone_key"} @@ -339,7 +339,7 @@ async def test_routing_secure_manual_setup( CONF_KNX_ROUTING_SYNC_LATENCY_TOLERANCE: 2000, }, ) - assert result_invalid_key2["type"] == FlowResultType.FORM + assert result_invalid_key2["type"] is FlowResultType.FORM assert result_invalid_key2["step_id"] == "secure_routing_manual" assert result_invalid_key2["errors"] == {"backbone_key": "invalid_backbone_key"} @@ -351,7 +351,7 @@ async def test_routing_secure_manual_setup( }, ) await hass.async_block_till_done() - assert secure_routing_manual["type"] == FlowResultType.CREATE_ENTRY + assert secure_routing_manual["type"] is FlowResultType.CREATE_ENTRY assert secure_routing_manual["title"] == "Secure Routing as 0.0.123" assert secure_routing_manual["data"] == { **DEFAULT_ENTRY_DATA, @@ -378,7 +378,7 @@ async def test_routing_secure_keyfile( 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"] result2 = await hass.config_entries.flow.async_configure( @@ -387,7 +387,7 @@ async def test_routing_secure_keyfile( CONF_KNX_CONNECTION_TYPE: CONF_KNX_ROUTING, }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "routing" assert result2["errors"] == {"base": "no_router_discovered"} @@ -400,14 +400,14 @@ async def test_routing_secure_keyfile( CONF_KNX_ROUTING_SECURE: True, }, ) - assert result3["type"] == FlowResultType.MENU + assert result3["type"] is FlowResultType.MENU assert result3["step_id"] == "secure_key_source_menu_routing" result4 = await hass.config_entries.flow.async_configure( result3["flow_id"], {"next_step_id": "secure_knxkeys"}, ) - assert result4["type"] == FlowResultType.FORM + assert result4["type"] is FlowResultType.FORM assert result4["step_id"] == "secure_knxkeys" assert not result4["errors"] @@ -420,7 +420,7 @@ async def test_routing_secure_keyfile( }, ) await hass.async_block_till_done() - assert routing_secure_knxkeys["type"] == FlowResultType.CREATE_ENTRY + assert routing_secure_knxkeys["type"] is FlowResultType.CREATE_ENTRY assert routing_secure_knxkeys["title"] == "Secure Routing as 0.0.123" assert routing_secure_knxkeys["data"] == { **DEFAULT_ENTRY_DATA, @@ -525,7 +525,7 @@ async def test_tunneling_setup_manual( 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"] result2 = await hass.config_entries.flow.async_configure( @@ -534,7 +534,7 @@ async def test_tunneling_setup_manual( CONF_KNX_CONNECTION_TYPE: CONF_KNX_TUNNELING, }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "manual_tunnel" assert result2["errors"] == {"base": "no_tunnel_discovered"} @@ -553,7 +553,7 @@ async def test_tunneling_setup_manual( user_input, ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == title assert result3["data"] == config_entry_data knx_setup.assert_called_once() @@ -682,7 +682,7 @@ async def test_tunneling_setup_manual_request_description_error( }, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Tunneling TCP @ 192.168.0.1" assert result["data"] == { **DEFAULT_ENTRY_DATA, @@ -716,7 +716,7 @@ async def test_tunneling_setup_for_local_ip( "show_advanced_options": True, }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert not result["errors"] result2 = await hass.config_entries.flow.async_configure( @@ -725,7 +725,7 @@ async def test_tunneling_setup_for_local_ip( CONF_KNX_CONNECTION_TYPE: CONF_KNX_TUNNELING, }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "manual_tunnel" assert result2["errors"] == {"base": "no_tunnel_discovered"} @@ -739,7 +739,7 @@ async def test_tunneling_setup_for_local_ip( CONF_KNX_LOCAL_IP: "192.168.1.112", }, ) - assert result_invalid_host["type"] == FlowResultType.FORM + assert result_invalid_host["type"] is FlowResultType.FORM assert result_invalid_host["step_id"] == "manual_tunnel" assert result_invalid_host["errors"] == { CONF_HOST: "invalid_ip_address", @@ -755,7 +755,7 @@ async def test_tunneling_setup_for_local_ip( CONF_KNX_LOCAL_IP: "asdf", }, ) - assert result_invalid_local["type"] == FlowResultType.FORM + assert result_invalid_local["type"] is FlowResultType.FORM assert result_invalid_local["step_id"] == "manual_tunnel" assert result_invalid_local["errors"] == { CONF_KNX_LOCAL_IP: "invalid_ip_address", @@ -773,7 +773,7 @@ async def test_tunneling_setup_for_local_ip( }, ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == "Tunneling UDP @ 192.168.0.2" assert result3["data"] == { **DEFAULT_ENTRY_DATA, @@ -804,7 +804,7 @@ async def test_tunneling_setup_for_multiple_found_gateways( 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"] tunnel_flow = await hass.config_entries.flow.async_configure( @@ -813,7 +813,7 @@ async def test_tunneling_setup_for_multiple_found_gateways( CONF_KNX_CONNECTION_TYPE: CONF_KNX_TUNNELING, }, ) - assert tunnel_flow["type"] == FlowResultType.FORM + assert tunnel_flow["type"] is FlowResultType.FORM assert tunnel_flow["step_id"] == "tunnel" assert not tunnel_flow["errors"] @@ -822,7 +822,7 @@ async def test_tunneling_setup_for_multiple_found_gateways( {CONF_KNX_GATEWAY: str(gateway)}, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { **DEFAULT_ENTRY_DATA, CONF_KNX_CONNECTION_TYPE: CONF_KNX_TUNNELING, @@ -859,7 +859,7 @@ async def test_manual_tunnel_step_with_found_gateway( 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"] tunnel_flow = await hass.config_entries.flow.async_configure( @@ -868,7 +868,7 @@ async def test_manual_tunnel_step_with_found_gateway( CONF_KNX_CONNECTION_TYPE: CONF_KNX_TUNNELING, }, ) - assert tunnel_flow["type"] == FlowResultType.FORM + assert tunnel_flow["type"] is FlowResultType.FORM assert tunnel_flow["step_id"] == "tunnel" assert not tunnel_flow["errors"] @@ -878,7 +878,7 @@ async def test_manual_tunnel_step_with_found_gateway( CONF_KNX_GATEWAY: OPTION_MANUAL_TUNNEL, }, ) - assert manual_tunnel_flow["type"] == FlowResultType.FORM + assert manual_tunnel_flow["type"] is FlowResultType.FORM assert manual_tunnel_flow["step_id"] == "manual_tunnel" assert not manual_tunnel_flow["errors"] @@ -896,7 +896,7 @@ async def test_form_with_automatic_connection_handling( 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"] result2 = await hass.config_entries.flow.async_configure( @@ -906,7 +906,7 @@ async def test_form_with_automatic_connection_handling( }, ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == CONF_KNX_AUTOMATIC.capitalize() assert result2["data"] == { # don't use **DEFAULT_ENTRY_DATA here to check for correct usage of defaults @@ -939,7 +939,7 @@ async def _get_menu_step_secure_tunnel(hass: HomeAssistant) -> FlowResult: 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"] result2 = await hass.config_entries.flow.async_configure( @@ -948,7 +948,7 @@ async def _get_menu_step_secure_tunnel(hass: HomeAssistant) -> FlowResult: CONF_KNX_CONNECTION_TYPE: CONF_KNX_TUNNELING, }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "tunnel" assert not result2["errors"] @@ -956,7 +956,7 @@ async def _get_menu_step_secure_tunnel(hass: HomeAssistant) -> FlowResult: result2["flow_id"], {CONF_KNX_GATEWAY: str(gateway)}, ) - assert result3["type"] == FlowResultType.MENU + assert result3["type"] is FlowResultType.MENU assert result3["step_id"] == "secure_key_source_menu_tunnel" return result3 @@ -988,7 +988,7 @@ async def test_get_secure_menu_step_manual_tunnelling( 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"] result2 = await hass.config_entries.flow.async_configure( @@ -997,7 +997,7 @@ async def test_get_secure_menu_step_manual_tunnelling( CONF_KNX_CONNECTION_TYPE: CONF_KNX_TUNNELING, }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "tunnel" assert not result2["errors"] @@ -1016,7 +1016,7 @@ async def test_get_secure_menu_step_manual_tunnelling( CONF_PORT: 3675, }, ) - assert result3["type"] == FlowResultType.MENU + assert result3["type"] is FlowResultType.MENU assert result3["step_id"] == "secure_key_source_menu_tunnel" @@ -1028,7 +1028,7 @@ async def test_configure_secure_tunnel_manual(hass: HomeAssistant, knx_setup) -> menu_step["flow_id"], {"next_step_id": "secure_tunnel_manual"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "secure_tunnel_manual" assert not result["errors"] @@ -1041,7 +1041,7 @@ async def test_configure_secure_tunnel_manual(hass: HomeAssistant, knx_setup) -> }, ) await hass.async_block_till_done() - assert secure_tunnel_manual["type"] == FlowResultType.CREATE_ENTRY + assert secure_tunnel_manual["type"] is FlowResultType.CREATE_ENTRY assert secure_tunnel_manual["data"] == { **DEFAULT_ENTRY_DATA, CONF_KNX_CONNECTION_TYPE: CONF_KNX_TUNNELING_TCP_SECURE, @@ -1066,7 +1066,7 @@ async def test_configure_secure_knxkeys(hass: HomeAssistant, knx_setup) -> None: menu_step["flow_id"], {"next_step_id": "secure_knxkeys"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "secure_knxkeys" assert not result["errors"] @@ -1078,7 +1078,7 @@ async def test_configure_secure_knxkeys(hass: HomeAssistant, knx_setup) -> None: CONF_KNX_KNXKEY_PASSWORD: "test", }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert secure_knxkeys["step_id"] == "knxkeys_tunnel_select" assert not result["errors"] secure_knxkeys = await hass.config_entries.flow.async_configure( @@ -1087,7 +1087,7 @@ async def test_configure_secure_knxkeys(hass: HomeAssistant, knx_setup) -> None: ) await hass.async_block_till_done() - assert secure_knxkeys["type"] == FlowResultType.CREATE_ENTRY + assert secure_knxkeys["type"] is FlowResultType.CREATE_ENTRY assert secure_knxkeys["data"] == { **DEFAULT_ENTRY_DATA, CONF_KNX_CONNECTION_TYPE: CONF_KNX_TUNNELING_TCP_SECURE, @@ -1116,7 +1116,7 @@ async def test_configure_secure_knxkeys_invalid_signature(hass: HomeAssistant) - menu_step["flow_id"], {"next_step_id": "secure_knxkeys"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "secure_knxkeys" assert not result["errors"] @@ -1130,7 +1130,7 @@ async def test_configure_secure_knxkeys_invalid_signature(hass: HomeAssistant) - CONF_KNX_KNXKEY_PASSWORD: "password", }, ) - assert secure_knxkeys["type"] == FlowResultType.FORM + assert secure_knxkeys["type"] is FlowResultType.FORM assert secure_knxkeys["errors"] assert ( secure_knxkeys["errors"][CONF_KNX_KNXKEY_PASSWORD] @@ -1146,7 +1146,7 @@ async def test_configure_secure_knxkeys_no_tunnel_for_host(hass: HomeAssistant) menu_step["flow_id"], {"next_step_id": "secure_knxkeys"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "secure_knxkeys" assert not result["errors"] @@ -1159,7 +1159,7 @@ async def test_configure_secure_knxkeys_no_tunnel_for_host(hass: HomeAssistant) CONF_KNX_KNXKEY_PASSWORD: "password", }, ) - assert secure_knxkeys["type"] == FlowResultType.FORM + assert secure_knxkeys["type"] is FlowResultType.FORM assert secure_knxkeys["errors"] == {"base": "keyfile_no_tunnel_for_host"} @@ -1183,7 +1183,7 @@ async def test_options_flow_connection_type( menu_step["flow_id"], {"next_step_id": "connection_type"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "connection_type" result2 = await hass.config_entries.options.async_configure( @@ -1192,7 +1192,7 @@ async def test_options_flow_connection_type( CONF_KNX_CONNECTION_TYPE: CONF_KNX_TUNNELING, }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "tunnel" result3 = await hass.config_entries.options.async_configure( @@ -1202,7 +1202,7 @@ async def test_options_flow_connection_type( }, ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert not result3["data"] assert mock_config_entry.data == { CONF_KNX_CONNECTION_TYPE: CONF_KNX_TUNNELING, @@ -1263,7 +1263,7 @@ async def test_options_flow_secure_manual_to_keyfile( menu_step["flow_id"], {"next_step_id": "connection_type"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "connection_type" result2 = await hass.config_entries.options.async_configure( @@ -1272,7 +1272,7 @@ async def test_options_flow_secure_manual_to_keyfile( CONF_KNX_CONNECTION_TYPE: CONF_KNX_TUNNELING, }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "tunnel" assert not result2["errors"] @@ -1280,14 +1280,14 @@ async def test_options_flow_secure_manual_to_keyfile( result2["flow_id"], {CONF_KNX_GATEWAY: str(gateway)}, ) - assert result3["type"] == FlowResultType.MENU + assert result3["type"] is FlowResultType.MENU assert result3["step_id"] == "secure_key_source_menu_tunnel" result4 = await hass.config_entries.options.async_configure( result3["flow_id"], {"next_step_id": "secure_knxkeys"}, ) - assert result4["type"] == FlowResultType.FORM + assert result4["type"] is FlowResultType.FORM assert result4["step_id"] == "secure_knxkeys" assert not result4["errors"] @@ -1299,7 +1299,7 @@ async def test_options_flow_secure_manual_to_keyfile( CONF_KNX_KNXKEY_PASSWORD: "test", }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert secure_knxkeys["step_id"] == "knxkeys_tunnel_select" assert not result["errors"] secure_knxkeys = await hass.config_entries.options.async_configure( @@ -1308,7 +1308,7 @@ async def test_options_flow_secure_manual_to_keyfile( ) await hass.async_block_till_done() - assert secure_knxkeys["type"] == FlowResultType.CREATE_ENTRY + assert secure_knxkeys["type"] is FlowResultType.CREATE_ENTRY assert mock_config_entry.data == { **DEFAULT_ENTRY_DATA, CONF_KNX_CONNECTION_TYPE: CONF_KNX_TUNNELING_TCP_SECURE, @@ -1341,7 +1341,7 @@ async def test_options_communication_settings( menu_step["flow_id"], {"next_step_id": "communication_settings"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "communication_settings" result2 = await hass.config_entries.options.async_configure( @@ -1353,7 +1353,7 @@ async def test_options_communication_settings( }, ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert not result2.get("data") assert mock_config_entry.data == { **DEFAULT_ENTRY_DATA, @@ -1394,7 +1394,7 @@ async def test_options_update_keyfile(hass: HomeAssistant, knx_setup) -> None: menu_step["flow_id"], {"next_step_id": "secure_knxkeys"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "secure_knxkeys" with patch_file_upload(): @@ -1406,7 +1406,7 @@ async def test_options_update_keyfile(hass: HomeAssistant, knx_setup) -> None: }, ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert not result2.get("data") assert mock_config_entry.data == { **start_data, @@ -1442,7 +1442,7 @@ async def test_options_keyfile_upload(hass: HomeAssistant, knx_setup) -> None: menu_step["flow_id"], {"next_step_id": "secure_knxkeys"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "secure_knxkeys" with patch_file_upload(): @@ -1454,7 +1454,7 @@ async def test_options_keyfile_upload(hass: HomeAssistant, knx_setup) -> None: }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "knxkeys_tunnel_select" result3 = await hass.config_entries.options.async_configure( @@ -1464,7 +1464,7 @@ async def test_options_keyfile_upload(hass: HomeAssistant, knx_setup) -> None: }, ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert not result3.get("data") assert mock_config_entry.data == { **start_data, diff --git a/tests/components/lacrosse_view/test_config_flow.py b/tests/components/lacrosse_view/test_config_flow.py index 195c004179b..5a48b3d15fe 100644 --- a/tests/components/lacrosse_view/test_config_flow.py +++ b/tests/components/lacrosse_view/test_config_flow.py @@ -20,7 +20,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None with ( @@ -42,7 +42,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "location" assert result2["errors"] is None @@ -54,7 +54,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == "Test" assert result3["data"] == { "username": "test-username", @@ -83,7 +83,7 @@ async def test_form_auth_false(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "invalid_auth"} @@ -102,7 +102,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"} @@ -124,7 +124,7 @@ async def test_form_login_first(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "invalid_auth"} @@ -149,7 +149,7 @@ async def test_form_no_locations(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "no_locations"} @@ -171,7 +171,7 @@ async def test_form_unexpected_error(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} @@ -196,7 +196,7 @@ async def test_already_configured_device( 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 ( @@ -218,7 +218,7 @@ async def test_already_configured_device( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "location" assert result2["errors"] is None @@ -230,7 +230,7 @@ async def test_already_configured_device( ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "already_configured" assert len(mock_setup_entry.mock_calls) == 0 @@ -261,7 +261,7 @@ async def test_reauth(hass: HomeAssistant) -> None: }, data=data, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" new_username = "new-username" @@ -283,7 +283,7 @@ async def test_reauth(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 len(hass.config_entries.async_entries()) == 1 diff --git a/tests/components/lamarzocco/test_config_flow.py b/tests/components/lamarzocco/test_config_flow.py index 37d9c9a3e95..8539f14ce7f 100644 --- a/tests/components/lamarzocco/test_config_flow.py +++ b/tests/components/lamarzocco/test_config_flow.py @@ -30,7 +30,7 @@ async def __do_successful_user_step( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "machine_selection" return result2 @@ -48,7 +48,7 @@ async def __do_sucessful_machine_selection_step( ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == mock_lamarzocco.serial_number assert result3["data"] == { @@ -63,7 +63,7 @@ async def test_form(hass: HomeAssistant, mock_lamarzocco: MagicMock) -> 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"] == {} assert result["step_id"] == "user" @@ -82,7 +82,7 @@ async def test_form_abort_already_configured( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} result2 = await hass.config_entries.flow.async_configure( @@ -91,7 +91,7 @@ async def test_form_abort_already_configured( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "machine_selection" result3 = await hass.config_entries.flow.async_configure( @@ -103,7 +103,7 @@ async def test_form_abort_already_configured( ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "already_configured" @@ -122,7 +122,7 @@ async def test_form_invalid_auth( USER_INPUT, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "invalid_auth"} assert len(mock_lamarzocco.get_all_machines.mock_calls) == 1 @@ -139,7 +139,7 @@ async def test_form_invalid_host( 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( @@ -150,7 +150,7 @@ async def test_form_invalid_host( mock_lamarzocco.check_local_connection.return_value = False - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "machine_selection" result3 = await hass.config_entries.flow.async_configure( @@ -162,7 +162,7 @@ async def test_form_invalid_host( ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["errors"] == {"host": "cannot_connect"} assert len(mock_lamarzocco.get_all_machines.mock_calls) == 1 @@ -187,7 +187,7 @@ async def test_form_cannot_connect( USER_INPUT, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "no_machines"} assert len(mock_lamarzocco.get_all_machines.mock_calls) == 1 @@ -197,7 +197,7 @@ async def test_form_cannot_connect( USER_INPUT, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} assert len(mock_lamarzocco.get_all_machines.mock_calls) == 2 @@ -224,7 +224,7 @@ async def test_reauth_flow( data=mock_config_entry.data, ) - 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( @@ -232,7 +232,7 @@ async def test_reauth_flow( {CONF_PASSWORD: "new_password"}, ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT await hass.async_block_till_done() assert result2["reason"] == "reauth_successful" assert len(mock_lamarzocco.get_all_machines.mock_calls) == 1 @@ -250,14 +250,14 @@ async def test_bluetooth_discovery( DOMAIN, context={"source": config_entries.SOURCE_BLUETOOTH}, data=service_info ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" result2 = await hass.config_entries.flow.async_configure( result["flow_id"], USER_INPUT, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "machine_selection" assert len(mock_lamarzocco.get_all_machines.mock_calls) == 1 @@ -269,7 +269,7 @@ async def test_bluetooth_discovery( ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == mock_lamarzocco.serial_number assert result3["data"] == { @@ -296,7 +296,7 @@ async def test_bluetooth_discovery_errors( data=service_info, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" mock_lamarzocco.get_all_machines.return_value = [("GS98765", "GS3 MP")] @@ -304,7 +304,7 @@ async def test_bluetooth_discovery_errors( result["flow_id"], USER_INPUT, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "machine_not_found"} assert len(mock_lamarzocco.get_all_machines.mock_calls) == 1 @@ -315,7 +315,7 @@ async def test_bluetooth_discovery_errors( result["flow_id"], USER_INPUT, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "machine_selection" assert len(mock_lamarzocco.get_all_machines.mock_calls) == 2 @@ -327,7 +327,7 @@ async def test_bluetooth_discovery_errors( ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == mock_lamarzocco.serial_number assert result3["data"] == { @@ -350,7 +350,7 @@ async def test_options_flow( result = await hass.config_entries.options.async_init(mock_config_entry.entry_id) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result2 = await hass.config_entries.options.async_configure( @@ -361,7 +361,7 @@ async def test_options_flow( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["data"] == { CONF_USE_BLUETOOTH: False, } diff --git a/tests/components/lametric/test_config_flow.py b/tests/components/lametric/test_config_flow.py index e5fa1229e07..2a21423ad03 100644 --- a/tests/components/lametric/test_config_flow.py +++ b/tests/components/lametric/test_config_flow.py @@ -60,7 +60,7 @@ async def test_full_cloud_import_flow_multiple_devices( DOMAIN, context={"source": SOURCE_USER} ) - assert result.get("type") == FlowResultType.MENU + assert result.get("type") is FlowResultType.MENU assert result.get("step_id") == "choice_enter_manual_or_fetch_cloud" assert result.get("menu_options") == ["pick_implementation", "manual_entry"] flow_id = result["flow_id"] @@ -77,7 +77,7 @@ async def test_full_cloud_import_flow_multiple_devices( }, ) - assert result2.get("type") == FlowResultType.EXTERNAL_STEP + assert result2.get("type") is FlowResultType.EXTERNAL_STEP assert result2.get("url") == ( "https://developer.lametric.com/api/v2/oauth2/authorize" "?response_type=code&client_id=client" @@ -103,14 +103,14 @@ async def test_full_cloud_import_flow_multiple_devices( result3 = await hass.config_entries.flow.async_configure(flow_id) - assert result3.get("type") == FlowResultType.FORM + assert result3.get("type") is FlowResultType.FORM assert result3.get("step_id") == "cloud_select_device" result4 = await hass.config_entries.flow.async_configure( flow_id, user_input={CONF_DEVICE: "SA110405124500W00BS9"} ) - assert result4.get("type") == FlowResultType.CREATE_ENTRY + assert result4.get("type") is FlowResultType.CREATE_ENTRY assert result4.get("title") == "Frenck's LaMetric" assert result4.get("data") == { CONF_HOST: "127.0.0.1", @@ -140,7 +140,7 @@ async def test_full_cloud_import_flow_single_device( DOMAIN, context={"source": SOURCE_USER} ) - assert result.get("type") == FlowResultType.MENU + assert result.get("type") is FlowResultType.MENU assert result.get("step_id") == "choice_enter_manual_or_fetch_cloud" assert result.get("menu_options") == ["pick_implementation", "manual_entry"] flow_id = result["flow_id"] @@ -157,7 +157,7 @@ async def test_full_cloud_import_flow_single_device( }, ) - assert result2.get("type") == FlowResultType.EXTERNAL_STEP + assert result2.get("type") is FlowResultType.EXTERNAL_STEP assert result2.get("url") == ( "https://developer.lametric.com/api/v2/oauth2/authorize" "?response_type=code&client_id=client" @@ -188,7 +188,7 @@ async def test_full_cloud_import_flow_single_device( ] result3 = await hass.config_entries.flow.async_configure(flow_id) - assert result3.get("type") == FlowResultType.CREATE_ENTRY + assert result3.get("type") is FlowResultType.CREATE_ENTRY assert result3.get("title") == "Frenck's LaMetric" assert result3.get("data") == { CONF_HOST: "127.0.0.1", @@ -214,7 +214,7 @@ async def test_full_manual( DOMAIN, context={"source": SOURCE_USER} ) - assert result.get("type") == FlowResultType.MENU + assert result.get("type") is FlowResultType.MENU assert result.get("step_id") == "choice_enter_manual_or_fetch_cloud" assert result.get("menu_options") == ["pick_implementation", "manual_entry"] flow_id = result["flow_id"] @@ -223,14 +223,14 @@ async def test_full_manual( flow_id, user_input={"next_step_id": "manual_entry"} ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "manual_entry" result3 = await hass.config_entries.flow.async_configure( flow_id, user_input={CONF_HOST: "127.0.0.1", CONF_API_KEY: "mock-api-key"} ) - assert result3.get("type") == FlowResultType.CREATE_ENTRY + assert result3.get("type") is FlowResultType.CREATE_ENTRY assert result3.get("title") == "Frenck's LaMetric" assert result3.get("data") == { CONF_HOST: "127.0.0.1", @@ -263,7 +263,7 @@ async def test_full_ssdp_with_cloud_import( DOMAIN, context={"source": SOURCE_SSDP}, data=SSDP_DISCOVERY_INFO ) - assert result.get("type") == FlowResultType.MENU + assert result.get("type") is FlowResultType.MENU assert result.get("step_id") == "choice_enter_manual_or_fetch_cloud" assert result.get("menu_options") == ["pick_implementation", "manual_entry"] flow_id = result["flow_id"] @@ -280,7 +280,7 @@ async def test_full_ssdp_with_cloud_import( }, ) - assert result2.get("type") == FlowResultType.EXTERNAL_STEP + assert result2.get("type") is FlowResultType.EXTERNAL_STEP assert result2.get("url") == ( "https://developer.lametric.com/api/v2/oauth2/authorize" "?response_type=code&client_id=client" @@ -306,7 +306,7 @@ async def test_full_ssdp_with_cloud_import( result3 = await hass.config_entries.flow.async_configure(flow_id) - assert result3.get("type") == FlowResultType.CREATE_ENTRY + assert result3.get("type") is FlowResultType.CREATE_ENTRY assert result3.get("title") == "Frenck's LaMetric" assert result3.get("data") == { CONF_HOST: "127.0.0.1", @@ -332,7 +332,7 @@ async def test_full_ssdp_manual_entry( DOMAIN, context={"source": SOURCE_SSDP}, data=SSDP_DISCOVERY_INFO ) - assert result.get("type") == FlowResultType.MENU + assert result.get("type") is FlowResultType.MENU assert result.get("step_id") == "choice_enter_manual_or_fetch_cloud" assert result.get("menu_options") == ["pick_implementation", "manual_entry"] flow_id = result["flow_id"] @@ -341,14 +341,14 @@ async def test_full_ssdp_manual_entry( flow_id, user_input={"next_step_id": "manual_entry"} ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "manual_entry" result3 = await hass.config_entries.flow.async_configure( flow_id, user_input={CONF_API_KEY: "mock-api-key"} ) - assert result3.get("type") == FlowResultType.CREATE_ENTRY + assert result3.get("type") is FlowResultType.CREATE_ENTRY assert result3.get("title") == "Frenck's LaMetric" assert result3.get("data") == { CONF_HOST: "127.0.0.1", @@ -390,7 +390,7 @@ async def test_ssdp_abort_invalid_discovery( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_SSDP}, data=data ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == reason @@ -439,7 +439,7 @@ async def test_cloud_import_updates_existing_entry( flow_id, user_input={CONF_DEVICE: "SA110405124500W00BS9"} ) - assert result2.get("type") == FlowResultType.ABORT + assert result2.get("type") is FlowResultType.ABORT assert result2.get("reason") == "already_configured" assert mock_config_entry.data == { CONF_HOST: "127.0.0.1", @@ -473,7 +473,7 @@ async def test_manual_updates_existing_entry( flow_id, user_input={CONF_HOST: "127.0.0.1", CONF_API_KEY: "mock-api-key"} ) - assert result3.get("type") == FlowResultType.ABORT + assert result3.get("type") is FlowResultType.ABORT assert result3.get("reason") == "already_configured" assert mock_config_entry.data == { CONF_HOST: "127.0.0.1", @@ -495,7 +495,7 @@ async def test_discovery_updates_existing_entry( DOMAIN, context={"source": SOURCE_SSDP}, data=SSDP_DISCOVERY_INFO ) - 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", @@ -544,7 +544,7 @@ async def test_cloud_abort_no_devices( mock_lametric_cloud.devices.return_value = [] result2 = await hass.config_entries.flow.async_configure(flow_id) - assert result2.get("type") == FlowResultType.ABORT + assert result2.get("type") is FlowResultType.ABORT assert result2.get("reason") == "no_devices" assert len(mock_lametric_cloud.devices.mock_calls) == 1 @@ -581,7 +581,7 @@ async def test_manual_errors( flow_id, user_input={CONF_HOST: "127.0.0.1", CONF_API_KEY: "mock-api-key"} ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "manual_entry" assert result2.get("errors") == {"base": reason} @@ -594,7 +594,7 @@ async def test_manual_errors( flow_id, user_input={CONF_HOST: "127.0.0.1", CONF_API_KEY: "mock-api-key"} ) - assert result3.get("type") == FlowResultType.CREATE_ENTRY + assert result3.get("type") is FlowResultType.CREATE_ENTRY assert result3.get("title") == "Frenck's LaMetric" assert result3.get("data") == { CONF_HOST: "127.0.0.1", @@ -664,7 +664,7 @@ async def test_cloud_errors( flow_id, user_input={CONF_DEVICE: "SA110405124500W00BS9"} ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "cloud_select_device" assert result2.get("errors") == {"base": reason} @@ -678,7 +678,7 @@ async def test_cloud_errors( flow_id, user_input={CONF_DEVICE: "SA110405124500W00BS9"} ) - assert result3.get("type") == FlowResultType.CREATE_ENTRY + assert result3.get("type") is FlowResultType.CREATE_ENTRY assert result3.get("title") == "Frenck's LaMetric" assert result3.get("data") == { CONF_HOST: "127.0.0.1", @@ -711,7 +711,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_API_KEY: "mock-from-fixture", @@ -737,7 +737,7 @@ async def test_dhcp_unknown_device( ), ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "unknown" @@ -791,7 +791,7 @@ async def test_reauth_cloud_import( result2 = await hass.config_entries.flow.async_configure(flow_id) - 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_HOST: "127.0.0.1", @@ -855,7 +855,7 @@ async def test_reauth_cloud_abort_device_not_found( result2 = await hass.config_entries.flow.async_configure(flow_id) - assert result2.get("type") == FlowResultType.ABORT + assert result2.get("type") is FlowResultType.ABORT assert result2.get("reason") == "reauth_device_not_found" assert len(mock_lametric_cloud.devices.mock_calls) == 1 @@ -892,7 +892,7 @@ async def test_reauth_manual( flow_id, user_input={CONF_API_KEY: "mock-api-key"} ) - 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_HOST: "127.0.0.1", @@ -934,7 +934,7 @@ async def test_reauth_manual_sky( flow_id, user_input={CONF_API_KEY: "mock-api-key"} ) - 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_HOST: "127.0.0.1", diff --git a/tests/components/landisgyr_heat_meter/test_config_flow.py b/tests/components/landisgyr_heat_meter/test_config_flow.py index d53a81a7edf..fe62d530719 100644 --- a/tests/components/landisgyr_heat_meter/test_config_flow.py +++ b/tests/components/landisgyr_heat_meter/test_config_flow.py @@ -49,7 +49,7 @@ async def test_manual_entry(mock_heat_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" assert result["errors"] == {} @@ -57,7 +57,7 @@ async def test_manual_entry(mock_heat_meter, hass: HomeAssistant) -> None: result["flow_id"], {"device": "Enter Manually"} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "setup_serial_manual_path" assert result["errors"] == {} @@ -65,7 +65,7 @@ async def test_manual_entry(mock_heat_meter, hass: HomeAssistant) -> None: result["flow_id"], {"device": "/dev/ttyUSB0"} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "LUGCUH50" assert result["data"] == { "device": "/dev/ttyUSB0", @@ -85,14 +85,14 @@ async def test_list_entry(mock_port, mock_heat_meter, hass: HomeAssistant) -> No result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} result = await hass.config_entries.flow.async_configure( result["flow_id"], {"device": port.device} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "LUGCUH50" assert result["data"] == { "device": port.device, @@ -110,7 +110,7 @@ async def test_manual_entry_fail(mock_heat_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" assert result["errors"] == {} @@ -118,7 +118,7 @@ async def test_manual_entry_fail(mock_heat_meter, hass: HomeAssistant) -> None: result["flow_id"], {"device": "Enter Manually"} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "setup_serial_manual_path" assert result["errors"] == {} @@ -126,7 +126,7 @@ async def test_manual_entry_fail(mock_heat_meter, hass: HomeAssistant) -> None: result["flow_id"], {"device": "/dev/ttyUSB0"} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "setup_serial_manual_path" assert result["errors"] == {"base": "cannot_connect"} @@ -142,14 +142,14 @@ async def test_list_entry_fail(mock_port, mock_heat_meter, hass: HomeAssistant) 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"] == {} result = await hass.config_entries.flow.async_configure( result["flow_id"], {"device": port.device} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "cannot_connect"} @@ -185,5 +185,5 @@ async def test_already_configured( result["flow_id"], {"device": port.device} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/lastfm/test_config_flow.py b/tests/components/lastfm/test_config_flow.py index 93fc9e5a206..40710af3569 100644 --- a/tests/components/lastfm/test_config_flow.py +++ b/tests/components/lastfm/test_config_flow.py @@ -5,7 +5,6 @@ from unittest.mock import patch from pylast import WSError import pytest -from homeassistant import data_entry_flow from homeassistant.components.lastfm.const import ( CONF_MAIN_USER, CONF_USERS, @@ -15,6 +14,7 @@ from homeassistant.components.lastfm.const import ( from homeassistant.config_entries import SOURCE_USER from homeassistant.const import CONF_API_KEY from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from . import ( API_KEY, @@ -42,14 +42,14 @@ async def test_full_user_flow(hass: HomeAssistant, default_user: MockUser) -> No result["flow_id"], user_input=CONF_USER_DATA, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert not result["errors"] assert result["step_id"] == "friends" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=CONF_FRIENDS_DATA ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == DEFAULT_NAME assert result["options"] == CONF_DATA @@ -78,7 +78,7 @@ async def test_flow_fails( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=CONF_USER_DATA ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"]["base"] == message @@ -87,14 +87,14 @@ async def test_flow_fails( result["flow_id"], user_input=CONF_USER_DATA, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert not result["errors"] assert result["step_id"] == "friends" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=CONF_FRIENDS_DATA ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == DEFAULT_NAME assert result["options"] == CONF_DATA @@ -112,7 +112,7 @@ async def test_flow_friends_invalid_username( result["flow_id"], user_input=CONF_USER_DATA, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "friends" with patch( @@ -124,7 +124,7 @@ async def test_flow_friends_invalid_username( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=CONF_FRIENDS_DATA ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "friends" assert result["errors"]["base"] == "invalid_account" @@ -132,7 +132,7 @@ async def test_flow_friends_invalid_username( result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=CONF_FRIENDS_DATA ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == DEFAULT_NAME assert result["options"] == CONF_DATA @@ -153,7 +153,7 @@ async def test_flow_friends_no_friends( result["flow_id"], user_input=CONF_USER_DATA, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "friends" assert len(result["data_schema"].schema[CONF_USERS].config["options"]) == 0 @@ -171,7 +171,7 @@ async def test_options_flow( 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( @@ -180,7 +180,7 @@ async def test_options_flow( ) 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_API_KEY: API_KEY, CONF_MAIN_USER: USERNAME_1, @@ -201,7 +201,7 @@ async def test_options_flow_incorrect_username( 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" with patch( @@ -216,7 +216,7 @@ async def test_options_flow_incorrect_username( ) 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" assert result["errors"]["base"] == "invalid_account" @@ -227,7 +227,7 @@ async def test_options_flow_incorrect_username( ) 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_API_KEY: API_KEY, CONF_MAIN_USER: USERNAME_1, @@ -248,7 +248,7 @@ async def test_options_flow_from_import( 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" assert len(result["data_schema"].schema[CONF_USERS].config["options"]) == 0 @@ -266,6 +266,6 @@ async def test_options_flow_without_friends( 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" assert len(result["data_schema"].schema[CONF_USERS].config["options"]) == 0 diff --git a/tests/components/launch_library/test_config_flow.py b/tests/components/launch_library/test_config_flow.py index 80a634318b9..d3cee3b54e3 100644 --- a/tests/components/launch_library/test_config_flow.py +++ b/tests/components/launch_library/test_config_flow.py @@ -2,10 +2,10 @@ from unittest.mock import patch -from homeassistant import data_entry_flow from homeassistant.components.launch_library.const import DOMAIN from homeassistant.config_entries import SOURCE_USER from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -17,7 +17,7 @@ async def test_create_entry(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER} ) - assert result.get("type") == data_entry_flow.FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "user" with patch( @@ -28,7 +28,7 @@ async def test_create_entry(hass: HomeAssistant) -> None: {}, ) - assert result.get("type") == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result.get("type") is FlowResultType.CREATE_ENTRY assert result.get("result").data == {} @@ -44,5 +44,5 @@ async def test_integration_already_exists(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER}, data={} ) - assert result.get("type") == data_entry_flow.FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "single_instance_allowed" diff --git a/tests/components/laundrify/test_config_flow.py b/tests/components/laundrify/test_config_flow.py index 2583e8a5639..69a4b957cf5 100644 --- a/tests/components/laundrify/test_config_flow.py +++ b/tests/components/laundrify/test_config_flow.py @@ -17,7 +17,7 @@ async def test_form(hass: HomeAssistant, laundrify_setup_entry) -> 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"] is None result = await hass.config_entries.flow.async_configure( @@ -26,7 +26,7 @@ async def test_form(hass: HomeAssistant, laundrify_setup_entry) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == DOMAIN assert result["data"] == { CONF_ACCESS_TOKEN: VALID_ACCESS_TOKEN, @@ -46,7 +46,7 @@ async def test_form_invalid_format( data={CONF_CODE: "invalidFormat"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {CONF_CODE: "invalid_format"} @@ -59,7 +59,7 @@ async def test_form_invalid_auth(hass: HomeAssistant, laundrify_exchange_code) - data=VALID_USER_INPUT, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {CONF_CODE: "invalid_auth"} @@ -74,7 +74,7 @@ async def test_form_cannot_connect( data=VALID_USER_INPUT, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} @@ -89,7 +89,7 @@ async def test_form_unkown_exception( data=VALID_USER_INPUT, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "unknown"} @@ -99,7 +99,7 @@ async def test_step_reauth(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_REAUTH} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None result = await hass.config_entries.flow.async_configure( @@ -108,7 +108,7 @@ async def test_step_reauth(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM async def test_integration_already_exists(hass: HomeAssistant) -> None: @@ -125,5 +125,5 @@ async def test_integration_already_exists(hass: HomeAssistant) -> None: }, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/lcn/test_config_flow.py b/tests/components/lcn/test_config_flow.py index aa1b5086e65..e1705e4b349 100644 --- a/tests/components/lcn/test_config_flow.py +++ b/tests/components/lcn/test_config_flow.py @@ -5,7 +5,7 @@ from unittest.mock import patch from pypck.connection import PchkAuthenticationError, PchkLicenseError import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.lcn.const import CONF_DIM_MODE, CONF_SK_NUM_TRIES, DOMAIN from homeassistant.const import ( CONF_DEVICES, @@ -17,6 +17,7 @@ from homeassistant.const import ( CONF_USERNAME, ) from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -47,7 +48,7 @@ async def test_step_import(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"] == "pchk" assert result["data"] == IMPORT_DATA @@ -69,7 +70,7 @@ async def test_step_import_existing_host(hass: HomeAssistant) -> None: await hass.async_block_till_done() # Check if config entry was updated - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "existing_configuration_updated" assert mock_entry.source == config_entries.SOURCE_IMPORT assert mock_entry.data == IMPORT_DATA @@ -95,5 +96,5 @@ async def test_step_import_error(hass: HomeAssistant, error, reason) -> None: ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == reason diff --git a/tests/components/ld2410_ble/test_config_flow.py b/tests/components/ld2410_ble/test_config_flow.py index 74e7e8a2c8e..78db43b3a23 100644 --- a/tests/components/ld2410_ble/test_config_flow.py +++ b/tests/components/ld2410_ble/test_config_flow.py @@ -24,7 +24,7 @@ async def test_user_step_success(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -45,7 +45,7 @@ async def test_user_step_success(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == LD2410_BLE_DISCOVERY_INFO.name assert result2["data"] == { CONF_ADDRESS: LD2410_BLE_DISCOVERY_INFO.address, @@ -63,7 +63,7 @@ async def test_user_step_no_devices_found(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -84,7 +84,7 @@ async def test_user_step_no_new_devices_found(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -97,7 +97,7 @@ async def test_user_step_cannot_connect(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"] == {} @@ -113,7 +113,7 @@ async def test_user_step_cannot_connect(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "user" assert result2["errors"] == {"base": "cannot_connect"} @@ -134,7 +134,7 @@ async def test_user_step_cannot_connect(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"] == LD2410_BLE_DISCOVERY_INFO.name assert result3["data"] == { CONF_ADDRESS: LD2410_BLE_DISCOVERY_INFO.address, @@ -152,7 +152,7 @@ async def test_user_step_unknown_exception(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -168,7 +168,7 @@ async def test_user_step_unknown_exception(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "user" assert result2["errors"] == {"base": "unknown"} @@ -189,7 +189,7 @@ async def test_user_step_unknown_exception(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == LD2410_BLE_DISCOVERY_INFO.name assert result3["data"] == { CONF_ADDRESS: LD2410_BLE_DISCOVERY_INFO.address, @@ -205,7 +205,7 @@ async def test_bluetooth_step_success(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=LD2410_BLE_DISCOVERY_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -226,7 +226,7 @@ async def test_bluetooth_step_success(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == LD2410_BLE_DISCOVERY_INFO.name assert result2["data"] == { CONF_ADDRESS: LD2410_BLE_DISCOVERY_INFO.address, diff --git a/tests/components/leaone/test_config_flow.py b/tests/components/leaone/test_config_flow.py index edacc3975c4..9712fce9c14 100644 --- a/tests/components/leaone/test_config_flow.py +++ b/tests/components/leaone/test_config_flow.py @@ -18,7 +18,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" @@ -32,14 +32,14 @@ async def test_async_step_user_with_found_devices(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with patch("homeassistant.components.leaone.async_setup_entry", return_value=True): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={"address": "5F:5A:5C:52:D3:94"}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "TZC4 D394" assert result2["data"] == {} assert result2["result"].unique_id == "5F:5A:5C:52:D3:94" @@ -55,7 +55,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( @@ -69,7 +69,7 @@ async def test_async_step_user_device_added_between_steps(hass: HomeAssistant) - result["flow_id"], user_input={"address": "5F:5A:5C:52:D3:94"}, ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" @@ -91,5 +91,5 @@ 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" diff --git a/tests/components/led_ble/test_config_flow.py b/tests/components/led_ble/test_config_flow.py index 5ceda954ba8..c22c62e2fb1 100644 --- a/tests/components/led_ble/test_config_flow.py +++ b/tests/components/led_ble/test_config_flow.py @@ -28,7 +28,7 @@ async def test_user_step_success(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -49,7 +49,7 @@ async def test_user_step_success(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == LED_BLE_DISCOVERY_INFO.name assert result2["data"] == { CONF_ADDRESS: LED_BLE_DISCOVERY_INFO.address, @@ -67,7 +67,7 @@ async def test_user_step_no_devices_found(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -88,7 +88,7 @@ async def test_user_step_no_new_devices_found(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -101,7 +101,7 @@ async def test_user_step_cannot_connect(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"] == {} @@ -117,7 +117,7 @@ async def test_user_step_cannot_connect(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "user" assert result2["errors"] == {"base": "cannot_connect"} @@ -138,7 +138,7 @@ async def test_user_step_cannot_connect(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"] == LED_BLE_DISCOVERY_INFO.name assert result3["data"] == { CONF_ADDRESS: LED_BLE_DISCOVERY_INFO.address, @@ -156,7 +156,7 @@ async def test_user_step_unknown_exception(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -172,7 +172,7 @@ async def test_user_step_unknown_exception(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "user" assert result2["errors"] == {"base": "unknown"} @@ -193,7 +193,7 @@ async def test_user_step_unknown_exception(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == LED_BLE_DISCOVERY_INFO.name assert result3["data"] == { CONF_ADDRESS: LED_BLE_DISCOVERY_INFO.address, @@ -209,7 +209,7 @@ async def test_bluetooth_step_success(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=LED_BLE_DISCOVERY_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -230,7 +230,7 @@ async def test_bluetooth_step_success(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == LED_BLE_DISCOVERY_INFO.name assert result2["data"] == { CONF_ADDRESS: LED_BLE_DISCOVERY_INFO.address, @@ -246,5 +246,5 @@ async def test_bluetooth_unsupported_model(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=UNSUPPORTED_LED_BLE_DISCOVERY_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_supported" diff --git a/tests/components/lidarr/test_config_flow.py b/tests/components/lidarr/test_config_flow.py index 01fa05ebb18..e44b03cd2a2 100644 --- a/tests/components/lidarr/test_config_flow.py +++ b/tests/components/lidarr/test_config_flow.py @@ -16,14 +16,14 @@ async def test_flow_user_form(hass: HomeAssistant, connection) -> None: context={CONF_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_INPUT, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == DEFAULT_NAME assert result["data"] == CONF_DATA @@ -35,7 +35,7 @@ async def test_flow_user_invalid_auth(hass: HomeAssistant, invalid_auth) -> None 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"] == "invalid_auth" @@ -48,7 +48,7 @@ async def test_flow_user_cannot_connect(hass: HomeAssistant, cannot_connect) -> 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" @@ -61,7 +61,7 @@ async def test_wrong_app(hass: HomeAssistant, wrong_app) -> None: data=MOCK_INPUT, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"]["base"] == "wrong_app" @@ -74,7 +74,7 @@ async def test_zeroconf_failed(hass: HomeAssistant, zeroconf_failed) -> None: data=MOCK_INPUT, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"]["base"] == "zeroconf_failed" @@ -89,7 +89,7 @@ async def test_flow_user_unknown_error(hass: HomeAssistant, unknown) -> None: result["flow_id"], user_input=CONF_DATA, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"]["base"] == "unknown" @@ -109,18 +109,18 @@ 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" 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" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_API_KEY: "abc123"}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert entry.data[CONF_API_KEY] == "abc123" diff --git a/tests/components/lifx/test_config_flow.py b/tests/components/lifx/test_config_flow.py index 0a0c26da424..67fcc1b7dfa 100644 --- a/tests/components/lifx/test_config_flow.py +++ b/tests/components/lifx/test_config_flow.py @@ -353,7 +353,7 @@ async def test_discovered_by_discovery_and_dhcp(hass: HomeAssistant) -> None: data={CONF_HOST: IP_ADDRESS, CONF_SERIAL: SERIAL}, ) 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_config_flow_try_connect(): @@ -365,7 +365,7 @@ async def test_discovered_by_discovery_and_dhcp(hass: HomeAssistant) -> None: ), ) 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_config_flow_try_connect(): @@ -377,7 +377,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" with ( @@ -392,7 +392,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" @@ -434,7 +434,7 @@ async def test_discovered_by_dhcp_or_discovery( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None with ( @@ -496,7 +496,7 @@ async def test_discovered_by_dhcp_or_discovery_failed_to_get_device( DOMAIN, context={"source": source}, data=data ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -538,7 +538,7 @@ async def test_discovered_by_dhcp_or_homekit_updates_ip( data=data, ) 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.data[CONF_HOST] == IP_ADDRESS diff --git a/tests/components/linear_garage_door/test_config_flow.py b/tests/components/linear_garage_door/test_config_flow.py index 1851b61fc15..9704268e650 100644 --- a/tests/components/linear_garage_door/test_config_flow.py +++ b/tests/components/linear_garage_door/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 with ( @@ -56,7 +56,7 @@ async def test_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"] == { "email": "test-email", @@ -86,7 +86,7 @@ async def test_reauth(hass: HomeAssistant) -> None: }, data=entry.data, ) - assert result1["type"] == FlowResultType.FORM + assert result1["type"] is FlowResultType.FORM assert result1["step_id"] == "user" with ( @@ -116,7 +116,7 @@ async def test_reauth(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" entries = hass.config_entries.async_entries() @@ -153,7 +153,7 @@ async def test_form_invalid_login(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "invalid_auth"} @@ -176,5 +176,5 @@ async def test_form_exception(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} diff --git a/tests/components/litejet/test_config_flow.py b/tests/components/litejet/test_config_flow.py index b92aa59c9ce..4803fd393d8 100644 --- a/tests/components/litejet/test_config_flow.py +++ b/tests/components/litejet/test_config_flow.py @@ -4,10 +4,11 @@ from unittest.mock import patch from serial import SerialException -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.litejet.const import CONF_DEFAULT_TRANSITION, DOMAIN from homeassistant.const import CONF_PORT from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -75,7 +76,7 @@ async def test_options(hass: HomeAssistant) -> None: result = await hass.config_entries.options.async_init(entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -83,5 +84,5 @@ async def test_options(hass: HomeAssistant) -> None: user_input={CONF_DEFAULT_TRANSITION: 12}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == {CONF_DEFAULT_TRANSITION: 12} diff --git a/tests/components/litterrobot/test_config_flow.py b/tests/components/litterrobot/test_config_flow.py index d516a3f14a2..b8739a73fb8 100644 --- a/tests/components/litterrobot/test_config_flow.py +++ b/tests/components/litterrobot/test_config_flow.py @@ -134,7 +134,7 @@ async def test_step_reauth(hass: HomeAssistant, mock_account: Account) -> None: data=entry.data, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" with ( @@ -151,7 +151,7 @@ async def test_step_reauth(hass: HomeAssistant, mock_account: Account) -> None: result["flow_id"], user_input={CONF_PASSWORD: CONFIG[litterrobot.DOMAIN][CONF_PASSWORD]}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert len(mock_setup_entry.mock_calls) == 1 @@ -174,7 +174,7 @@ async def test_step_reauth_failed(hass: HomeAssistant, mock_account: Account) -> data=entry.data, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" with patch( @@ -186,7 +186,7 @@ async def test_step_reauth_failed(hass: HomeAssistant, mock_account: Account) -> user_input={CONF_PASSWORD: CONFIG[litterrobot.DOMAIN][CONF_PASSWORD]}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "invalid_auth"} with ( @@ -203,6 +203,6 @@ async def test_step_reauth_failed(hass: HomeAssistant, mock_account: Account) -> result["flow_id"], user_input={CONF_PASSWORD: CONFIG[litterrobot.DOMAIN][CONF_PASSWORD]}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/livisi/test_config_flow.py b/tests/components/livisi/test_config_flow.py index 7f4f8568030..9f492b9a45a 100644 --- a/tests/components/livisi/test_config_flow.py +++ b/tests/components/livisi/test_config_flow.py @@ -5,10 +5,10 @@ from unittest.mock import patch from aiolivisi import errors as livisi_errors import pytest -from homeassistant import data_entry_flow from homeassistant.components.livisi.const import DOMAIN from homeassistant.config_entries import SOURCE_USER from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from . import ( VALID_CONFIG, @@ -30,7 +30,7 @@ async def test_create_entry(hass: HomeAssistant) -> None: VALID_CONFIG, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "SHC Classic" assert result["data"]["host"] == "1.1.1.1" assert result["data"]["password"] == "test" @@ -59,11 +59,11 @@ async def test_create_entity_after_login_error( result = await hass.config_entries.flow.async_configure( result["flow_id"], VALID_CONFIG ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"]["base"] == expected_reason with mocked_livisi_login(), mocked_livisi_controller(), mocked_livisi_setup_entry(): result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=VALID_CONFIG, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY diff --git a/tests/components/local_calendar/test_config_flow.py b/tests/components/local_calendar/test_config_flow.py index 89ea9d21ff5..c76fd9e283d 100644 --- a/tests/components/local_calendar/test_config_flow.py +++ b/tests/components/local_calendar/test_config_flow.py @@ -19,7 +19,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( @@ -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"] == "My Calendar" assert result2["data"] == { CONF_CALENDAR_NAME: "My Calendar", @@ -51,7 +51,7 @@ async def test_duplicate_name( 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.get("errors") result2 = await hass.config_entries.flow.async_configure( @@ -63,5 +63,5 @@ async def test_duplicate_name( ) 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/local_ip/test_config_flow.py b/tests/components/local_ip/test_config_flow.py index 82fcbf6d6e6..554163bbc1c 100644 --- a/tests/components/local_ip/test_config_flow.py +++ b/tests/components/local_ip/test_config_flow.py @@ -2,10 +2,10 @@ from __future__ import annotations -from homeassistant import data_entry_flow from homeassistant.components.local_ip.const import DOMAIN from homeassistant.config_entries import SOURCE_USER from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -15,10 +15,10 @@ async def test_config_flow(hass: HomeAssistant, mock_get_source_ip) -> 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 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() state = hass.states.get(f"sensor.{DOMAIN}") @@ -36,5 +36,5 @@ async def test_already_setup(hass: HomeAssistant, mock_get_source_ip) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - 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/local_todo/test_config_flow.py b/tests/components/local_todo/test_config_flow.py index 381c97be167..b399753d286 100644 --- a/tests/components/local_todo/test_config_flow.py +++ b/tests/components/local_todo/test_config_flow.py @@ -21,7 +21,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 not result.get("errors") result2 = await hass.config_entries.flow.async_configure( @@ -32,7 +32,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == TODO_NAME assert result2["data"] == { "todo_list_name": TODO_NAME, @@ -49,7 +49,7 @@ async def test_duplicate_todo_list_name( 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.get("errors") result2 = await hass.config_entries.flow.async_configure( @@ -61,5 +61,5 @@ async def test_duplicate_todo_list_name( ) 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/logi_circle/test_config_flow.py b/tests/components/logi_circle/test_config_flow.py index f0de828c186..2525354598d 100644 --- a/tests/components/logi_circle/test_config_flow.py +++ b/tests/components/logi_circle/test_config_flow.py @@ -6,7 +6,7 @@ from unittest.mock import AsyncMock, Mock, patch import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.http import KEY_HASS from homeassistant.components.logi_circle import config_flow from homeassistant.components.logi_circle.config_flow import ( @@ -15,6 +15,7 @@ from homeassistant.components.logi_circle.config_flow import ( LogiCircleAuthCallbackView, ) from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import AbortFlow, FlowResultType from homeassistant.setup import async_setup_component from tests.common import MockConfigEntry @@ -67,7 +68,7 @@ async def test_step_import(hass: HomeAssistant, mock_logi_circle) -> 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" @@ -85,18 +86,18 @@ async def test_full_flow_implementation(hass: HomeAssistant, mock_logi_circle) - 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-other"}) - 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": "http://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["title"] == "Logi Circle ({})".format("testId") @@ -114,7 +115,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"] == "missing_configuration" @@ -127,21 +128,21 @@ async def test_abort_if_already_setup(hass: HomeAssistant) -> None: config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" result = await hass.config_entries.flow.async_init( config_flow.DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" - with pytest.raises(data_entry_flow.AbortFlow): + with pytest.raises(AbortFlow): result = await flow.async_step_code() result = await flow.async_step_auth() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "external_setup" @@ -160,7 +161,7 @@ async def test_abort_if_authorize_fails( mock_logi_circle.authorize.side_effect = side_effect result = await flow.async_step_code("123ABC") - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "external_error" result = await flow.async_step_auth() @@ -172,7 +173,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" diff --git a/tests/components/lookin/test_config_flow.py b/tests/components/lookin/test_config_flow.py index 18cbe33db3a..e3896b9c3d4 100644 --- a/tests/components/lookin/test_config_flow.py +++ b/tests/components/lookin/test_config_flow.py @@ -44,7 +44,7 @@ async def test_manual_setup(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == {CONF_HOST: IP_ADDRESS} assert result["title"] == DEFAULT_ENTRY_TITLE assert len(mock_setup_entry.mock_calls) == 1 @@ -69,7 +69,7 @@ async def test_manual_setup_already_exists(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -122,7 +122,7 @@ async def test_discovered_zeroconf(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 ( @@ -134,7 +134,7 @@ async def test_discovered_zeroconf(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"] == {CONF_HOST: IP_ADDRESS} assert result2["title"] == DEFAULT_ENTRY_TITLE assert mock_async_setup_entry.called @@ -156,7 +156,7 @@ async def test_discovered_zeroconf(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_HOST] == "127.0.0.2" @@ -172,7 +172,7 @@ async def test_discovered_zeroconf_cannot_connect(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" @@ -187,5 +187,5 @@ async def test_discovered_zeroconf_unknown_exception(hass: HomeAssistant) -> Non ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "unknown" diff --git a/tests/components/loqed/test_config_flow.py b/tests/components/loqed/test_config_flow.py index ed18f0ae40e..d59ed60796b 100644 --- a/tests/components/loqed/test_config_flow.py +++ b/tests/components/loqed/test_config_flow.py @@ -42,7 +42,7 @@ async def test_create_entry_zeroconf(hass: HomeAssistant) -> None: data=zeroconf_data, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None mock_lock = Mock(spec=loqed.Lock, id="Foo") @@ -76,7 +76,7 @@ async def test_create_entry_zeroconf(hass: HomeAssistant) -> None: await hass.async_block_till_done() found_lock = all_locks_response["data"][0] - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "LOQED Touch Smart Lock" assert result2["data"] == { "id": "Foo", @@ -101,7 +101,7 @@ async def test_create_entry_user( context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None lock_result = json.loads(load_fixture("loqed/status_ok.json")) @@ -137,7 +137,7 @@ async def test_create_entry_user( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "LOQED Touch Smart Lock" assert result2["data"] == { "id": "Foo", @@ -162,7 +162,7 @@ async def test_cannot_connect( context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None with patch( @@ -175,7 +175,7 @@ async def test_cannot_connect( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -188,7 +188,7 @@ async def test_invalid_auth_when_lock_not_found( context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None all_locks_response = json.loads(load_fixture("loqed/get_all_locks.json")) @@ -203,7 +203,7 @@ async def test_invalid_auth_when_lock_not_found( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "invalid_auth"} @@ -216,7 +216,7 @@ async def test_cannot_connect_when_lock_not_reachable( context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None all_locks_response = json.loads(load_fixture("loqed/get_all_locks.json")) @@ -236,5 +236,5 @@ async def test_cannot_connect_when_lock_not_reachable( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} diff --git a/tests/components/luftdaten/test_config_flow.py b/tests/components/luftdaten/test_config_flow.py index 7469fe6e486..ea9b6211823 100644 --- a/tests/components/luftdaten/test_config_flow.py +++ b/tests/components/luftdaten/test_config_flow.py @@ -25,7 +25,7 @@ async def test_duplicate_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" result2 = await hass.config_entries.flow.async_configure( @@ -33,7 +33,7 @@ async def test_duplicate_error( user_input={CONF_SENSOR_ID: 12345}, ) - assert result2.get("type") == FlowResultType.ABORT + assert result2.get("type") is FlowResultType.ABORT assert result2.get("reason") == "already_configured" @@ -45,7 +45,7 @@ async def test_communication_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_luftdaten.get_data.side_effect = LuftdatenConnectionError @@ -54,7 +54,7 @@ async def test_communication_error( user_input={CONF_SENSOR_ID: 12345}, ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "user" assert result2.get("errors") == {CONF_SENSOR_ID: "cannot_connect"} @@ -64,7 +64,7 @@ async def test_communication_error( user_input={CONF_SENSOR_ID: 12345}, ) - 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_SENSOR_ID: 12345, @@ -78,7 +78,7 @@ async def test_invalid_sensor(hass: HomeAssistant, mock_luftdaten: MagicMock) -> 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_luftdaten.validate_sensor.return_value = False @@ -87,7 +87,7 @@ async def test_invalid_sensor(hass: HomeAssistant, mock_luftdaten: MagicMock) -> user_input={CONF_SENSOR_ID: 11111}, ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "user" assert result2.get("errors") == {CONF_SENSOR_ID: "invalid_sensor"} @@ -97,7 +97,7 @@ async def test_invalid_sensor(hass: HomeAssistant, mock_luftdaten: MagicMock) -> user_input={CONF_SENSOR_ID: 12345}, ) - 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_SENSOR_ID: 12345, @@ -114,7 +114,7 @@ async def test_step_user( 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( @@ -125,7 +125,7 @@ async def test_step_user( }, ) - 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_SENSOR_ID: 12345, diff --git a/tests/components/lupusec/test_config_flow.py b/tests/components/lupusec/test_config_flow.py index 2ca313139dc..e106bbd5001 100644 --- a/tests/components/lupusec/test_config_flow.py +++ b/tests/components/lupusec/test_config_flow.py @@ -45,7 +45,7 @@ async def test_form_valid_input(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_valid_input(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"] == MOCK_DATA_STEP[CONF_HOST] assert result2["data"] == MOCK_DATA_STEP assert len(mock_setup_entry.mock_calls) == 1 @@ -85,7 +85,7 @@ async def test_flow_user_init_data_error_and_recover( 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( @@ -98,7 +98,7 @@ async def test_flow_user_init_data_error_and_recover( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": text_error} assert len(mock_initialize_lupusec.mock_calls) == 1 @@ -120,7 +120,7 @@ async def test_flow_user_init_data_error_and_recover( await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == MOCK_DATA_STEP[CONF_HOST] assert result3["data"] == MOCK_DATA_STEP assert len(mock_setup_entry.mock_calls) == 1 @@ -141,7 +141,7 @@ async def test_flow_user_init_data_already_configured(hass: HomeAssistant) -> No result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} result2 = await hass.config_entries.flow.async_configure( @@ -151,7 +151,7 @@ async def test_flow_user_init_data_already_configured(hass: HomeAssistant) -> No await hass.async_block_till_done() - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" @@ -183,7 +183,7 @@ async def test_flow_source_import( await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == mock_title assert result["data"] == MOCK_DATA_STEP assert len(mock_setup_entry.mock_calls) == 1 @@ -214,7 +214,7 @@ async def test_flow_source_import_error_and_recover( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == text_error assert len(mock_initialize_lupusec.mock_calls) == 1 @@ -236,5 +236,5 @@ async def test_flow_source_import_already_configured(hass: HomeAssistant) -> Non data=MOCK_IMPORT_STEP, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/lutron/test_config_flow.py b/tests/components/lutron/test_config_flow.py index db3faa7f911..e4904838e1a 100644 --- a/tests/components/lutron/test_config_flow.py +++ b/tests/components/lutron/test_config_flow.py @@ -27,7 +27,7 @@ async def test_full_flow(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> No DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with ( @@ -39,7 +39,7 @@ async def test_full_flow(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> No user_input=MOCK_DATA_STEP, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["result"].title == "Lutron" assert result["data"] == MOCK_DATA_STEP @@ -63,7 +63,7 @@ async def test_flow_failure( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with patch( @@ -75,7 +75,7 @@ async def test_flow_failure( user_input=MOCK_DATA_STEP, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": text_error} with ( @@ -87,7 +87,7 @@ async def test_flow_failure( user_input=MOCK_DATA_STEP, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["result"].title == "Lutron" assert result["data"] == MOCK_DATA_STEP @@ -101,7 +101,7 @@ async def test_flow_incorrect_guid( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with ( @@ -113,7 +113,7 @@ async def test_flow_incorrect_guid( user_input=MOCK_DATA_STEP, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} with ( @@ -125,7 +125,7 @@ async def test_flow_incorrect_guid( user_input=MOCK_DATA_STEP, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY async def test_flow_single_instance_allowed(hass: HomeAssistant) -> None: @@ -137,7 +137,7 @@ async def test_flow_single_instance_allowed(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"] == "single_instance_allowed" @@ -162,7 +162,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 @@ -187,7 +187,7 @@ async def test_import_flow_failure( DOMAIN, context={"source": SOURCE_IMPORT}, data=MOCK_DATA_IMPORT ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == reason @@ -202,7 +202,7 @@ async def test_import_flow_guid_failure(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_IMPORT}, data=MOCK_DATA_IMPORT ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -218,5 +218,5 @@ async def test_import_already_configured(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_IMPORT}, data=MOCK_DATA_IMPORT ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" diff --git a/tests/components/lutron_caseta/test_config_flow.py b/tests/components/lutron_caseta/test_config_flow.py index 15a4fca7d33..fd529353b98 100644 --- a/tests/components/lutron_caseta/test_config_flow.py +++ b/tests/components/lutron_caseta/test_config_flow.py @@ -9,7 +9,7 @@ from pylutron_caseta.pairing import PAIR_CA, PAIR_CERT, PAIR_KEY from pylutron_caseta.smartbridge import Smartbridge import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components import zeroconf from homeassistant.components.lutron_caseta import DOMAIN import homeassistant.components.lutron_caseta.config_flow as CasetaConfigFlow @@ -22,6 +22,7 @@ from homeassistant.components.lutron_caseta.const import ( ) from homeassistant.const import CONF_HOST from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from . import ENTRY_MOCK_DATA, MockBridge @@ -107,7 +108,7 @@ async def test_bridge_cannot_connect(hass: HomeAssistant) -> None: 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"] == CasetaConfigFlow.ABORT_REASON_CANNOT_CONNECT @@ -130,7 +131,7 @@ async def test_bridge_cannot_connect_unknown_error(hass: HomeAssistant) -> None: 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"] == CasetaConfigFlow.ABORT_REASON_CANNOT_CONNECT @@ -150,7 +151,7 @@ async def test_bridge_invalid_ssl_error(hass: HomeAssistant) -> None: 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"] == CasetaConfigFlow.ABORT_REASON_CANNOT_CONNECT @@ -171,7 +172,7 @@ async def test_duplicate_bridge_import(hass: HomeAssistant) -> None: data=ENTRY_MOCK_DATA, ) - assert result["type"] == data_entry_flow.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/lyric/test_config_flow.py b/tests/components/lyric/test_config_flow.py index 00d623ea3ce..d53b0d57613 100644 --- a/tests/components/lyric/test_config_flow.py +++ b/tests/components/lyric/test_config_flow.py @@ -5,13 +5,14 @@ from unittest.mock import patch import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.application_credentials import ( ClientCredential, async_import_client_credential, ) from homeassistant.components.lyric.const import DOMAIN, OAUTH2_AUTHORIZE, OAUTH2_TOKEN 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 @@ -39,7 +40,7 @@ async def test_abort_if_no_configuration(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"] == "missing_credentials" @@ -62,7 +63,7 @@ async def test_full_flow( }, ) - assert result["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP assert result["url"] == ( f"{OAUTH2_AUTHORIZE}?response_type=code&client_id={CLIENT_ID}" "&redirect_uri=https://example.com/auth/external/callback" @@ -163,7 +164,7 @@ async def test_reauthentication_flow( ): 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_successful" assert len(mock_setup.mock_calls) == 1 diff --git a/tests/components/matter/test_config_flow.py b/tests/components/matter/test_config_flow.py index 283642c8964..33e94a743f7 100644 --- a/tests/components/matter/test_config_flow.py +++ b/tests/components/matter/test_config_flow.py @@ -89,7 +89,7 @@ async def test_manual_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"] is None result = await hass.config_entries.flow.async_configure( @@ -101,7 +101,7 @@ async def test_manual_create_entry( await hass.async_block_till_done() assert client_connect.call_count == 1 - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Matter" assert result["data"] == { "url": "ws://localhost:5580/ws", @@ -139,7 +139,7 @@ async def test_manual_errors( ) assert client_connect.call_count == 1 - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": error} @@ -158,7 +158,7 @@ async def test_manual_already_configured( 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( @@ -170,7 +170,7 @@ async def test_manual_already_configured( await hass.async_block_till_done() assert client_connect.call_count == 1 - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reconfiguration_successful" assert entry.data["url"] == "ws://localhost:5580/ws" assert entry.data["use_addon"] is False @@ -198,7 +198,7 @@ async def test_zeroconf_discovery( properties={"SII": "3300", "SAI": "1100", "T": "0"}, ), ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "manual" assert result["errors"] is None @@ -211,7 +211,7 @@ async def test_zeroconf_discovery( await hass.async_block_till_done() assert client_connect.call_count == 1 - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Matter" assert result["data"] == { "url": "ws://localhost:5580/ws", @@ -247,7 +247,7 @@ async def test_supervisor_discovery( assert addon_info.call_count == 1 assert client_connect.call_count == 0 - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Matter" assert result["data"] == { "url": "ws://host1:5581/ws", @@ -282,13 +282,13 @@ async def test_supervisor_discovery_addon_info_failed( ), ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "hassio_confirm" result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) assert addon_info.call_count == 1 - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "addon_info_failed" @@ -313,14 +313,14 @@ async def test_clean_supervisor_discovery_on_user_create( ), ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "hassio_confirm" 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"] == "on_supervisor" result = await hass.config_entries.flow.async_configure( @@ -328,7 +328,7 @@ async def test_clean_supervisor_discovery_on_user_create( ) assert addon_info.call_count == 0 - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "manual" result = await hass.config_entries.flow.async_configure( @@ -341,7 +341,7 @@ async def test_clean_supervisor_discovery_on_user_create( assert len(hass.config_entries.flow.async_progress()) == 0 assert client_connect.call_count == 1 - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Matter" assert result["data"] == { "url": "ws://localhost:5580/ws", @@ -377,7 +377,7 @@ async def test_abort_supervisor_discovery_with_existing_entry( ) assert addon_info.call_count == 0 - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -392,7 +392,7 @@ async def test_abort_supervisor_discovery_with_existing_flow( DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "on_supervisor" result = await hass.config_entries.flow.async_init( @@ -407,7 +407,7 @@ async def test_abort_supervisor_discovery_with_existing_flow( ) assert addon_info.call_count == 0 - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_in_progress" @@ -434,7 +434,7 @@ async def test_abort_supervisor_discovery_for_other_addon( ) assert addon_info.call_count == 0 - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_matter_addon" @@ -461,12 +461,12 @@ async def test_supervisor_discovery_addon_not_running( assert addon_info.call_count == 0 assert result["step_id"] == "hassio_confirm" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) assert addon_info.call_count == 1 - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["step_id"] == "start_addon" await hass.async_block_till_done() @@ -475,7 +475,7 @@ async def test_supervisor_discovery_addon_not_running( assert start_addon.call_args == call(hass, "core_matter_server") assert client_connect.call_count == 1 - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Matter" assert result["data"] == { "url": "ws://host1:5581/ws", @@ -511,20 +511,20 @@ async def test_supervisor_discovery_addon_not_installed( assert addon_info.call_count == 0 assert addon_store_info.call_count == 0 assert result["step_id"] == "hassio_confirm" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) assert addon_info.call_count == 0 assert addon_store_info.call_count == 1 assert result["step_id"] == "install_addon" - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS await hass.async_block_till_done() result = await hass.config_entries.flow.async_configure(result["flow_id"]) assert install_addon.call_args == call(hass, "core_matter_server") - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["step_id"] == "start_addon" await hass.async_block_till_done() @@ -533,7 +533,7 @@ async def test_supervisor_discovery_addon_not_installed( assert start_addon.call_args == call(hass, "core_matter_server") assert client_connect.call_count == 1 - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Matter" assert result["data"] == { "url": "ws://host1:5581/ws", @@ -554,14 +554,14 @@ async def test_not_addon( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "on_supervisor" result = await hass.config_entries.flow.async_configure( result["flow_id"], {"use_addon": False} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "manual" result = await hass.config_entries.flow.async_configure( @@ -573,7 +573,7 @@ async def test_not_addon( await hass.async_block_till_done() assert client_connect.call_count == 1 - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Matter" assert result["data"] == { "url": "ws://localhost:5581/ws", @@ -597,7 +597,7 @@ async def test_addon_running( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "on_supervisor" result = await hass.config_entries.flow.async_configure( @@ -607,7 +607,7 @@ async def test_addon_running( assert addon_info.call_count == 1 assert client_connect.call_count == 1 - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Matter" assert result["data"] == { "url": "ws://host1:5581/ws", @@ -688,7 +688,7 @@ async def test_addon_running_failures( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "on_supervisor" result = await hass.config_entries.flow.async_configure( @@ -698,7 +698,7 @@ async def test_addon_running_failures( assert addon_info.call_count == 1 assert get_addon_discovery_info.called is discovery_info_called assert client_connect.called is client_connect_called - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == abort_reason @@ -724,7 +724,7 @@ async def test_addon_running_already_configured( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "on_supervisor" result = await hass.config_entries.flow.async_configure( @@ -733,7 +733,7 @@ async def test_addon_running_already_configured( await hass.async_block_till_done() assert addon_info.call_count == 1 - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reconfiguration_successful" assert entry.data["url"] == "ws://host1:5581/ws" assert entry.title == "Matter" @@ -754,7 +754,7 @@ async def test_addon_installed( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "on_supervisor" result = await hass.config_entries.flow.async_configure( @@ -762,7 +762,7 @@ async def test_addon_installed( ) assert addon_info.call_count == 1 - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["step_id"] == "start_addon" await hass.async_block_till_done() @@ -770,7 +770,7 @@ async def test_addon_installed( await hass.async_block_till_done() assert start_addon.call_args == call(hass, "core_matter_server") - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Matter" assert result["data"] == { "url": "ws://host1:5581/ws", @@ -833,7 +833,7 @@ async def test_addon_installed_failures( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "on_supervisor" result = await hass.config_entries.flow.async_configure( @@ -841,7 +841,7 @@ async def test_addon_installed_failures( ) assert addon_info.call_count == 1 - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["step_id"] == "start_addon" await hass.async_block_till_done() @@ -850,7 +850,7 @@ async def test_addon_installed_failures( assert start_addon.call_args == call(hass, "core_matter_server") assert get_addon_discovery_info.called is discovery_info_called assert client_connect.called is client_connect_called - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "addon_start_failed" @@ -877,7 +877,7 @@ async def test_addon_installed_already_configured( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "on_supervisor" result = await hass.config_entries.flow.async_configure( @@ -885,7 +885,7 @@ async def test_addon_installed_already_configured( ) assert addon_info.call_count == 1 - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["step_id"] == "start_addon" await hass.async_block_till_done() @@ -893,7 +893,7 @@ async def test_addon_installed_already_configured( await hass.async_block_till_done() assert start_addon.call_args == call(hass, "core_matter_server") - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reconfiguration_successful" assert entry.data["url"] == "ws://host1:5581/ws" assert entry.title == "Matter" @@ -916,7 +916,7 @@ async def test_addon_not_installed( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "on_supervisor" result = await hass.config_entries.flow.async_configure( @@ -925,7 +925,7 @@ async def test_addon_not_installed( assert addon_info.call_count == 0 assert addon_store_info.call_count == 1 - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["step_id"] == "install_addon" # Make sure the flow continues when the progress task is done. @@ -933,7 +933,7 @@ async def test_addon_not_installed( result = await hass.config_entries.flow.async_configure(result["flow_id"]) assert install_addon.call_args == call(hass, "core_matter_server") - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["step_id"] == "start_addon" await hass.async_block_till_done() @@ -941,7 +941,7 @@ async def test_addon_not_installed( await hass.async_block_till_done() assert start_addon.call_args == call(hass, "core_matter_server") - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Matter" assert result["data"] == { "url": "ws://host1:5581/ws", @@ -965,14 +965,14 @@ async def test_addon_not_installed_failures( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "on_supervisor" result = await hass.config_entries.flow.async_configure( result["flow_id"], {"use_addon": True} ) - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["step_id"] == "install_addon" # Make sure the flow continues when the progress task is done. @@ -981,7 +981,7 @@ async def test_addon_not_installed_failures( assert install_addon.call_args == call(hass, "core_matter_server") assert addon_info.call_count == 0 - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "addon_install_failed" @@ -1011,7 +1011,7 @@ async def test_addon_not_installed_already_configured( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "on_supervisor" result = await hass.config_entries.flow.async_configure( @@ -1020,7 +1020,7 @@ async def test_addon_not_installed_already_configured( assert addon_info.call_count == 0 assert addon_store_info.call_count == 1 - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["step_id"] == "install_addon" # Make sure the flow continues when the progress task is done. @@ -1028,7 +1028,7 @@ async def test_addon_not_installed_already_configured( result = await hass.config_entries.flow.async_configure(result["flow_id"]) assert install_addon.call_args == call(hass, "core_matter_server") - assert result["type"] == FlowResultType.SHOW_PROGRESS + assert result["type"] is FlowResultType.SHOW_PROGRESS assert result["step_id"] == "start_addon" await hass.async_block_till_done() @@ -1037,7 +1037,7 @@ async def test_addon_not_installed_already_configured( assert start_addon.call_args == call(hass, "core_matter_server") assert client_connect.call_count == 1 - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reconfiguration_successful" assert entry.data["url"] == "ws://host1:5581/ws" assert entry.title == "Matter" diff --git a/tests/components/meater/test_config_flow.py b/tests/components/meater/test_config_flow.py index 6d294259c01..b8c1be15268 100644 --- a/tests/components/meater/test_config_flow.py +++ b/tests/components/meater/test_config_flow.py @@ -5,10 +5,11 @@ from unittest.mock import AsyncMock, patch from meater import AuthenticationError, ServiceUnavailableError import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.meater 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 @@ -39,7 +40,7 @@ async def test_duplicate_error(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER}, data=conf ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -85,7 +86,7 @@ async def test_user_flow(hass: HomeAssistant, mock_meater) -> None: result = await hass.config_entries.flow.async_init( 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" with patch( @@ -95,7 +96,7 @@ async def test_user_flow(hass: HomeAssistant, mock_meater) -> None: result = await hass.config_entries.flow.async_configure(result["flow_id"], conf) 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: "user@host.com", CONF_PASSWORD: "password123", @@ -128,7 +129,7 @@ async def test_reauth_flow(hass: HomeAssistant, mock_meater) -> None: data=data, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["errors"] is None @@ -138,7 +139,7 @@ async def test_reauth_flow(hass: HomeAssistant, mock_meater) -> 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" config_entry = hass.config_entries.async_entries(DOMAIN)[0] diff --git a/tests/components/medcom_ble/test_config_flow.py b/tests/components/medcom_ble/test_config_flow.py index ca75dfd80ab..b470245978d 100644 --- a/tests/components/medcom_ble/test_config_flow.py +++ b/tests/components/medcom_ble/test_config_flow.py @@ -31,7 +31,7 @@ async def test_bluetooth_discovery(hass: HomeAssistant) -> None: data=MEDCOM_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" assert result["description_placeholders"] == {"name": "InspectorBLE-D9A0"} @@ -52,7 +52,7 @@ async def test_bluetooth_discovery(hass: HomeAssistant) -> None: result["flow_id"], user_input={"not": "empty"} ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "InspectorBLE-D9A0" assert result["result"].unique_id == "a0:d9:5a:57:0b:00" @@ -69,7 +69,7 @@ async def test_bluetooth_discovery_already_setup(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=MEDCOM_DEVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -82,7 +82,7 @@ async def test_user_setup(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"] is None assert result["data_schema"] is not None @@ -113,7 +113,7 @@ async def test_user_setup(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "InspectorBLE-D9A0" assert result["result"].unique_id == "a0:d9:5a:57:0b:00" @@ -127,7 +127,7 @@ async def test_user_setup_no_device(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -145,7 +145,7 @@ async def test_user_setup_existing_and_unknown_device(hass: HomeAssistant) -> No result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] is None assert result["data_schema"] is not None @@ -154,7 +154,7 @@ async def test_user_setup_existing_and_unknown_device(hass: HomeAssistant) -> No result["flow_id"], user_input={CONF_ADDRESS: "a0:d9:5a:57:0b:00"} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -167,7 +167,7 @@ async def test_user_setup_unknown_device(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -180,7 +180,7 @@ async def test_user_setup_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 result["step_id"] == "user" assert result["errors"] is None assert result["data_schema"] is not None @@ -193,7 +193,7 @@ async def test_user_setup_unknown_error(hass: HomeAssistant) -> None: result["flow_id"], user_input={CONF_ADDRESS: "a0:d9:5a:57:0b:00"} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "unknown" @@ -206,7 +206,7 @@ async def test_user_setup_unable_to_connect(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"] is None assert result["data_schema"] is not None @@ -224,5 +224,5 @@ async def test_user_setup_unable_to_connect(hass: HomeAssistant) -> None: result["flow_id"], user_input={CONF_ADDRESS: "a0:d9:5a:57:0b:00"} ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" diff --git a/tests/components/melcloud/test_config_flow.py b/tests/components/melcloud/test_config_flow.py index 0a21a8747e3..312daebd93f 100644 --- a/tests/components/melcloud/test_config_flow.py +++ b/tests/components/melcloud/test_config_flow.py @@ -174,7 +174,7 @@ async def test_token_reauthentication( }, data=mock_entry.data, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" with patch( @@ -187,7 +187,7 @@ async def test_token_reauthentication( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" assert len(mock_setup_entry.mock_calls) == 1 @@ -231,7 +231,7 @@ async def test_form_errors_reauthentication( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"]["base"] == reason mock_login.side_effect = None @@ -245,7 +245,7 @@ async def test_form_errors_reauthentication( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" @@ -290,7 +290,7 @@ async def test_client_errors_reauthentication( await hass.async_block_till_done() assert result["errors"]["base"] == reason - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM mock_login.side_effect = None with patch( @@ -303,5 +303,5 @@ async def test_client_errors_reauthentication( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" diff --git a/tests/components/melnor/test_config_flow.py b/tests/components/melnor/test_config_flow.py index ae4e7b84288..377954c22df 100644 --- a/tests/components/melnor/test_config_flow.py +++ b/tests/components/melnor/test_config_flow.py @@ -29,7 +29,7 @@ async def test_user_step_no_devices( context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" mock_setup_entry.assert_not_called() @@ -46,7 +46,7 @@ async def test_user_step_discovered_devices( context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "pick_device" with pytest.raises(vol.Invalid): @@ -58,7 +58,7 @@ async def test_user_step_discovered_devices( result["flow_id"], user_input={CONF_ADDRESS: FAKE_ADDRESS_1} ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["data"] == {CONF_ADDRESS: FAKE_ADDRESS_1} mock_setup_entry.assert_called_once() @@ -94,7 +94,7 @@ async def test_user_step_with_existing_device( 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( @@ -115,7 +115,7 @@ async def test_bluetooth_discovered( data=FAKE_SERVICE_INFO_1, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" assert result["description_placeholders"] == {"name": FAKE_ADDRESS_1} @@ -143,7 +143,7 @@ async def test_bluetooth_confirm( result["flow_id"], user_input={} ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == FAKE_ADDRESS_1 assert result2["data"] == {CONF_ADDRESS: FAKE_ADDRESS_1} diff --git a/tests/components/met_eireann/test_config_flow.py b/tests/components/met_eireann/test_config_flow.py index 8c5e7f43ced..2bb5c9ffe8f 100644 --- a/tests/components/met_eireann/test_config_flow.py +++ b/tests/components/met_eireann/test_config_flow.py @@ -4,10 +4,11 @@ from unittest.mock import patch import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.met_eireann.const import DOMAIN, HOME_LOCATION_NAME from homeassistant.const import CONF_ELEVATION, CONF_LATITUDE, CONF_LONGITUDE from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType @pytest.fixture(name="met_eireann_setup", autouse=True) @@ -66,7 +67,7 @@ async def test_create_entry(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER}, data=test_data ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == test_data.get("name") assert result["data"] == test_data @@ -87,11 +88,11 @@ async def test_flow_entry_already_exists(hass: HomeAssistant) -> None: result1 = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER}, data=test_data ) - assert result1["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result1["type"] is FlowResultType.CREATE_ENTRY # Create the second entry and assert that it is aborted result2 = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER}, data=test_data ) - assert result2["type"] == data_entry_flow.FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" diff --git a/tests/components/meteo_france/test_config_flow.py b/tests/components/meteo_france/test_config_flow.py index 4b9e26f883b..5e6f3b845e9 100644 --- a/tests/components/meteo_france/test_config_flow.py +++ b/tests/components/meteo_france/test_config_flow.py @@ -5,11 +5,11 @@ from unittest.mock import patch from meteofrance_api.model import Place import pytest -from homeassistant import data_entry_flow from homeassistant.components.meteo_france.const import CONF_CITY, DOMAIN from homeassistant.config_entries import SOURCE_USER from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -114,7 +114,7 @@ async def test_user(hass: HomeAssistant, client_single) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" # test with all provided with search returning only 1 place @@ -123,7 +123,7 @@ async def test_user(hass: HomeAssistant, client_single) -> None: context={"source": SOURCE_USER}, data={CONF_CITY: CITY_1_POSTAL}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["result"].unique_id == f"{CITY_1_LAT}, {CITY_1_LON}" assert result["title"] == f"{CITY_1}" assert result["data"][CONF_LATITUDE] == str(CITY_1_LAT) @@ -139,14 +139,14 @@ async def test_user_list(hass: HomeAssistant, client_multiple) -> None: context={"source": SOURCE_USER}, data={CONF_CITY: CITY_2_NAME}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "cities" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_CITY: f"{CITY_3};{CITY_3_LAT};{CITY_3_LON}"}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["result"].unique_id == f"{CITY_3_LAT}, {CITY_3_LON}" assert result["title"] == f"{CITY_3}" assert result["data"][CONF_LATITUDE] == str(CITY_3_LAT) @@ -161,7 +161,7 @@ async def test_search_failed(hass: HomeAssistant, client_empty) -> None: data={CONF_CITY: CITY_1_POSTAL}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {CONF_CITY: "empty"} @@ -179,5 +179,5 @@ async def test_abort_if_already_setup(hass: HomeAssistant, client_single) -> Non context={"source": SOURCE_USER}, data={CONF_CITY: CITY_1_POSTAL}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/meteoclimatic/test_config_flow.py b/tests/components/meteoclimatic/test_config_flow.py index 42fb5e78d4a..ff9de358e86 100644 --- a/tests/components/meteoclimatic/test_config_flow.py +++ b/tests/components/meteoclimatic/test_config_flow.py @@ -5,10 +5,10 @@ from unittest.mock import patch from meteoclimatic.exceptions import MeteoclimaticError, StationNotFound import pytest -from homeassistant import data_entry_flow from homeassistant.components.meteoclimatic.const import CONF_STATION_CODE, DOMAIN from homeassistant.config_entries import SOURCE_USER from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType TEST_STATION_CODE = "ESCAT4300000043206B" TEST_STATION_NAME = "Reus (Tarragona)" @@ -44,7 +44,7 @@ async def test_user(hass: HomeAssistant, client) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" # test with all provided @@ -53,7 +53,7 @@ async def test_user(hass: HomeAssistant, client) -> None: context={"source": SOURCE_USER}, data={CONF_STATION_CODE: TEST_STATION_CODE}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["result"].unique_id == TEST_STATION_CODE assert result["title"] == TEST_STATION_NAME assert result["data"][CONF_STATION_CODE] == TEST_STATION_CODE @@ -70,7 +70,7 @@ async def test_not_found(hass: HomeAssistant) -> None: context={"source": SOURCE_USER}, data={CONF_STATION_CODE: TEST_STATION_CODE}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"]["base"] == "not_found" @@ -86,5 +86,5 @@ async def test_unknown_error(hass: HomeAssistant) -> None: context={"source": SOURCE_USER}, data={CONF_STATION_CODE: TEST_STATION_CODE}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "unknown" diff --git a/tests/components/microbees/test_config_flow.py b/tests/components/microbees/test_config_flow.py index 5e57c723f5b..9f8ca8c7747 100644 --- a/tests/components/microbees/test_config_flow.py +++ b/tests/components/microbees/test_config_flow.py @@ -37,7 +37,7 @@ async def test_full_flow( "redirect_uri": "https://example.com/auth/external/callback", }, ) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP assert result["url"] == ( f"{MICROBEES_AUTH_URI}?" f"response_type=code&client_id={CLIENT_ID}&" @@ -71,7 +71,7 @@ async def test_full_flow( assert len(hass.config_entries.async_entries(DOMAIN)) == 1 assert len(mock_setup.mock_calls) == 1 - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "test@microbees.com" assert "result" in result assert result["result"].unique_id == 54321 @@ -101,7 +101,7 @@ async def test_config_non_unique_profile( }, ) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP assert result["url"] == ( f"{MICROBEES_AUTH_URI}?" f"response_type=code&client_id={CLIENT_ID}&" @@ -129,7 +129,7 @@ async def test_config_non_unique_profile( ) result = await hass.config_entries.flow.async_configure(result["flow_id"]) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -190,7 +190,7 @@ async def test_config_reauth_profile( result = await hass.config_entries.flow.async_configure(result["flow_id"]) assert result - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" @@ -251,7 +251,7 @@ async def test_config_reauth_wrong_account( result = await hass.config_entries.flow.async_configure(result["flow_id"]) assert result - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "wrong_account" @@ -274,7 +274,7 @@ async def test_config_flow_with_invalid_credentials( }, ) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP assert result["url"] == ( f"{MICROBEES_AUTH_URI}?" f"response_type=code&client_id={CLIENT_ID}&" @@ -299,7 +299,7 @@ async def test_config_flow_with_invalid_credentials( result = await hass.config_entries.flow.async_configure(result["flow_id"]) assert result - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "oauth_error" @@ -334,7 +334,7 @@ async def test_unexpected_exceptions( "redirect_uri": "https://example.com/auth/external/callback", }, ) - assert result["type"] == FlowResultType.EXTERNAL_STEP + assert result["type"] is FlowResultType.EXTERNAL_STEP assert result["url"] == ( f"{MICROBEES_AUTH_URI}?" f"response_type=code&client_id={CLIENT_ID}&" @@ -362,5 +362,5 @@ async def test_unexpected_exceptions( result = await hass.config_entries.flow.async_configure(result["flow_id"]) assert result - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == error diff --git a/tests/components/mikrotik/test_config_flow.py b/tests/components/mikrotik/test_config_flow.py index f48446e3e14..0cc62b9bd8e 100644 --- a/tests/components/mikrotik/test_config_flow.py +++ b/tests/components/mikrotik/test_config_flow.py @@ -5,7 +5,7 @@ from unittest.mock import patch import librouteros import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.mikrotik.const import ( CONF_ARP_PING, CONF_DETECTION_TIME, @@ -20,6 +20,7 @@ from homeassistant.const import ( CONF_VERIFY_SSL, ) from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -75,14 +76,14 @@ async def test_flow_works(hass: HomeAssistant, 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" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=DEMO_USER_INPUT ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Mikrotik (0.0.0.0)" assert result["data"][CONF_HOST] == "0.0.0.0" assert result["data"][CONF_USERNAME] == "username" @@ -100,7 +101,7 @@ async def test_options(hass: HomeAssistant, api) -> None: result = await hass.config_entries.options.async_init(entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "device_tracker" result = await hass.config_entries.options.async_configure( @@ -112,7 +113,7 @@ async def test_options(hass: HomeAssistant, api) -> None: }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { CONF_DETECTION_TIME: 30, CONF_ARP_PING: True, @@ -145,7 +146,7 @@ async def test_connection_error(hass: HomeAssistant, conn_error) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=DEMO_USER_INPUT ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} @@ -159,7 +160,7 @@ async def test_wrong_credentials(hass: HomeAssistant, auth_error) -> None: result["flow_id"], user_input=DEMO_USER_INPUT ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == { CONF_USERNAME: "invalid_auth", CONF_PASSWORD: "invalid_auth", diff --git a/tests/components/mill/test_config_flow.py b/tests/components/mill/test_config_flow.py index d7740502412..23c7c3d0e67 100644 --- a/tests/components/mill/test_config_flow.py +++ b/tests/components/mill/test_config_flow.py @@ -17,7 +17,7 @@ async def test_show_config_form(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" @@ -26,7 +26,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"] is None result2 = await hass.config_entries.flow.async_configure( @@ -35,7 +35,7 @@ async def test_create_entry(hass: HomeAssistant) -> None: CONNECTION_TYPE: CLOUD, }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM with patch("mill.Mill.connect", return_value=True): result = await hass.config_entries.flow.async_configure( @@ -74,7 +74,7 @@ async def test_flow_entry_already_exists(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 result2 = await hass.config_entries.flow.async_configure( @@ -83,7 +83,7 @@ async def test_flow_entry_already_exists(hass: HomeAssistant) -> None: CONNECTION_TYPE: CLOUD, }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM with patch("mill.Mill.connect", return_value=True): result = await hass.config_entries.flow.async_configure( @@ -101,7 +101,7 @@ async def test_connection_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["errors"] is None result2 = await hass.config_entries.flow.async_configure( @@ -110,7 +110,7 @@ async def test_connection_error(hass: HomeAssistant) -> None: CONNECTION_TYPE: CLOUD, }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM with patch("mill.Mill.connect", return_value=False): result = await hass.config_entries.flow.async_configure( @@ -121,7 +121,7 @@ async def test_connection_error(hass: HomeAssistant) -> None: }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} @@ -130,7 +130,7 @@ async def test_local_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"] is None result2 = await hass.config_entries.flow.async_configure( @@ -139,7 +139,7 @@ async def test_local_create_entry(hass: HomeAssistant) -> None: CONNECTION_TYPE: LOCAL, }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM test_data = { CONF_IP_ADDRESS: "192.168.1.59", @@ -182,7 +182,7 @@ async def test_local_flow_entry_already_exists(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 result2 = await hass.config_entries.flow.async_configure( @@ -191,7 +191,7 @@ async def test_local_flow_entry_already_exists(hass: HomeAssistant) -> None: CONNECTION_TYPE: LOCAL, }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM test_data = { CONF_IP_ADDRESS: "192.168.1.59", @@ -221,7 +221,7 @@ async def test_local_connection_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["errors"] is None result2 = await hass.config_entries.flow.async_configure( @@ -230,7 +230,7 @@ async def test_local_connection_error(hass: HomeAssistant) -> None: CONNECTION_TYPE: LOCAL, }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM test_data = { CONF_IP_ADDRESS: "192.168.1.59", @@ -245,5 +245,5 @@ async def test_local_connection_error(hass: HomeAssistant) -> None: test_data, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} diff --git a/tests/components/min_max/test_config_flow.py b/tests/components/min_max/test_config_flow.py index 367c4cd717d..4a408524d09 100644 --- a/tests/components/min_max/test_config_flow.py +++ b/tests/components/min_max/test_config_flow.py @@ -20,7 +20,7 @@ async def test_config_flow(hass: HomeAssistant, platform: str) -> 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( @@ -33,7 +33,7 @@ async def test_config_flow(hass: HomeAssistant, platform: str) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "My min_max" assert result["data"] == {} assert result["options"] == { @@ -93,7 +93,7 @@ async def test_options(hass: HomeAssistant, platform: str) -> 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, "entity_ids") == input_sensors1 @@ -108,7 +108,7 @@ async def test_options(hass: HomeAssistant, platform: str) -> None: "type": "mean", }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { "entity_ids": input_sensors2, "name": "My min_max", diff --git a/tests/components/minecraft_server/test_config_flow.py b/tests/components/minecraft_server/test_config_flow.py index 188b68ce5af..21136ac0815 100644 --- a/tests/components/minecraft_server/test_config_flow.py +++ b/tests/components/minecraft_server/test_config_flow.py @@ -31,7 +31,7 @@ async def test_show_config_form(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" @@ -51,7 +51,7 @@ async def test_address_validation_failure(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER}, data=USER_INPUT ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} @@ -75,7 +75,7 @@ async def test_java_connection_failure(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER}, data=USER_INPUT ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} @@ -95,7 +95,7 @@ async def test_bedrock_connection_failure(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER}, data=USER_INPUT ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} @@ -119,7 +119,7 @@ async def test_java_connection(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER}, data=USER_INPUT ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == USER_INPUT[CONF_ADDRESS] assert result["data"][CONF_NAME] == USER_INPUT[CONF_NAME] assert result["data"][CONF_ADDRESS] == TEST_ADDRESS @@ -142,7 +142,7 @@ async def test_bedrock_connection(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER}, data=USER_INPUT ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == USER_INPUT[CONF_ADDRESS] assert result["data"][CONF_NAME] == USER_INPUT[CONF_NAME] assert result["data"][CONF_ADDRESS] == TEST_ADDRESS @@ -164,7 +164,7 @@ async def test_recovery(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=USER_INPUT ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} with ( @@ -180,7 +180,7 @@ async def test_recovery(hass: HomeAssistant) -> None: result2 = await hass.config_entries.flow.async_configure( flow_id=result["flow_id"], user_input=USER_INPUT ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == USER_INPUT[CONF_ADDRESS] assert result2["data"][CONF_NAME] == USER_INPUT[CONF_NAME] assert result2["data"][CONF_ADDRESS] == TEST_ADDRESS diff --git a/tests/components/mjpeg/test_config_flow.py b/tests/components/mjpeg/test_config_flow.py index a60df88b789..c2d5a9b014b 100644 --- a/tests/components/mjpeg/test_config_flow.py +++ b/tests/components/mjpeg/test_config_flow.py @@ -35,7 +35,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( @@ -50,7 +50,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") == "Spy cam" assert result2.get("data") == {} assert result2.get("options") == { @@ -80,7 +80,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_mjpeg_requests.get( @@ -96,7 +96,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") == {"username": "invalid_auth"} @@ -114,7 +114,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") == "Sky cam" assert result3.get("data") == {} assert result3.get("options") == { @@ -140,7 +140,7 @@ async def test_connection_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" # Test connectione error on MJPEG url @@ -156,7 +156,7 @@ async def test_connection_error( }, ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "user" assert result2.get("errors") == {"mjpeg_url": "cannot_connect"} @@ -179,7 +179,7 @@ async def test_connection_error( }, ) - assert result3.get("type") == FlowResultType.FORM + assert result3.get("type") is FlowResultType.FORM assert result3.get("step_id") == "user" assert result3.get("errors") == {"still_image_url": "cannot_connect"} @@ -199,7 +199,7 @@ async def test_connection_error( }, ) - assert result4.get("type") == FlowResultType.CREATE_ENTRY + assert result4.get("type") is FlowResultType.CREATE_ENTRY assert result4.get("title") == "My cam" assert result4.get("data") == {} assert result4.get("options") == { @@ -236,7 +236,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" @@ -248,7 +248,7 @@ async def test_options_flow( """Test options config flow.""" result = await hass.config_entries.options.async_init(init_integration.entry_id) - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "init" # Register a second camera @@ -276,7 +276,7 @@ async def test_options_flow( }, ) - assert result2.get("type") == FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "init" assert result2.get("errors") == {"mjpeg_url": "already_configured"} @@ -294,7 +294,7 @@ async def test_options_flow( }, ) - assert result3.get("type") == FlowResultType.FORM + assert result3.get("type") is FlowResultType.FORM assert result3.get("step_id") == "init" assert result3.get("errors") == {"mjpeg_url": "cannot_connect"} @@ -312,7 +312,7 @@ async def test_options_flow( }, ) - assert result4.get("type") == FlowResultType.FORM + assert result4.get("type") is FlowResultType.FORM assert result4.get("step_id") == "init" assert result4.get("errors") == {"still_image_url": "cannot_connect"} @@ -331,7 +331,7 @@ async def test_options_flow( }, ) - assert result5.get("type") == FlowResultType.FORM + assert result5.get("type") is FlowResultType.FORM assert result5.get("step_id") == "init" assert result5.get("errors") == {"username": "invalid_auth"} @@ -347,7 +347,7 @@ async def test_options_flow( }, ) - assert result6.get("type") == FlowResultType.CREATE_ENTRY + assert result6.get("type") is FlowResultType.CREATE_ENTRY assert result6.get("data") == { CONF_AUTHENTICATION: HTTP_BASIC_AUTHENTICATION, CONF_MJPEG_URL: "https://example.com/mjpeg", diff --git a/tests/components/moat/test_config_flow.py b/tests/components/moat/test_config_flow.py index ab0825c884e..43840330313 100644 --- a/tests/components/moat/test_config_flow.py +++ b/tests/components/moat/test_config_flow.py @@ -19,13 +19,13 @@ async def test_async_step_bluetooth_valid_device(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=MOAT_S2_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch("homeassistant.components.moat.async_setup_entry", return_value=True): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Moat S2 EEFF" assert result2["data"] == {} assert result2["result"].unique_id == "aa:bb:cc:dd:ee:ff" @@ -38,7 +38,7 @@ async def test_async_step_bluetooth_not_moat(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=NOT_MOAT_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_supported" @@ -48,7 +48,7 @@ async def test_async_step_user_no_devices_found(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -62,14 +62,14 @@ async def test_async_step_user_with_found_devices(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with patch("homeassistant.components.moat.async_setup_entry", return_value=True): result2 = await hass.config_entries.flow.async_configure( 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"] == "Moat S2 EEFF" assert result2["data"] == {} assert result2["result"].unique_id == "aa:bb:cc:dd:ee:ff" @@ -85,7 +85,7 @@ async def test_async_step_user_device_added_between_steps(hass: HomeAssistant) - DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" entry = MockConfigEntry( @@ -99,7 +99,7 @@ async def test_async_step_user_device_added_between_steps(hass: HomeAssistant) - result["flow_id"], user_input={"address": "aa:bb:cc:dd:ee:ff"}, ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" @@ -121,7 +121,7 @@ async def test_async_step_user_with_found_devices_already_setup( DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -138,7 +138,7 @@ async def test_async_step_bluetooth_devices_already_setup(hass: HomeAssistant) - context={"source": config_entries.SOURCE_BLUETOOTH}, data=MOAT_S2_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -149,7 +149,7 @@ async def test_async_step_bluetooth_already_in_progress(hass: HomeAssistant) -> context={"source": config_entries.SOURCE_BLUETOOTH}, data=MOAT_S2_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" result = await hass.config_entries.flow.async_init( @@ -157,7 +157,7 @@ async def test_async_step_bluetooth_already_in_progress(hass: HomeAssistant) -> context={"source": config_entries.SOURCE_BLUETOOTH}, data=MOAT_S2_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_in_progress" @@ -170,7 +170,7 @@ async def test_async_step_user_takes_precedence_over_discovery( context={"source": config_entries.SOURCE_BLUETOOTH}, data=MOAT_S2_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch( @@ -181,14 +181,14 @@ async def test_async_step_user_takes_precedence_over_discovery( DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM with patch("homeassistant.components.moat.async_setup_entry", return_value=True): result2 = await hass.config_entries.flow.async_configure( 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"] == "Moat S2 EEFF" assert result2["data"] == {} assert result2["result"].unique_id == "aa:bb:cc:dd:ee:ff" diff --git a/tests/components/modem_callerid/test_config_flow.py b/tests/components/modem_callerid/test_config_flow.py index aeb8fb6d966..2ae4d6659e7 100644 --- a/tests/components/modem_callerid/test_config_flow.py +++ b/tests/components/modem_callerid/test_config_flow.py @@ -4,12 +4,12 @@ from unittest.mock import MagicMock, patch import phone_modem -from homeassistant import data_entry_flow from homeassistant.components import usb from homeassistant.components.modem_callerid.const import DOMAIN from homeassistant.config_entries import SOURCE_USB, SOURCE_USER from homeassistant.const import CONF_DEVICE, CONF_SOURCE from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from . import com_port, patch_config_flow_modem @@ -38,14 +38,14 @@ async def test_flow_usb(hass: HomeAssistant) -> None: context={CONF_SOURCE: SOURCE_USB}, data=DISCOVERY_INFO, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "usb_confirm" result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_DEVICE: phone_modem.DEFAULT_PORT}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == {CONF_DEVICE: com_port().device} @@ -57,7 +57,7 @@ async def test_flow_usb_cannot_connect(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_USB}, data=DISCOVERY_INFO ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -79,7 +79,7 @@ async def test_flow_user(hass: HomeAssistant) -> None: context={CONF_SOURCE: SOURCE_USER}, data={CONF_DEVICE: port_select}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == {CONF_DEVICE: port.device} result = await hass.config_entries.flow.async_init( @@ -87,7 +87,7 @@ async def test_flow_user(hass: HomeAssistant) -> None: context={CONF_SOURCE: SOURCE_USER}, data={CONF_DEVICE: port_select}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -108,7 +108,7 @@ async def test_flow_user_error(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data={CONF_DEVICE: port_select} ) - 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"} @@ -117,7 +117,7 @@ async def test_flow_user_error(hass: HomeAssistant) -> None: result["flow_id"], user_input={CONF_DEVICE: port_select}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == {CONF_DEVICE: port.device} @@ -130,7 +130,7 @@ async def test_flow_user_no_port_list(hass: HomeAssistant) -> None: context={CONF_SOURCE: SOURCE_USER}, data={CONF_DEVICE: phone_modem.DEFAULT_PORT}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -142,7 +142,7 @@ async def test_abort_user_with_existing_flow(hass: HomeAssistant) -> None: context={CONF_SOURCE: SOURCE_USB}, data=DISCOVERY_INFO, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "usb_confirm" result2 = await hass.config_entries.flow.async_init( @@ -151,5 +151,5 @@ async def test_abort_user_with_existing_flow(hass: HomeAssistant) -> None: data={}, ) - 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/modern_forms/test_config_flow.py b/tests/components/modern_forms/test_config_flow.py index 6e1d2452479..56c293b241a 100644 --- a/tests/components/modern_forms/test_config_flow.py +++ b/tests/components/modern_forms/test_config_flow.py @@ -35,7 +35,7 @@ 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 with patch( "homeassistant.components.modern_forms.async_setup_entry", @@ -47,7 +47,7 @@ async def test_full_user_flow_implementation( assert result2.get("title") == "ModernFormsFan" assert "data" in result2 - assert result2.get("type") == FlowResultType.CREATE_ENTRY + assert result2.get("type") is FlowResultType.CREATE_ENTRY assert result2["data"][CONF_HOST] == "192.168.1.123" assert result2["data"][CONF_MAC] == "AA:BB:CC:DD:EE:FF" assert len(mock_setup_entry.mock_calls) == 1 @@ -82,7 +82,7 @@ async def test_full_zeroconf_flow_implementation( assert result.get("description_placeholders") == {CONF_NAME: "example"} assert result.get("step_id") == "zeroconf_confirm" - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM flow = flows[0] assert "context" in flow @@ -94,7 +94,7 @@ async def test_full_zeroconf_flow_implementation( ) assert result2.get("title") == "example" - 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" @@ -117,7 +117,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"} @@ -146,7 +146,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" @@ -178,7 +178,7 @@ async def test_zeroconf_confirm_connection_error( ), ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "cannot_connect" @@ -214,7 +214,7 @@ async def test_user_device_exists_abort( }, ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "already_configured" @@ -248,5 +248,5 @@ async def test_zeroconf_with_mac_device_exists_abort( ), ) - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "already_configured" diff --git a/tests/components/moehlenhoff_alpha2/test_config_flow.py b/tests/components/moehlenhoff_alpha2/test_config_flow.py index fcce2d139d2..33c67421958 100644 --- a/tests/components/moehlenhoff_alpha2/test_config_flow.py +++ b/tests/components/moehlenhoff_alpha2/test_config_flow.py @@ -29,7 +29,7 @@ async def test_form(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert not result["errors"] with ( @@ -45,7 +45,7 @@ async def test_form(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == MOCK_BASE_NAME assert result2["data"] == {"host": MOCK_BASE_HOST} assert len(mock_setup_entry.mock_calls) == 1 @@ -68,7 +68,7 @@ async def test_form_duplicate_error(hass: HomeAssistant) -> None: data={"host": MOCK_BASE_HOST}, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -83,7 +83,7 @@ async def test_form_cannot_connect_error(hass: HomeAssistant) -> None: user_input={"host": MOCK_BASE_HOST}, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -98,5 +98,5 @@ async def test_form_unexpected_error(hass: HomeAssistant) -> None: user_input={"host": MOCK_BASE_HOST}, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} diff --git a/tests/components/monoprice/test_config_flow.py b/tests/components/monoprice/test_config_flow.py index 74c69078b1d..30d0266eeea 100644 --- a/tests/components/monoprice/test_config_flow.py +++ b/tests/components/monoprice/test_config_flow.py @@ -4,7 +4,7 @@ from unittest.mock import patch from serial import SerialException -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.monoprice.const import ( CONF_SOURCE_1, CONF_SOURCE_4, @@ -14,6 +14,7 @@ from homeassistant.components.monoprice.const import ( ) from homeassistant.const import CONF_PORT from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -112,7 +113,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -120,5 +121,5 @@ async def test_options_flow(hass: HomeAssistant) -> None: user_input={CONF_SOURCE_1: "one", CONF_SOURCE_4: "", CONF_SOURCE_5: "five"}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options[CONF_SOURCES] == {"1": "one", "5": "five"} diff --git a/tests/components/moon/test_config_flow.py b/tests/components/moon/test_config_flow.py index 8fbab51f5a2..aac4381de59 100644 --- a/tests/components/moon/test_config_flow.py +++ b/tests/components/moon/test_config_flow.py @@ -19,7 +19,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( @@ -27,7 +27,7 @@ async def test_full_user_flow( user_input={}, ) - assert result2.get("type") == FlowResultType.CREATE_ENTRY + assert result2.get("type") is FlowResultType.CREATE_ENTRY assert result2.get("title") == "Moon" assert result2.get("data") == {} @@ -43,5 +43,5 @@ async def test_single_instance_allowed( 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/mopeka/test_config_flow.py b/tests/components/mopeka/test_config_flow.py index 8de1fd81add..826fe8db2aa 100644 --- a/tests/components/mopeka/test_config_flow.py +++ b/tests/components/mopeka/test_config_flow.py @@ -19,13 +19,13 @@ async def test_async_step_bluetooth_valid_device(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=PRO_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch("homeassistant.components.mopeka.async_setup_entry", return_value=True): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Pro Plus EEFF" assert result2["data"] == {} assert result2["result"].unique_id == "aa:bb:cc:dd:ee:ff" @@ -38,7 +38,7 @@ async def test_async_step_bluetooth_not_mopeka(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=NOT_MOPEKA_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_supported" @@ -48,7 +48,7 @@ async def test_async_step_user_no_devices_found(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -62,14 +62,14 @@ async def test_async_step_user_with_found_devices(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with patch("homeassistant.components.mopeka.async_setup_entry", return_value=True): result2 = await hass.config_entries.flow.async_configure( 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"] == "Pro Plus EEFF" assert result2["data"] == {} assert result2["result"].unique_id == "aa:bb:cc:dd:ee:ff" @@ -85,7 +85,7 @@ async def test_async_step_user_device_added_between_steps(hass: HomeAssistant) - DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" entry = MockConfigEntry( @@ -99,7 +99,7 @@ async def test_async_step_user_device_added_between_steps(hass: HomeAssistant) - result["flow_id"], user_input={"address": "aa:bb:cc:dd:ee:ff"}, ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" @@ -121,7 +121,7 @@ async def test_async_step_user_with_found_devices_already_setup( DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -138,7 +138,7 @@ async def test_async_step_bluetooth_devices_already_setup(hass: HomeAssistant) - context={"source": config_entries.SOURCE_BLUETOOTH}, data=PRO_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -149,7 +149,7 @@ async def test_async_step_bluetooth_already_in_progress(hass: HomeAssistant) -> context={"source": config_entries.SOURCE_BLUETOOTH}, data=PRO_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" result = await hass.config_entries.flow.async_init( @@ -157,7 +157,7 @@ async def test_async_step_bluetooth_already_in_progress(hass: HomeAssistant) -> context={"source": config_entries.SOURCE_BLUETOOTH}, data=PRO_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_in_progress" @@ -170,7 +170,7 @@ async def test_async_step_user_takes_precedence_over_discovery( context={"source": config_entries.SOURCE_BLUETOOTH}, data=PRO_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch( @@ -181,14 +181,14 @@ async def test_async_step_user_takes_precedence_over_discovery( DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM with patch("homeassistant.components.mopeka.async_setup_entry", return_value=True): result2 = await hass.config_entries.flow.async_configure( 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"] == "Pro Plus EEFF" assert result2["data"] == {} assert result2["result"].unique_id == "aa:bb:cc:dd:ee:ff" diff --git a/tests/components/motion_blinds/test_config_flow.py b/tests/components/motion_blinds/test_config_flow.py index 8d290b0b380..ac49d51f7ef 100644 --- a/tests/components/motion_blinds/test_config_flow.py +++ b/tests/components/motion_blinds/test_config_flow.py @@ -5,12 +5,13 @@ from unittest.mock import Mock, patch import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components import dhcp from homeassistant.components.motion_blinds import const from homeassistant.components.motion_blinds.config_flow import DEFAULT_GATEWAY_NAME from homeassistant.const import CONF_API_KEY, CONF_HOST from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -435,7 +436,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -443,7 +444,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: user_input={const.CONF_WAIT_FOR_PUSH: False}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { const.CONF_WAIT_FOR_PUSH: False, } diff --git a/tests/components/motionblinds_ble/test_config_flow.py b/tests/components/motionblinds_ble/test_config_flow.py index 9451e04830a..7b964f7d5e9 100644 --- a/tests/components/motionblinds_ble/test_config_flow.py +++ b/tests/components/motionblinds_ble/test_config_flow.py @@ -4,11 +4,12 @@ from unittest.mock import patch from motionblindsble.const import MotionBlindType -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.bluetooth.models import BluetoothServiceInfoBleak from homeassistant.components.motionblinds_ble import const from homeassistant.const import CONF_ADDRESS from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from .conftest import TEST_ADDRESS, TEST_MAC, TEST_NAME @@ -48,7 +49,7 @@ async def test_config_flow_manual_success( result = await hass.config_entries.flow.async_init( 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"] == {} @@ -56,14 +57,14 @@ async def test_config_flow_manual_success( result["flow_id"], {const.CONF_MAC_CODE: TEST_MAC}, ) - assert result["type"] is data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" result = await hass.config_entries.flow.async_configure( result["flow_id"], {const.CONF_BLIND_TYPE: MotionBlindType.ROLLER.name.lower()}, ) - assert result["type"] is data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == f"Motionblind {TEST_MAC.upper()}" assert result["data"] == { CONF_ADDRESS: TEST_ADDRESS, @@ -83,7 +84,7 @@ async def test_config_flow_manual_error_invalid_mac( result = await hass.config_entries.flow.async_init( 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"] == {} @@ -92,7 +93,7 @@ async def test_config_flow_manual_error_invalid_mac( result["flow_id"], {const.CONF_MAC_CODE: "AABBCC"}, # A MAC code should be 4 characters ) - assert result["type"] is data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": const.ERROR_INVALID_MAC_CODE} @@ -101,7 +102,7 @@ async def test_config_flow_manual_error_invalid_mac( result["flow_id"], {const.CONF_MAC_CODE: TEST_MAC}, ) - assert result["type"] is data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" # Finish flow @@ -109,7 +110,7 @@ async def test_config_flow_manual_error_invalid_mac( result["flow_id"], {const.CONF_BLIND_TYPE: MotionBlindType.ROLLER.name.lower()}, ) - assert result["type"] is data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == f"Motionblind {TEST_MAC.upper()}" assert result["data"] == { CONF_ADDRESS: TEST_ADDRESS, @@ -133,14 +134,14 @@ async def test_config_flow_manual_error_no_bluetooth_adapter( result = await hass.config_entries.flow.async_init( const.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] is data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == const.ERROR_NO_BLUETOOTH_ADAPTER # Try discovery with zero Bluetooth adapters result = await hass.config_entries.flow.async_init( 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"] == {} @@ -152,7 +153,7 @@ async def test_config_flow_manual_error_no_bluetooth_adapter( result["flow_id"], {const.CONF_MAC_CODE: TEST_MAC}, ) - assert result["type"] is data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == const.ERROR_NO_BLUETOOTH_ADAPTER @@ -165,7 +166,7 @@ async def test_config_flow_manual_error_could_not_find_motor( result = await hass.config_entries.flow.async_init( 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"] == {} @@ -175,7 +176,7 @@ async def test_config_flow_manual_error_could_not_find_motor( result["flow_id"], {const.CONF_MAC_CODE: TEST_MAC}, ) - assert result["type"] is data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": const.ERROR_COULD_NOT_FIND_MOTOR} @@ -185,7 +186,7 @@ async def test_config_flow_manual_error_could_not_find_motor( result["flow_id"], {const.CONF_MAC_CODE: TEST_MAC}, ) - assert result["type"] is data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" # Finish flow @@ -193,7 +194,7 @@ async def test_config_flow_manual_error_could_not_find_motor( result["flow_id"], {const.CONF_BLIND_TYPE: MotionBlindType.ROLLER.name.lower()}, ) - assert result["type"] is data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == f"Motionblind {TEST_MAC.upper()}" assert result["data"] == { CONF_ADDRESS: TEST_ADDRESS, @@ -213,7 +214,7 @@ async def test_config_flow_manual_error_no_devices_found( result = await hass.config_entries.flow.async_init( 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"] == {} @@ -223,7 +224,7 @@ async def test_config_flow_manual_error_no_devices_found( result["flow_id"], {const.CONF_MAC_CODE: TEST_MAC}, ) - assert result["type"] is data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == const.ERROR_NO_DEVICES_FOUND @@ -237,7 +238,7 @@ async def test_config_flow_bluetooth_success( data=BLIND_SERVICE_INFO, ) - assert result["type"] is data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" result = await hass.config_entries.flow.async_configure( @@ -245,7 +246,7 @@ async def test_config_flow_bluetooth_success( {const.CONF_BLIND_TYPE: MotionBlindType.ROLLER.name.lower()}, ) - assert result["type"] is data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == f"Motionblind {TEST_MAC.upper()}" assert result["data"] == { CONF_ADDRESS: TEST_ADDRESS, diff --git a/tests/components/motioneye/test_config_flow.py b/tests/components/motioneye/test_config_flow.py index 7163f2c8152..404200bd01a 100644 --- a/tests/components/motioneye/test_config_flow.py +++ b/tests/components/motioneye/test_config_flow.py @@ -8,7 +8,7 @@ from motioneye_client.client import ( MotionEyeClientRequestError, ) -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.hassio import HassioServiceInfo from homeassistant.components.motioneye.const import ( CONF_ADMIN_PASSWORD, @@ -22,6 +22,7 @@ from homeassistant.components.motioneye.const import ( ) from homeassistant.const import CONF_URL, CONF_WEBHOOK_ID from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from . import TEST_URL, create_mock_motioneye_client, create_mock_motioneye_config_entry @@ -88,12 +89,12 @@ async def test_hassio_success(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_HASSIO}, ) - assert result.get("type") == data_entry_flow.FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "hassio_confirm" assert result.get("description_placeholders") == {"addon": "motionEye"} result2 = await hass.config_entries.flow.async_configure(result["flow_id"], {}) - assert result2.get("type") == data_entry_flow.FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM assert result2.get("step_id") == "user" mock_client = create_mock_motioneye_client() @@ -119,7 +120,7 @@ async def test_hassio_success(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result3.get("type") == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result3.get("type") is FlowResultType.CREATE_ENTRY assert result3.get("title") == "Add-on" assert result3.get("data") == { CONF_URL: TEST_URL, @@ -300,7 +301,7 @@ async def test_reauth(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"] == "reauth_successful" assert dict(config_entry.data) == {**new_data, CONF_WEBHOOK_ID: "test-webhook-id"} @@ -350,7 +351,7 @@ async def test_duplicate(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert mock_client.async_client_close.called @@ -372,7 +373,7 @@ async def test_hassio_already_configured(hass: HomeAssistant) -> None: ), context={"source": config_entries.SOURCE_HASSIO}, ) - assert result.get("type") == data_entry_flow.FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "already_configured" @@ -392,7 +393,7 @@ async def test_hassio_ignored(hass: HomeAssistant) -> None: ), context={"source": config_entries.SOURCE_HASSIO}, ) - assert result.get("type") == data_entry_flow.FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "already_configured" @@ -401,7 +402,7 @@ async def test_hassio_abort_if_already_in_progress(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result.get("type") == data_entry_flow.FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM result2 = await hass.config_entries.flow.async_init( DOMAIN, @@ -413,7 +414,7 @@ async def test_hassio_abort_if_already_in_progress(hass: HomeAssistant) -> None: ), context={"source": config_entries.SOURCE_HASSIO}, ) - assert result2.get("type") == data_entry_flow.FlowResultType.ABORT + assert result2.get("type") is FlowResultType.ABORT assert result2.get("reason") == "already_in_progress" @@ -430,12 +431,12 @@ async def test_hassio_clean_up_on_user_flow(hass: HomeAssistant) -> None: ), context={"source": config_entries.SOURCE_HASSIO}, ) - assert result.get("type") == data_entry_flow.FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM result2 = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result2.get("type") == data_entry_flow.FlowResultType.FORM + assert result2.get("type") is FlowResultType.FORM mock_client = create_mock_motioneye_client() @@ -461,7 +462,7 @@ async def test_hassio_clean_up_on_user_flow(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result3.get("type") == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result3.get("type") is FlowResultType.CREATE_ENTRY assert len(mock_setup_entry.mock_calls) == 1 flows = hass.config_entries.flow.async_progress() @@ -487,7 +488,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"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -498,7 +499,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_WEBHOOK_SET] assert result["data"][CONF_WEBHOOK_SET_OVERWRITE] assert CONF_STREAM_URL_TEMPLATE not in result["data"] @@ -533,7 +534,7 @@ async def test_advanced_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_WEBHOOK_SET] assert result["data"][CONF_WEBHOOK_SET_OVERWRITE] assert CONF_STREAM_URL_TEMPLATE not in result["data"] @@ -552,7 +553,7 @@ async def test_advanced_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_WEBHOOK_SET] assert result["data"][CONF_WEBHOOK_SET_OVERWRITE] assert result["data"][CONF_STREAM_URL_TEMPLATE] == "http://moo" diff --git a/tests/components/motionmount/test_config_flow.py b/tests/components/motionmount/test_config_flow.py index f24c4e7a2e4..4de23de63c9 100644 --- a/tests/components/motionmount/test_config_flow.py +++ b/tests/components/motionmount/test_config_flow.py @@ -38,7 +38,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_user_connection_error( @@ -56,7 +56,7 @@ async def test_user_connection_error( data=user_input, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -75,7 +75,7 @@ async def test_user_connection_error_invalid_hostname( data=user_input, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -94,7 +94,7 @@ async def test_user_timeout_error( data=user_input, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "time_out" @@ -113,7 +113,7 @@ async def test_user_not_connected_error( data=user_input, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_connected" @@ -134,7 +134,7 @@ async def test_user_response_error_single_device_old_ce_old_new_pro( data=user_input, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == HOST assert result["data"] @@ -162,7 +162,7 @@ async def test_user_response_error_single_device_new_ce_old_pro( data=user_input, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == ZEROCONF_NAME assert result["data"] @@ -188,7 +188,7 @@ async def test_user_response_error_single_device_new_ce_new_pro( data=user_input, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == ZEROCONF_NAME assert result["data"] @@ -219,7 +219,7 @@ async def test_user_response_error_multi_device_old_ce_old_new_pro( data=user_input, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -242,7 +242,7 @@ async def test_user_response_error_multi_device_new_ce_new_pro( data=user_input, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -261,7 +261,7 @@ async def test_zeroconf_connection_error( data=discovery_info, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -280,7 +280,7 @@ async def test_zeroconf_connection_error_invalid_hostname( data=discovery_info, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cannot_connect" @@ -299,7 +299,7 @@ async def test_zeroconf_timout_error( data=discovery_info, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "time_out" @@ -318,7 +318,7 @@ async def test_zeroconf_not_connected_error( data=discovery_info, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_connected" @@ -339,7 +339,7 @@ async def test_show_zeroconf_form_old_ce_old_pro( ) assert result["step_id"] == "zeroconf_confirm" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["description_placeholders"] == {CONF_NAME: "My MotionMount"} @@ -360,7 +360,7 @@ async def test_show_zeroconf_form_old_ce_new_pro( ) assert result["step_id"] == "zeroconf_confirm" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["description_placeholders"] == {CONF_NAME: "My MotionMount"} @@ -381,7 +381,7 @@ async def test_show_zeroconf_form_new_ce_old_pro( ) assert result["step_id"] == "zeroconf_confirm" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["description_placeholders"] == {CONF_NAME: "My MotionMount"} @@ -400,7 +400,7 @@ async def test_show_zeroconf_form_new_ce_new_pro( ) assert result["step_id"] == "zeroconf_confirm" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["description_placeholders"] == {CONF_NAME: "My MotionMount"} @@ -419,7 +419,7 @@ async def test_zeroconf_device_exists_abort( data=discovery_info, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -437,14 +437,14 @@ async def test_full_user_flow_implementation( ) assert result["step_id"] == "user" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=MOCK_USER_INPUT.copy(), ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == ZEROCONF_NAME assert result["data"] @@ -471,13 +471,13 @@ async def test_full_zeroconf_flow_implementation( ) assert result["step_id"] == "zeroconf_confirm" - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == ZEROCONF_NAME assert result["data"] diff --git a/tests/components/mqtt/test_config_flow.py b/tests/components/mqtt/test_config_flow.py index 719117e59a9..f160fc0561a 100644 --- a/tests/components/mqtt/test_config_flow.py +++ b/tests/components/mqtt/test_config_flow.py @@ -11,10 +11,11 @@ from uuid import uuid4 import pytest import voluptuous as vol -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components import mqtt from homeassistant.components.hassio import HassioServiceInfo from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry from tests.typing import MqttMockHAClientGenerator, MqttMockPahoClient @@ -354,7 +355,7 @@ async def test_hassio_ignored(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_HASSIO}, ) assert result - assert result.get("type") == data_entry_flow.FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "already_configured" @@ -473,7 +474,7 @@ async def test_option_flow( mqtt_mock.async_connect.reset_mock() 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"] == "broker" result = await hass.config_entries.options.async_configure( @@ -485,7 +486,7 @@ async def test_option_flow( mqtt.CONF_PASSWORD: "pass", }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "options" await hass.async_block_till_done() @@ -510,7 +511,7 @@ async def test_option_flow( "will_retain": True, }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == {} assert config_entry.data == { mqtt.CONF_BROKER: "another-broker", @@ -609,7 +610,7 @@ async def test_bad_certificate( mqtt_mock.async_connect.reset_mock() 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"] == "broker" result = await hass.config_entries.options.async_configure( @@ -682,7 +683,7 @@ async def test_keepalive_validation( mqtt_mock.async_connect.reset_mock() 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"] == "broker" if error: @@ -722,7 +723,7 @@ async def test_disable_birth_will( mqtt_mock.async_connect.reset_mock() 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"] == "broker" result = await hass.config_entries.options.async_configure( @@ -734,7 +735,7 @@ async def test_disable_birth_will( mqtt.CONF_PASSWORD: "pass", }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "options" await hass.async_block_till_done() @@ -757,7 +758,7 @@ async def test_disable_birth_will( "will_retain": True, }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == {} assert config_entry.data == { mqtt.CONF_BROKER: "another-broker", @@ -799,7 +800,7 @@ async def test_invalid_discovery_prefix( mqtt_mock.async_connect.reset_mock() 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"] == "broker" result = await hass.config_entries.options.async_configure( @@ -809,7 +810,7 @@ async def test_invalid_discovery_prefix( mqtt.CONF_PORT: 2345, }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "options" await hass.async_block_till_done() @@ -822,7 +823,7 @@ async def test_invalid_discovery_prefix( mqtt.CONF_DISCOVERY_PREFIX: "homeassistant#invalid", }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "options" assert result["errors"]["base"] == "bad_discovery_prefix" assert config_entry.data == { @@ -892,7 +893,7 @@ async def test_option_flow_default_suggested_values( # Test default/suggested values from config 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"] == "broker" defaults = { mqtt.CONF_BROKER: "test-broker", @@ -916,7 +917,7 @@ async def test_option_flow_default_suggested_values( mqtt.CONF_PASSWORD: "p4ss", }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "options" defaults = { mqtt.CONF_DISCOVERY: True, @@ -950,11 +951,11 @@ async def test_option_flow_default_suggested_values( "will_retain": True, }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY # Test updated default/suggested values from config 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"] == "broker" defaults = { mqtt.CONF_BROKER: "another-broker", @@ -973,7 +974,7 @@ async def test_option_flow_default_suggested_values( result["flow_id"], user_input={mqtt.CONF_BROKER: "another-broker", mqtt.CONF_PORT: 2345}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "options" defaults = { mqtt.CONF_DISCOVERY: False, @@ -1007,7 +1008,7 @@ async def test_option_flow_default_suggested_values( "will_retain": True, }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY # Make sure all MQTT related jobs are done before ending the test await hass.async_block_till_done() @@ -1049,7 +1050,7 @@ async def test_skipping_advanced_options( result = await hass.config_entries.options.async_init( config_entry.entry_id, context={"show_advanced_options": True} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "broker" result = await hass.config_entries.options.async_configure( @@ -1221,7 +1222,7 @@ async def test_try_connection_with_advanced_parameters( # Test default/suggested values from config 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"] == "broker" defaults = { mqtt.CONF_BROKER: "test-broker", @@ -1261,7 +1262,7 @@ async def test_try_connection_with_advanced_parameters( mqtt.CONF_WS_HEADERS: '{"h3": "v3"}', }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} assert result["step_id"] == "options" await hass.async_block_till_done() @@ -1292,7 +1293,7 @@ async def test_try_connection_with_advanced_parameters( 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() diff --git a/tests/components/mullvad/test_config_flow.py b/tests/components/mullvad/test_config_flow.py index da9ce91eeed..a2468fbe7d2 100644 --- a/tests/components/mullvad/test_config_flow.py +++ b/tests/components/mullvad/test_config_flow.py @@ -18,7 +18,7 @@ async def test_form_user(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 ( @@ -50,7 +50,7 @@ async def test_form_user_only_once(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" @@ -71,7 +71,7 @@ async def test_connection_error(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -92,5 +92,5 @@ async def test_unknown_error(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} diff --git a/tests/components/mysensors/test_config_flow.py b/tests/components/mysensors/test_config_flow.py index f532d09c6bf..c75f8743cde 100644 --- a/tests/components/mysensors/test_config_flow.py +++ b/tests/components/mysensors/test_config_flow.py @@ -44,13 +44,13 @@ async def get_form( 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": GATEWAY_TYPE_TO_STEP[gateway_type]} ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == expected_step_id return result @@ -78,7 +78,7 @@ async def test_config_mqtt(hass: HomeAssistant, mqtt: None) -> None: if "errors" in result: assert not result["errors"] - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "mqtt" assert result["data"] == { CONF_DEVICE: "mqtt", @@ -96,7 +96,7 @@ async def test_missing_mqtt(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 result = await hass.config_entries.flow.async_configure( result["flow_id"], @@ -104,7 +104,7 @@ async def test_missing_mqtt(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "mqtt_required" @@ -139,7 +139,7 @@ async def test_config_serial(hass: HomeAssistant) -> None: if "errors" in result: assert not result["errors"] - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "/dev/ttyACM0" assert result["data"] == { CONF_DEVICE: "/dev/ttyACM0", @@ -177,7 +177,7 @@ async def test_config_tcp(hass: HomeAssistant) -> None: if "errors" in result: assert not result["errors"] - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "127.0.0.1" assert result["data"] == { CONF_DEVICE: "127.0.0.1", @@ -213,7 +213,7 @@ async def test_fail_to_connect(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert "errors" in result errors = result["errors"] assert errors @@ -374,7 +374,7 @@ async def test_config_invalid( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert "errors" in result errors = result["errors"] assert errors diff --git a/tests/components/mystrom/test_config_flow.py b/tests/components/mystrom/test_config_flow.py index b64b4edf547..d0b3603b211 100644 --- a/tests/components/mystrom/test_config_flow.py +++ b/tests/components/mystrom/test_config_flow.py @@ -22,7 +22,7 @@ async def test_form_combined(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["step_id"] == "user" assert result["errors"] == {} @@ -38,7 +38,7 @@ async def test_form_combined(hass: HomeAssistant, mock_setup_entry: AsyncMock) - ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "myStrom Device" assert result2["data"] == {"host": "1.1.1.1"} @@ -50,7 +50,7 @@ async def test_form_duplicates( 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"] == {} @@ -66,7 +66,7 @@ async def test_form_duplicates( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" mock_session.assert_called_once() @@ -78,7 +78,7 @@ async def test_wong_answer_from_device(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"] == {} with patch( @@ -93,7 +93,7 @@ async def test_wong_answer_from_device(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "user" assert result2["errors"] == {"base": "cannot_connect"} @@ -108,6 +108,6 @@ async def test_wong_answer_from_device(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"] == "myStrom Device" assert result2["data"] == {"host": "1.1.1.1"} diff --git a/tests/components/myuplink/test_config_flow.py b/tests/components/myuplink/test_config_flow.py index 1a4656bed73..7c5ae2c8657 100644 --- a/tests/components/myuplink/test_config_flow.py +++ b/tests/components/myuplink/test_config_flow.py @@ -155,7 +155,7 @@ async def test_flow_reauth( result = await hass.config_entries.flow.async_configure(result["flow_id"]) await hass.async_block_till_done() - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "reauth_successful" assert len(hass.config_entries.async_entries(DOMAIN)) == 1 diff --git a/tests/components/nam/test_config_flow.py b/tests/components/nam/test_config_flow.py index 71bf3cf1525..5dff9855988 100644 --- a/tests/components/nam/test_config_flow.py +++ b/tests/components/nam/test_config_flow.py @@ -6,11 +6,11 @@ from unittest.mock import patch from nettigo_air_monitor import ApiError, AuthFailedError, CannotGetMacError import pytest -from homeassistant import data_entry_flow from homeassistant.components import zeroconf from homeassistant.components.nam.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 tests.common import MockConfigEntry @@ -34,7 +34,7 @@ async def test_form_create_entry_without_auth(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" assert result["errors"] == {} @@ -57,7 +57,7 @@ async def test_form_create_entry_without_auth(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"] == "10.10.2.3" assert result["data"]["host"] == "10.10.2.3" assert len(mock_setup_entry.mock_calls) == 1 @@ -68,7 +68,7 @@ async def test_form_create_entry_with_auth(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" assert result["errors"] == {} @@ -90,7 +90,7 @@ async def test_form_create_entry_with_auth(hass: HomeAssistant) -> None: VALID_CONFIG, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "credentials" result = await hass.config_entries.flow.async_configure( @@ -99,7 +99,7 @@ async def test_form_create_entry_with_auth(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"] == "10.10.2.3" assert result["data"]["host"] == "10.10.2.3" assert result["data"]["username"] == "fake_username" @@ -133,7 +133,7 @@ async def test_reauth_successful(hass: HomeAssistant) -> None: 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( @@ -141,7 +141,7 @@ async def test_reauth_successful(hass: HomeAssistant) -> None: user_input=VALID_AUTH, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" @@ -165,7 +165,7 @@ async def test_reauth_unsuccessful(hass: HomeAssistant) -> None: 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( @@ -173,7 +173,7 @@ async def test_reauth_unsuccessful(hass: HomeAssistant) -> None: user_input=VALID_AUTH, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_unsuccessful" @@ -205,7 +205,7 @@ async def test_form_with_auth_errors(hass: HomeAssistant, error) -> None: data=VALID_CONFIG, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "credentials" with patch( @@ -262,7 +262,7 @@ async def test_form_abort(hass: HomeAssistant) -> None: data=VALID_CONFIG, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "device_unsupported" @@ -292,7 +292,7 @@ async def test_form_already_configured(hass: HomeAssistant) -> None: {"host": "1.1.1.1"}, ) - 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 @@ -322,7 +322,7 @@ async def test_zeroconf(hass: HomeAssistant) -> None: if flow["flow_id"] == result["flow_id"] ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} assert context["title_placeholders"]["host"] == "10.10.2.3" assert context["confirm_only"] is True @@ -337,7 +337,7 @@ async def test_zeroconf(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"] == "10.10.2.3" assert result["data"] == {"host": "10.10.2.3"} assert len(mock_setup_entry.mock_calls) == 1 @@ -366,7 +366,7 @@ async def test_zeroconf_with_auth(hass: HomeAssistant) -> None: if flow["flow_id"] == result["flow_id"] ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "credentials" assert result["errors"] == {} assert context["title_placeholders"]["host"] == "10.10.2.3" @@ -390,7 +390,7 @@ async def test_zeroconf_with_auth(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"] == "10.10.2.3" assert result["data"]["host"] == "10.10.2.3" assert result["data"]["username"] == "fake_username" @@ -411,7 +411,7 @@ async def test_zeroconf_host_already_configured(hass: HomeAssistant) -> None: context={"source": SOURCE_ZEROCONF}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -435,5 +435,5 @@ async def test_zeroconf_errors(hass: HomeAssistant, error) -> None: context={"source": SOURCE_ZEROCONF}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == reason diff --git a/tests/components/neato/test_config_flow.py b/tests/components/neato/test_config_flow.py index 34b1f37f56f..506a29b559f 100644 --- a/tests/components/neato/test_config_flow.py +++ b/tests/components/neato/test_config_flow.py @@ -4,13 +4,14 @@ from unittest.mock import patch from pybotvac.neato import Neato -from homeassistant import config_entries, data_entry_flow, setup +from homeassistant import config_entries, setup from homeassistant.components.application_credentials import ( ClientCredential, async_import_client_credential, ) from homeassistant.components.neato.const import NEATO_DOMAIN 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 @@ -92,7 +93,7 @@ async def test_abort_if_already_setup(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( "neato", context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -118,7 +119,7 @@ async def test_reauth( result = await hass.config_entries.flow.async_init( "neato", context={"source": config_entries.SOURCE_REAUTH} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" # Confirm reauth flow @@ -155,7 +156,7 @@ async def test_reauth( new_entry = hass.config_entries.async_get_entry("my_entry") - assert result3["type"] == data_entry_flow.FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "reauth_successful" assert new_entry.state == config_entries.ConfigEntryState.LOADED assert len(hass.config_entries.async_entries(NEATO_DOMAIN)) == 1 diff --git a/tests/components/netatmo/test_config_flow.py b/tests/components/netatmo/test_config_flow.py index 7866e448734..c828fae7ba2 100644 --- a/tests/components/netatmo/test_config_flow.py +++ b/tests/components/netatmo/test_config_flow.py @@ -5,7 +5,7 @@ from unittest.mock import patch from pyatmo.const import ALL_SCOPES -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components import zeroconf from homeassistant.components.netatmo import config_flow from homeassistant.components.netatmo.const import ( @@ -16,6 +16,7 @@ from homeassistant.components.netatmo.const import ( OAUTH2_TOKEN, ) from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from homeassistant.helpers import config_entry_oauth2_flow from .conftest import CLIENT_ID @@ -37,7 +38,7 @@ async def test_abort_if_existing_entry(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( "netatmo", context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" result = await hass.config_entries.flow.async_init( @@ -53,7 +54,7 @@ async def test_abort_if_existing_entry(hass: HomeAssistant) -> None: type="mock_type", ), ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -140,28 +141,28 @@ async def test_option_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"] == "public_weather_areas" result = await hass.config_entries.options.async_configure( result["flow_id"], user_input={CONF_NEW_AREA: "Home"} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "public_weather" result = await hass.config_entries.options.async_configure( result["flow_id"], user_input=valid_option ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "public_weather_areas" result = await hass.config_entries.options.async_configure( result["flow_id"], user_input={} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY for k, v in expected_result.items(): assert config_entry.options[CONF_WEATHER_AREAS]["Home"][k] == v @@ -198,28 +199,28 @@ async def test_option_flow_wrong_coordinates(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"] == "public_weather_areas" result = await hass.config_entries.options.async_configure( result["flow_id"], user_input={CONF_NEW_AREA: "Home"} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "public_weather" result = await hass.config_entries.options.async_configure( result["flow_id"], user_input=valid_option ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "public_weather_areas" result = await hass.config_entries.options.async_configure( result["flow_id"], user_input={} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY for k, v in expected_result.items(): assert config_entry.options[CONF_WEATHER_AREAS]["Home"][k] == v @@ -282,7 +283,7 @@ async def test_reauth( result = await hass.config_entries.flow.async_init( "netatmo", context={"source": config_entries.SOURCE_REAUTH} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" # Confirm reauth flow @@ -319,7 +320,7 @@ async def test_reauth( new_entry2 = hass.config_entries.async_entries(DOMAIN)[0] - assert result3["type"] == data_entry_flow.FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "reauth_successful" assert new_entry2.state == config_entries.ConfigEntryState.LOADED assert len(hass.config_entries.async_entries(DOMAIN)) == 1 diff --git a/tests/components/netgear/test_config_flow.py b/tests/components/netgear/test_config_flow.py index c0649d3646e..724a0568580 100644 --- a/tests/components/netgear/test_config_flow.py +++ b/tests/components/netgear/test_config_flow.py @@ -5,7 +5,6 @@ from unittest.mock import Mock, patch from pynetgear import DEFAULT_USER import pytest -from homeassistant import data_entry_flow from homeassistant.components import ssdp from homeassistant.components.netgear.const import ( CONF_CONSIDER_HOME, @@ -23,6 +22,7 @@ from homeassistant.const import ( CONF_USERNAME, ) from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -83,7 +83,7 @@ async def test_user(hass: HomeAssistant, service) -> 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" # Have to provide all config @@ -95,7 +95,7 @@ async def test_user(hass: HomeAssistant, service) -> 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"] == TITLE assert result["data"].get(CONF_HOST) == HOST @@ -110,7 +110,7 @@ async def test_user_connect_error(hass: HomeAssistant, service) -> 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" service.return_value.get_info = Mock(return_value=None) @@ -124,7 +124,7 @@ async def test_user_connect_error(hass: HomeAssistant, service) -> None: CONF_PASSWORD: PASSWORD, }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "info"} @@ -138,7 +138,7 @@ async def test_user_connect_error(hass: HomeAssistant, service) -> None: CONF_PASSWORD: PASSWORD, }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "config"} @@ -148,7 +148,7 @@ async def test_user_incomplete_info(hass: HomeAssistant, service) -> 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" router_infos = ROUTER_INFOS.copy() @@ -164,7 +164,7 @@ async def test_user_incomplete_info(hass: HomeAssistant, service) -> 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"] == TITLE_INCOMPLETE assert result["data"].get(CONF_HOST) == HOST @@ -186,14 +186,14 @@ async def test_abort_if_already_setup(hass: HomeAssistant, service) -> 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( result["flow_id"], {CONF_PASSWORD: PASSWORD}, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -219,7 +219,7 @@ async def test_ssdp_already_configured(hass: HomeAssistant) -> None: }, ), ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -238,7 +238,7 @@ async def test_ssdp_no_serial(hass: HomeAssistant) -> None: }, ), ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_serial" @@ -264,7 +264,7 @@ async def test_ssdp_ipv6(hass: HomeAssistant) -> None: }, ), ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_ipv4_address" @@ -284,13 +284,13 @@ async def test_ssdp(hass: HomeAssistant, service) -> None: }, ), ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" result = await hass.config_entries.flow.async_configure( result["flow_id"], {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"] == TITLE assert result["data"].get(CONF_HOST) == HOST @@ -316,7 +316,7 @@ async def test_ssdp_port_5555(hass: HomeAssistant, service) -> None: }, ), ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" service.return_value.port = 5555 @@ -325,7 +325,7 @@ async def test_ssdp_port_5555(hass: HomeAssistant, service) -> None: result = await hass.config_entries.flow.async_configure( result["flow_id"], {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"] == TITLE assert result["data"].get(CONF_HOST) == HOST @@ -350,7 +350,7 @@ async def test_options_flow(hass: HomeAssistant, service) -> 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( @@ -360,7 +360,7 @@ async def test_options_flow(hass: HomeAssistant, service) -> None: }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { CONF_CONSIDER_HOME: 1800, } diff --git a/tests/components/netgear_lte/test_config_flow.py b/tests/components/netgear_lte/test_config_flow.py index 71fe8ddb774..6b969e33475 100644 --- a/tests/components/netgear_lte/test_config_flow.py +++ b/tests/components/netgear_lte/test_config_flow.py @@ -9,6 +9,7 @@ from homeassistant.components.netgear_lte.const import DOMAIN from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_USER from homeassistant.const import CONF_SOURCE from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from .conftest import CONF_DATA @@ -51,7 +52,7 @@ async def test_flow_already_configured( data=CONF_DATA, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/nextbus/test_config_flow.py b/tests/components/nextbus/test_config_flow.py index 466ecb9df61..5d0158a50cb 100644 --- a/tests/components/nextbus/test_config_flow.py +++ b/tests/components/nextbus/test_config_flow.py @@ -47,7 +47,7 @@ async def test_import_config( ) await hass.async_block_till_done() - assert result.get("type") == FlowResultType.CREATE_ENTRY + assert result.get("type") is FlowResultType.CREATE_ENTRY assert ( result.get("title") == "San Francisco Muni F - Market & Wharves Market St & 7th St (Outbound)" @@ -64,7 +64,7 @@ async def test_import_config( ) await hass.async_block_till_done() - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == "already_configured" @@ -100,7 +100,7 @@ async def test_import_config_invalid( ) await hass.async_block_till_done() - assert result.get("type") == FlowResultType.ABORT + assert result.get("type") is FlowResultType.ABORT assert result.get("reason") == expected_reason @@ -112,7 +112,7 @@ async def test_user_config( 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") == "agency" # Select agency @@ -136,7 +136,7 @@ async def test_user_config( ) await hass.async_block_till_done() - assert result.get("type") == FlowResultType.FORM + assert result.get("type") is FlowResultType.FORM assert result.get("step_id") == "stop" # Select stop @@ -148,7 +148,7 @@ async def test_user_config( ) await hass.async_block_till_done() - assert result.get("type") == FlowResultType.CREATE_ENTRY + assert result.get("type") is FlowResultType.CREATE_ENTRY assert result.get("data") == { "agency": "sf-muni", "route": "F", diff --git a/tests/components/nextcloud/test_config_flow.py b/tests/components/nextcloud/test_config_flow.py index 32c688fb8c2..9a881197cf9 100644 --- a/tests/components/nextcloud/test_config_flow.py +++ b/tests/components/nextcloud/test_config_flow.py @@ -36,7 +36,7 @@ async def test_user_create_entry( 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"] == {} @@ -50,7 +50,7 @@ async def test_user_create_entry( VALID_CONFIG, ) 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"} @@ -64,7 +64,7 @@ async def test_user_create_entry( VALID_CONFIG, ) 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": "connection_error"} @@ -78,7 +78,7 @@ async def test_user_create_entry( VALID_CONFIG, ) 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": "connection_error"} @@ -93,7 +93,7 @@ async def test_user_create_entry( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "nc_url" assert result["data"] == snapshot @@ -113,7 +113,7 @@ async def test_user_already_configured( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -127,7 +127,7 @@ async def test_user_already_configured( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -149,7 +149,7 @@ async def test_reauth( context={"source": SOURCE_REAUTH, "entry_id": entry.entry_id}, data=entry.data, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" # test NextcloudMonitorAuthorizationError @@ -165,7 +165,7 @@ async def test_reauth( }, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["errors"] == {"base": "invalid_auth"} @@ -182,7 +182,7 @@ async def test_reauth( }, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["errors"] == {"base": "connection_error"} @@ -199,7 +199,7 @@ async def test_reauth( }, ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert result["errors"] == {"base": "connection_error"} @@ -217,6 +217,6 @@ async def test_reauth( ) 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 == snapshot diff --git a/tests/components/nextdns/test_config_flow.py b/tests/components/nextdns/test_config_flow.py index 4d9961474c5..9247288eebf 100644 --- a/tests/components/nextdns/test_config_flow.py +++ b/tests/components/nextdns/test_config_flow.py @@ -5,11 +5,11 @@ from unittest.mock import patch from nextdns import ApiError, InvalidApiKeyError import pytest -from homeassistant import data_entry_flow from homeassistant.components.nextdns.const import CONF_PROFILE_ID, DOMAIN from homeassistant.config_entries import SOURCE_USER from homeassistant.const import CONF_API_KEY, CONF_PROFILE_NAME from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from . import PROFILES, init_integration @@ -19,7 +19,7 @@ async def test_form_create_entry(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" assert result["errors"] == {} @@ -37,7 +37,7 @@ async def test_form_create_entry(hass: HomeAssistant) -> None: {CONF_API_KEY: "fake_api_key"}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "profiles" result = await hass.config_entries.flow.async_configure( @@ -45,7 +45,7 @@ async def test_form_create_entry(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Fake Profile" assert result["data"][CONF_API_KEY] == "fake_api_key" assert result["data"][CONF_PROFILE_ID] == "xyz12" @@ -97,5 +97,5 @@ async def test_form_already_configured(hass: HomeAssistant) -> None: result["flow_id"], {CONF_PROFILE_NAME: "Fake Profile"} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/nfandroidtv/test_config_flow.py b/tests/components/nfandroidtv/test_config_flow.py index 04fcf699513..271961fbee7 100644 --- a/tests/components/nfandroidtv/test_config_flow.py +++ b/tests/components/nfandroidtv/test_config_flow.py @@ -4,9 +4,10 @@ from unittest.mock import patch from notifications_android_tv.notifications import ConnectError -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.nfandroidtv.const import DOMAIN from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from . import ( CONF_CONFIG_FLOW, @@ -39,7 +40,7 @@ async def test_flow_user(hass: HomeAssistant) -> None: result["flow_id"], user_input=CONF_CONFIG_FLOW, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == NAME assert result["data"] == CONF_DATA @@ -64,7 +65,7 @@ async def test_flow_user_already_configured(hass: HomeAssistant) -> None: result["flow_id"], user_input=CONF_CONFIG_FLOW, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -78,7 +79,7 @@ async def test_flow_user_cannot_connect(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_USER}, data=CONF_CONFIG_FLOW, ) - 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"} @@ -93,6 +94,6 @@ async def test_flow_user_unknown_error(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_USER}, data=CONF_CONFIG_FLOW, ) - 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/nibe_heatpump/test_config_flow.py b/tests/components/nibe_heatpump/test_config_flow.py index b4c0b223998..471f7f4c593 100644 --- a/tests/components/nibe_heatpump/test_config_flow.py +++ b/tests/components/nibe_heatpump/test_config_flow.py @@ -43,13 +43,13 @@ async def _get_connection_form( 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": connection_type} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None return result @@ -67,7 +67,7 @@ async def test_nibegw_form( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "F1155 at 127.0.0.1" assert result2["data"] == { "model": "F1155", @@ -94,7 +94,7 @@ async def test_modbus_form( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "S1155 at 127.0.0.1" assert result2["data"] == { "model": "S1155", @@ -116,7 +116,7 @@ async def test_modbus_invalid_url( result["flow_id"], {**MOCK_FLOW_MODBUS_USERDATA, "modbus_url": "invalid://url"} ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"modbus_url": "url"} @@ -131,7 +131,7 @@ async def test_nibegw_address_inuse(hass: HomeAssistant, mock_connection: Mock) result["flow_id"], MOCK_FLOW_NIBEGW_USERDATA ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"listening_port": "address_in_use"} mock_connection.start.side_effect = Exception() @@ -140,7 +140,7 @@ async def test_nibegw_address_inuse(hass: HomeAssistant, mock_connection: Mock) result["flow_id"], MOCK_FLOW_NIBEGW_USERDATA ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} @@ -161,7 +161,7 @@ async def test_read_timeout( result2 = await hass.config_entries.flow.async_configure(result["flow_id"], data) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "read"} @@ -182,7 +182,7 @@ async def test_write_timeout( result2 = await hass.config_entries.flow.async_configure(result["flow_id"], data) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "write"} @@ -203,7 +203,7 @@ async def test_unexpected_exception( result2 = await hass.config_entries.flow.async_configure(result["flow_id"], data) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} @@ -224,7 +224,7 @@ async def test_nibegw_invalid_host( result2 = await hass.config_entries.flow.async_configure(result["flow_id"], data) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM if connection_type == "nibegw": assert result2["errors"] == {"ip_address": "address"} else: @@ -248,5 +248,5 @@ async def test_model_missing_coil( result2 = await hass.config_entries.flow.async_configure(result["flow_id"], data) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "model"} diff --git a/tests/components/nightscout/test_config_flow.py b/tests/components/nightscout/test_config_flow.py index c3723596a84..d139a66270c 100644 --- a/tests/components/nightscout/test_config_flow.py +++ b/tests/components/nightscout/test_config_flow.py @@ -5,11 +5,12 @@ from unittest.mock import patch from aiohttp import ClientConnectionError, ClientResponseError -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.nightscout.const import DOMAIN from homeassistant.components.nightscout.utils import hash_from_url from homeassistant.const import CONF_URL from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from . import GLUCOSE_READINGS, SERVER_STATUS, SERVER_STATUS_STATUS_ONLY @@ -24,7 +25,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 ( @@ -37,7 +38,7 @@ async def test_form(hass: HomeAssistant) -> None: CONFIG, ) - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == SERVER_STATUS.name # pylint: disable=maybe-no-member assert result2["data"] == CONFIG await hass.async_block_till_done() @@ -59,7 +60,7 @@ async def test_user_form_cannot_connect(hass: HomeAssistant) -> None: {CONF_URL: "https://some.url:1234"}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -84,7 +85,7 @@ async def test_user_form_api_key_required(hass: HomeAssistant) -> None: {CONF_URL: "https://some.url:1234"}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "invalid_auth"} @@ -103,7 +104,7 @@ async def test_user_form_unexpected_exception(hass: HomeAssistant) -> None: {CONF_URL: "https://some.url:1234"}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} @@ -119,7 +120,7 @@ async def test_user_form_duplicate(hass: HomeAssistant) -> None: 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" diff --git a/tests/components/nina/test_config_flow.py b/tests/components/nina/test_config_flow.py index d3c44258c23..804b614fe92 100644 --- a/tests/components/nina/test_config_flow.py +++ b/tests/components/nina/test_config_flow.py @@ -9,7 +9,6 @@ from unittest.mock import patch from pynina import ApiError -from homeassistant import data_entry_flow from homeassistant.components.nina.const import ( CONF_AREA_FILTER, CONF_HEADLINE_FILTER, @@ -25,6 +24,7 @@ from homeassistant.components.nina.const import ( ) from homeassistant.config_entries import SOURCE_USER from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from homeassistant.helpers import entity_registry as er from . import mocked_request_function @@ -61,7 +61,7 @@ async def test_show_set_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" @@ -75,7 +75,7 @@ async def test_step_user_connection_error(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER}, data=deepcopy(DUMMY_DATA) ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} @@ -89,7 +89,7 @@ async def test_step_user_unexpected_exception(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER}, data=deepcopy(DUMMY_DATA) ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT async def test_step_user(hass: HomeAssistant) -> None: @@ -108,7 +108,7 @@ async def test_step_user(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER}, data=deepcopy(DUMMY_DATA) ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "NINA" @@ -122,7 +122,7 @@ async def test_step_user_no_selection(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER}, data={CONF_HEADLINE_FILTER: ""} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "no_selection"} @@ -141,7 +141,7 @@ async def test_step_user_already_configured(hass: HomeAssistant) -> None: DOMAIN, context={"source": SOURCE_USER}, data=deepcopy(DUMMY_DATA) ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" @@ -172,7 +172,7 @@ async def test_options_flow_init(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( @@ -187,7 +187,7 @@ async def test_options_flow_init(hass: HomeAssistant) -> None: }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] is None assert dict(config_entry.data) == { @@ -227,7 +227,7 @@ async def test_options_flow_with_no_selection(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( @@ -243,7 +243,7 @@ async def test_options_flow_with_no_selection(hass: HomeAssistant) -> None: }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" assert result["errors"] == {"base": "no_selection"} @@ -272,7 +272,7 @@ async def test_options_flow_connection_error(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["errors"] == {"base": "cannot_connect"} @@ -300,7 +300,7 @@ async def test_options_flow_unexpected_exception(hass: HomeAssistant) -> None: result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT async def test_options_flow_entity_removal(hass: HomeAssistant) -> None: @@ -339,7 +339,7 @@ async def test_options_flow_entity_removal(hass: HomeAssistant) -> None: }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY entity_registry: er = er.async_get(hass) entries = er.async_entries_for_config_entry( diff --git a/tests/components/nmap_tracker/test_config_flow.py b/tests/components/nmap_tracker/test_config_flow.py index ccbdc112e46..f9b6964dc7d 100644 --- a/tests/components/nmap_tracker/test_config_flow.py +++ b/tests/components/nmap_tracker/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.device_tracker import ( CONF_CONSIDER_HOME, CONF_SCAN_INTERVAL, @@ -17,6 +17,7 @@ from homeassistant.components.nmap_tracker.const import ( ) from homeassistant.const import CONF_EXCLUDE, CONF_HOSTS from homeassistant.core import CoreState, HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -203,7 +204,7 @@ async def test_options_flow(hass: HomeAssistant, mock_get_source_ip) -> 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.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" assert result["data_schema"]({}) == { @@ -232,7 +233,7 @@ async def test_options_flow(hass: HomeAssistant, mock_get_source_ip) -> None: ) await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { CONF_HOSTS: "192.168.1.0/24,192.168.2.0/24", CONF_HOME_INTERVAL: 5, diff --git a/tests/components/notion/test_config_flow.py b/tests/components/notion/test_config_flow.py index 827565db339..2cc5e3f04b7 100644 --- a/tests/components/notion/test_config_flow.py +++ b/tests/components/notion/test_config_flow.py @@ -5,11 +5,11 @@ from unittest.mock import AsyncMock, patch from aionotion.errors import InvalidCredentialsError, NotionError import pytest -from homeassistant import data_entry_flow from homeassistant.components.notion import CONF_REFRESH_TOKEN, CONF_USER_UUID, DOMAIN from homeassistant.config_entries import SOURCE_REAUTH, SOURCE_USER from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from .conftest import TEST_PASSWORD, TEST_REFRESH_TOKEN, TEST_USER_UUID, TEST_USERNAME @@ -35,7 +35,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 getting a Notion API client: @@ -51,7 +51,7 @@ async def test_create_entry( CONF_PASSWORD: TEST_PASSWORD, }, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == errors result = await hass.config_entries.flow.async_configure( @@ -61,7 +61,7 @@ async def test_create_entry( CONF_PASSWORD: TEST_PASSWORD, }, ) - 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_REFRESH_TOKEN: TEST_REFRESH_TOKEN, @@ -75,7 +75,7 @@ async def test_duplicate_error(hass: HomeAssistant, config, config_entry) -> Non result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=config ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -115,7 +115,7 @@ async def test_reauth( 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["errors"] == errors result = await hass.config_entries.flow.async_configure( @@ -126,6 +126,6 @@ async def test_reauth( # to setup the config entry via reload. await hass.async_block_till_done() - 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/nuki/test_config_flow.py b/tests/components/nuki/test_config_flow.py index c7575f71545..58cbfde3d92 100644 --- a/tests/components/nuki/test_config_flow.py +++ b/tests/components/nuki/test_config_flow.py @@ -5,11 +5,12 @@ from unittest.mock import patch from pynuki.bridge import InvalidCredentialsException from requests.exceptions import RequestException -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components import dhcp from homeassistant.components.nuki.const import DOMAIN from homeassistant.const import CONF_TOKEN from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from .mock import DHCP_FORMATTED_MAC, HOST, MOCK_INFO, NAME, setup_nuki_integration @@ -20,7 +21,7 @@ async def test_form(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with ( @@ -43,7 +44,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"] == "75BCD15" assert result2["data"] == { "host": "1.1.1.1", @@ -72,7 +73,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"} @@ -95,7 +96,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"} @@ -118,7 +119,7 @@ async def test_form_unknown_exception(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} @@ -142,7 +143,7 @@ async def test_form_already_configured(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == data_entry_flow.FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" @@ -156,7 +157,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"] == config_entries.SOURCE_USER with ( @@ -178,7 +179,7 @@ async def test_dhcp_flow(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "75BCD15" assert result2["data"] == { "host": "1.1.1.1", @@ -201,7 +202,7 @@ async def test_dhcp_flow_already_configured(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"] == "already_configured" @@ -212,7 +213,7 @@ async def test_reauth_success(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.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 ( @@ -231,7 +232,7 @@ async def test_reauth_success(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == data_entry_flow.FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "reauth_successful" assert entry.data[CONF_TOKEN] == "new-token" @@ -243,7 +244,7 @@ async def test_reauth_invalid_auth(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.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 patch( @@ -255,7 +256,7 @@ async def test_reauth_invalid_auth(hass: HomeAssistant) -> None: user_input={CONF_TOKEN: "new-token"}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "reauth_confirm" assert result2["errors"] == {"base": "invalid_auth"} @@ -267,7 +268,7 @@ async def test_reauth_cannot_connect(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.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 patch( @@ -279,7 +280,7 @@ async def test_reauth_cannot_connect(hass: HomeAssistant) -> None: user_input={CONF_TOKEN: "new-token"}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "reauth_confirm" assert result2["errors"] == {"base": "cannot_connect"} @@ -291,7 +292,7 @@ async def test_reauth_unknown_exception(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.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 patch( @@ -303,6 +304,6 @@ async def test_reauth_unknown_exception(hass: HomeAssistant) -> None: user_input={CONF_TOKEN: "new-token"}, ) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "reauth_confirm" assert result2["errors"] == {"base": "unknown"} diff --git a/tests/components/nut/test_config_flow.py b/tests/components/nut/test_config_flow.py index 56a7d7d9089..537b6aba5ac 100644 --- a/tests/components/nut/test_config_flow.py +++ b/tests/components/nut/test_config_flow.py @@ -5,7 +5,7 @@ from unittest.mock import patch from aionut import NUTError, NUTLoginError -from homeassistant import config_entries, data_entry_flow, setup +from homeassistant import config_entries, setup from homeassistant.components import zeroconf from homeassistant.components.nut.const import DOMAIN from homeassistant.const import ( @@ -19,6 +19,7 @@ from homeassistant.const import ( CONF_USERNAME, ) from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from .util import _get_mock_nutclient @@ -47,7 +48,7 @@ async def test_form_zeroconf(hass: HomeAssistant) -> None: type="mock_type", ), ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -71,7 +72,7 @@ async def test_form_zeroconf(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"] == "192.168.1.5:1234" assert result2["data"] == { CONF_HOST: "192.168.1.5", @@ -89,7 +90,7 @@ async def test_form_user_one_ups(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"] == {} mock_pynut = _get_mock_nutclient( @@ -117,7 +118,7 @@ async def test_form_user_one_ups(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:2222" assert result2["data"] == { CONF_HOST: "1.1.1.1", @@ -141,7 +142,7 @@ async def test_form_user_multiple_ups(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"] == {} mock_pynut = _get_mock_nutclient( @@ -164,7 +165,7 @@ async def test_form_user_multiple_ups(hass: HomeAssistant) -> None: ) assert result2["step_id"] == "ups" - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM with ( patch( @@ -182,7 +183,7 @@ async def test_form_user_multiple_ups(hass: HomeAssistant) -> None: ) 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"] == "ups2@1.1.1.1:2222" assert result3["data"] == { CONF_HOST: "1.1.1.1", @@ -205,7 +206,7 @@ async def test_form_user_one_ups_with_ignored_entry(hass: HomeAssistant) -> None result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} mock_pynut = _get_mock_nutclient( @@ -233,7 +234,7 @@ async def test_form_user_one_ups_with_ignored_entry(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:2222" assert result2["data"] == { CONF_HOST: "1.1.1.1", @@ -266,7 +267,7 @@ async def test_form_no_upses_found(hass: HomeAssistant) -> None: }, ) - assert result2["type"] is data_entry_flow.FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "no_ups_found" @@ -296,7 +297,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"} assert result2["description_placeholders"] == {"error": "no route to host"} @@ -320,7 +321,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": "unknown"} mock_pynut = _get_mock_nutclient( @@ -347,7 +348,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] is data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "1.1.1.1:2222" assert result2["data"] == { CONF_HOST: "1.1.1.1", @@ -384,7 +385,7 @@ async def test_auth_failures(hass: HomeAssistant) -> None: }, ) - assert result2["type"] is data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"password": "invalid_auth"} mock_pynut = _get_mock_nutclient( @@ -411,7 +412,7 @@ async def test_auth_failures(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] is data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "1.1.1.1:2222" assert result2["data"] == { CONF_HOST: "1.1.1.1", @@ -457,7 +458,7 @@ async def test_reauth(hass: HomeAssistant) -> None: }, ) - assert result2["type"] is data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"password": "invalid_auth"} mock_pynut = _get_mock_nutclient( @@ -482,7 +483,7 @@ async def test_reauth(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] is data_entry_flow.FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "reauth_successful" assert len(mock_setup_entry.mock_calls) == 1 @@ -520,7 +521,7 @@ async def test_abort_if_already_setup(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == data_entry_flow.FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" @@ -559,7 +560,7 @@ async def test_abort_if_already_setup_alias(hass: HomeAssistant) -> None: ) assert result2["step_id"] == "ups" - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM with patch( "homeassistant.components.nut.AIONUTClient", @@ -570,7 +571,7 @@ async def test_abort_if_already_setup_alias(hass: HomeAssistant) -> None: {CONF_ALIAS: "ups1"}, ) - assert result3["type"] == data_entry_flow.FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "already_configured" @@ -587,14 +588,14 @@ async def test_options_flow(hass: HomeAssistant) -> None: with patch("homeassistant.components.nut.async_setup_entry", return_value=True): 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={} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { CONF_SCAN_INTERVAL: 60, } @@ -602,7 +603,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: with patch("homeassistant.components.nut.async_setup_entry", return_value=True): result2 = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result2["type"] == data_entry_flow.FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "init" result2 = await hass.config_entries.options.async_configure( @@ -610,7 +611,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: user_input={CONF_SCAN_INTERVAL: 12}, ) - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { CONF_SCAN_INTERVAL: 12, } diff --git a/tests/components/nzbget/test_config_flow.py b/tests/components/nzbget/test_config_flow.py index c299d1d6dd5..fb826407558 100644 --- a/tests/components/nzbget/test_config_flow.py +++ b/tests/components/nzbget/test_config_flow.py @@ -28,7 +28,7 @@ async def test_user_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 ( @@ -43,7 +43,7 @@ async def test_user_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"] == "10.10.10.30" assert result["data"] == {**USER_INPUT, CONF_VERIFY_SSL: False} @@ -56,7 +56,7 @@ async def test_user_form_show_advanced_options(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER, "show_advanced_options": True} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} user_input_advanced = { @@ -76,7 +76,7 @@ async def test_user_form_show_advanced_options(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.30" assert result["data"] == {**USER_INPUT, CONF_VERIFY_SSL: True} @@ -98,7 +98,7 @@ async def test_user_form_cannot_connect(hass: HomeAssistant) -> None: USER_INPUT, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} @@ -117,7 +117,7 @@ async def test_user_form_unexpected_exception(hass: HomeAssistant) -> None: USER_INPUT, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "unknown" @@ -131,5 +131,5 @@ async def test_user_form_single_instance_allowed(hass: HomeAssistant) -> None: context={"source": SOURCE_USER}, data=USER_INPUT, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" diff --git a/tests/components/obihai/test_config_flow.py b/tests/components/obihai/test_config_flow.py index d9ca52424c2..4ad06f33cd1 100644 --- a/tests/components/obihai/test_config_flow.py +++ b/tests/components/obihai/test_config_flow.py @@ -24,7 +24,7 @@ async def test_user_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> No result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {} @@ -35,7 +35,7 @@ async def test_user_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> No ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "10.10.10.30" assert result["data"] == {**USER_INPUT} @@ -55,7 +55,7 @@ async def test_auth_failure(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"]["base"] == "invalid_auth" @@ -73,7 +73,7 @@ async def test_connect_failure(hass: HomeAssistant, mock_gaierror: Generator) -> ) 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" @@ -92,7 +92,7 @@ async def test_dhcp_flow(hass: HomeAssistant) -> None: ) flows = hass.config_entries.flow.async_progress() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert len(flows) == 1 assert ( get_schema_suggestion(result["data_schema"].schema, CONF_USERNAME) @@ -114,7 +114,7 @@ async def test_dhcp_flow(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY async def test_dhcp_flow_auth_failure(hass: HomeAssistant) -> None: diff --git a/tests/components/octoprint/test_config_flow.py b/tests/components/octoprint/test_config_flow.py index 4c8e22e524c..3fb0d2a10bc 100644 --- a/tests/components/octoprint/test_config_flow.py +++ b/tests/components/octoprint/test_config_flow.py @@ -5,10 +5,11 @@ from unittest.mock import patch from pyoctoprintapi import ApiError, DiscoverySettings -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components import ssdp, zeroconf from homeassistant.components.octoprint.const import DOMAIN from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -242,7 +243,7 @@ async def test_show_zerconf_form(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 async def test_show_ssdp_form(hass: HomeAssistant) -> None: @@ -311,7 +312,7 @@ async def test_show_ssdp_form(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 async def test_import_yaml(hass: HomeAssistant) -> None: @@ -347,7 +348,7 @@ async def test_import_yaml(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 "errors" not in result @@ -384,7 +385,7 @@ async def test_import_duplicate_yaml(hass: HomeAssistant) -> None: await hass.async_block_till_done() assert len(request_app_key.mock_calls) == 0 - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/ollama/test_config_flow.py b/tests/components/ollama/test_config_flow.py index 825f3eac436..c58f14a8c87 100644 --- a/tests/components/ollama/test_config_flow.py +++ b/tests/components/ollama/test_config_flow.py @@ -28,7 +28,7 @@ async def test_form(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( ollama.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None with ( @@ -49,13 +49,13 @@ async def test_form(hass: HomeAssistant) -> None: await hass.async_block_till_done() # Step 2: model - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM result3 = await hass.config_entries.flow.async_configure( result2["flow_id"], {ollama.CONF_MODEL: TEST_MODEL} ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["data"] == { ollama.CONF_URL: "http://localhost:11434", ollama.CONF_MODEL: TEST_MODEL, @@ -75,7 +75,7 @@ async def test_form_need_download(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( ollama.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None pull_ready = asyncio.Event() @@ -113,14 +113,14 @@ async def test_form_need_download(hass: HomeAssistant) -> None: await hass.async_block_till_done() # Step 2: model - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM result3 = await hass.config_entries.flow.async_configure( result2["flow_id"], {ollama.CONF_MODEL: TEST_MODEL} ) await hass.async_block_till_done() # Step 3: download - assert result3["type"] == FlowResultType.SHOW_PROGRESS + assert result3["type"] is FlowResultType.SHOW_PROGRESS result4 = await hass.config_entries.flow.async_configure( result3["flow_id"], ) @@ -128,12 +128,12 @@ async def test_form_need_download(hass: HomeAssistant) -> None: # Run again without the task finishing. # We should still be downloading. - assert result4["type"] == FlowResultType.SHOW_PROGRESS + assert result4["type"] is FlowResultType.SHOW_PROGRESS result4 = await hass.config_entries.flow.async_configure( result4["flow_id"], ) await hass.async_block_till_done() - assert result4["type"] == FlowResultType.SHOW_PROGRESS + assert result4["type"] is FlowResultType.SHOW_PROGRESS # Signal fake pull method to complete pull_ready.set() @@ -147,7 +147,7 @@ async def test_form_need_download(hass: HomeAssistant) -> None: result4["flow_id"], ) - assert result5["type"] == FlowResultType.CREATE_ENTRY + assert result5["type"] is FlowResultType.CREATE_ENTRY assert result5["data"] == { ollama.CONF_URL: "http://localhost:11434", ollama.CONF_MODEL: TEST_MODEL, @@ -167,7 +167,7 @@ async def test_options( {ollama.CONF_PROMPT: "test prompt", ollama.CONF_MAX_HISTORY: 100}, ) await hass.async_block_till_done() - assert options["type"] == FlowResultType.CREATE_ENTRY + assert options["type"] is FlowResultType.CREATE_ENTRY assert options["data"] == { ollama.CONF_PROMPT: "test prompt", ollama.CONF_MAX_HISTORY: 100, @@ -195,7 +195,7 @@ async def test_form_errors(hass: HomeAssistant, side_effect, error) -> None: result["flow_id"], {ollama.CONF_URL: "http://localhost:11434"} ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": error} @@ -220,15 +220,15 @@ async def test_download_error(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM result3 = await hass.config_entries.flow.async_configure( result2["flow_id"], {ollama.CONF_MODEL: TEST_MODEL} ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.SHOW_PROGRESS + assert result3["type"] is FlowResultType.SHOW_PROGRESS result4 = await hass.config_entries.flow.async_configure(result3["flow_id"]) await hass.async_block_till_done() - assert result4["type"] == FlowResultType.ABORT + assert result4["type"] is FlowResultType.ABORT assert result4["reason"] == "download_failed" diff --git a/tests/components/omnilogic/test_config_flow.py b/tests/components/omnilogic/test_config_flow.py index 1c0d6aefcf8..25d1c41ba68 100644 --- a/tests/components/omnilogic/test_config_flow.py +++ b/tests/components/omnilogic/test_config_flow.py @@ -4,9 +4,10 @@ from unittest.mock import patch from omnilogic import LoginException, OmniLogicException -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.omnilogic.const import DOMAIN from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -134,7 +135,7 @@ async def test_option_flow(hass: HomeAssistant) -> None: data=None, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -142,6 +143,6 @@ async def test_option_flow(hass: HomeAssistant) -> None: user_input={"polling_interval": 9}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "" assert result["data"]["polling_interval"] == 9 diff --git a/tests/components/oncue/test_config_flow.py b/tests/components/oncue/test_config_flow.py index d757adec771..2f327dec052 100644 --- a/tests/components/oncue/test_config_flow.py +++ b/tests/components/oncue/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"] == {} with ( @@ -36,7 +36,7 @@ async def test_form(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "test-username" assert result2["data"] == { "username": "TEST-username", @@ -63,7 +63,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"} @@ -85,7 +85,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"} @@ -107,7 +107,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"} @@ -136,5 +136,5 @@ async def test_already_configured(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" diff --git a/tests/components/ondilo_ico/test_config_flow.py b/tests/components/ondilo_ico/test_config_flow.py index 53483241c0b..6b8fcbeefea 100644 --- a/tests/components/ondilo_ico/test_config_flow.py +++ b/tests/components/ondilo_ico/test_config_flow.py @@ -2,7 +2,7 @@ from unittest.mock import patch -from homeassistant import config_entries, data_entry_flow, setup +from homeassistant import config_entries, setup from homeassistant.components.ondilo_ico.const import ( DOMAIN, OAUTH2_AUTHORIZE, @@ -12,6 +12,7 @@ from homeassistant.components.ondilo_ico.const import ( ) 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 @@ -29,7 +30,7 @@ async def test_abort_if_existing_entry(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" diff --git a/tests/components/onewire/test_config_flow.py b/tests/components/onewire/test_config_flow.py index 980ecb22d32..c147a522a59 100644 --- a/tests/components/onewire/test_config_flow.py +++ b/tests/components/onewire/test_config_flow.py @@ -41,7 +41,7 @@ async def test_user_flow(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> No 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 not result["errors"] # Invalid server @@ -54,7 +54,7 @@ async def test_user_flow(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> No user_input={CONF_HOST: "1.2.3.4", CONF_PORT: 1234}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert result["errors"] == {"base": "cannot_connect"} @@ -67,7 +67,7 @@ async def test_user_flow(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> No user_input={CONF_HOST: "1.2.3.4", CONF_PORT: 1234}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "1.2.3.4" assert result["data"] == { CONF_HOST: "1.2.3.4", @@ -89,7 +89,7 @@ async def test_user_duplicate( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert not result["errors"] @@ -98,7 +98,7 @@ async def test_user_duplicate( result["flow_id"], user_input={CONF_HOST: "1.2.3.4", CONF_PORT: 1234}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -122,7 +122,7 @@ async def test_user_options_clear( result["flow_id"], user_input={INPUT_ENTRY_CLEAR_OPTIONS: True}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == {} @@ -146,7 +146,7 @@ async def test_user_options_empty_selection( result["flow_id"], user_input={INPUT_ENTRY_DEVICE_SELECTION: []}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "device_selection" assert result["errors"] == {"base": "device_not_selected"} @@ -174,7 +174,7 @@ async def test_user_options_set_single( result["flow_id"], user_input={INPUT_ENTRY_DEVICE_SELECTION: ["28.111111111111"]}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["description_placeholders"]["sensor_id"] == "28.111111111111" # Verify that the setting for the device comes back as default when no input is given @@ -182,7 +182,7 @@ async def test_user_options_set_single( result["flow_id"], user_input={}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert ( result["data"]["device_options"]["28.111111111111"]["precision"] == "temperature" @@ -220,7 +220,7 @@ async def test_user_options_set_multiple( ] }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert ( result["description_placeholders"]["sensor_id"] == "Given Name (28.222222222222)" @@ -231,7 +231,7 @@ async def test_user_options_set_multiple( result["flow_id"], user_input={"precision": "temperature"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert ( result["description_placeholders"]["sensor_id"] == "Given Name (28.111111111111)" @@ -242,7 +242,7 @@ async def test_user_options_set_multiple( result["flow_id"], user_input={"precision": "temperature9"}, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert ( result["data"]["device_options"]["28.222222222222"]["precision"] == "temperature" @@ -262,5 +262,5 @@ async def test_user_options_no_devices( # Verify that first config step comes back with an empty list of possible devices to choose from result = await hass.config_entries.options.async_init(config_entry.entry_id) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "No configurable devices found." diff --git a/tests/components/onvif/test_config_flow.py b/tests/components/onvif/test_config_flow.py index e59db13d3bb..b08615add0e 100644 --- a/tests/components/onvif/test_config_flow.py +++ b/tests/components/onvif/test_config_flow.py @@ -5,7 +5,7 @@ from unittest.mock import MagicMock, patch import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components import dhcp from homeassistant.components.onvif import DOMAIN, config_flow from homeassistant.config_entries import SOURCE_DHCP @@ -107,7 +107,7 @@ async def test_flow_discovered_devices(hass: HomeAssistant) -> None: config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with ( @@ -127,7 +127,7 @@ async def test_flow_discovered_devices(hass: HomeAssistant) -> None: result["flow_id"], user_input={"auto": True} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "device" container = result["data_schema"].schema[config_flow.CONF_HOST].container assert len(container) == 3 @@ -141,7 +141,7 @@ async def test_flow_discovered_devices(hass: HomeAssistant) -> None: result["flow_id"], user_input={config_flow.CONF_HOST: HOST} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "configure" with patch( @@ -158,7 +158,7 @@ async def test_flow_discovered_devices(hass: HomeAssistant) -> None: await hass.async_block_till_done() assert len(mock_setup_entry.mock_calls) == 1 - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == f"{URN} - {MAC}" assert result["data"] == { config_flow.CONF_NAME: URN, @@ -180,7 +180,7 @@ async def test_flow_discovered_devices_ignore_configured_manual_input( config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with ( @@ -200,7 +200,7 @@ async def test_flow_discovered_devices_ignore_configured_manual_input( result["flow_id"], user_input={"auto": True} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "device" assert len(result["data_schema"].schema[config_flow.CONF_HOST].container) == 2 @@ -209,7 +209,7 @@ async def test_flow_discovered_devices_ignore_configured_manual_input( user_input={config_flow.CONF_HOST: config_flow.CONF_MANUAL_INPUT}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "configure" @@ -221,7 +221,7 @@ async def test_flow_discovered_no_device(hass: HomeAssistant) -> None: config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with ( @@ -241,7 +241,7 @@ async def test_flow_discovered_no_device(hass: HomeAssistant) -> None: result["flow_id"], user_input={"auto": True} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "configure" @@ -266,7 +266,7 @@ async def test_flow_discovery_ignore_existing_and_abort(hass: HomeAssistant) -> config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with ( @@ -287,7 +287,7 @@ async def test_flow_discovery_ignore_existing_and_abort(hass: HomeAssistant) -> ) # It should skip to manual entry if the only devices are already configured - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "configure" result = await hass.config_entries.flow.async_configure( @@ -302,7 +302,7 @@ async def test_flow_discovery_ignore_existing_and_abort(hass: HomeAssistant) -> ) # It should abort if already configured and entered manually - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT async def test_flow_manual_entry(hass: HomeAssistant) -> None: @@ -312,7 +312,7 @@ async def test_flow_manual_entry(hass: HomeAssistant) -> None: config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with ( @@ -334,7 +334,7 @@ async def test_flow_manual_entry(hass: HomeAssistant) -> None: user_input={"auto": False}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "configure" with patch( @@ -354,7 +354,7 @@ async def test_flow_manual_entry(hass: HomeAssistant) -> None: await hass.async_block_till_done() assert len(mock_setup_entry.mock_calls) == 1 - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == f"{NAME} - {MAC}" assert result["data"] == { config_flow.CONF_NAME: NAME, @@ -371,7 +371,7 @@ async def test_flow_manual_entry_no_profiles(hass: HomeAssistant) -> None: config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with ( @@ -403,7 +403,7 @@ async def test_flow_manual_entry_no_profiles(hass: HomeAssistant) -> None: }, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_h264" @@ -413,7 +413,7 @@ async def test_flow_manual_entry_no_mac(hass: HomeAssistant) -> None: config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with ( @@ -447,7 +447,7 @@ async def test_flow_manual_entry_no_mac(hass: HomeAssistant) -> None: }, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_mac" @@ -457,7 +457,7 @@ async def test_flow_manual_entry_fails(hass: HomeAssistant) -> None: config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with ( @@ -481,7 +481,7 @@ async def test_flow_manual_entry_fails(hass: HomeAssistant) -> None: user_input={"auto": False}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "configure" with patch( @@ -501,7 +501,7 @@ async def test_flow_manual_entry_fails(hass: HomeAssistant) -> None: await hass.async_block_till_done() assert len(mock_setup_entry.mock_calls) == 0 - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "configure" assert result["errors"] == {"base": "onvif_error"} assert result["description_placeholders"] == {"error": "camera not ready"} @@ -526,7 +526,7 @@ async def test_flow_manual_entry_fails(hass: HomeAssistant) -> None: await hass.async_block_till_done() assert len(mock_setup_entry.mock_calls) == 0 - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "configure" assert result["errors"] == {"base": "onvif_error"} assert result["description_placeholders"] == { @@ -567,7 +567,7 @@ async def test_flow_manual_entry_wrong_password(hass: HomeAssistant) -> None: config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with ( @@ -589,7 +589,7 @@ async def test_flow_manual_entry_wrong_password(hass: HomeAssistant) -> None: user_input={"auto": False}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "configure" with patch( @@ -609,7 +609,7 @@ async def test_flow_manual_entry_wrong_password(hass: HomeAssistant) -> None: await hass.async_block_till_done() assert len(mock_setup_entry.mock_calls) == 0 - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "configure" assert result["errors"] == {"password": "auth_failed"} assert result["description_placeholders"] == {"error": "Authority failure"} @@ -651,7 +651,7 @@ async def test_option_flow(hass: HomeAssistant, option_value: bool) -> None: entry.entry_id, context={"show_advanced_options": True} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "onvif_devices" result = await hass.config_entries.options.async_configure( @@ -664,7 +664,7 @@ async def test_option_flow(hass: HomeAssistant, option_value: bool) -> None: }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { config_flow.CONF_EXTRA_ARGUMENTS: "", config_flow.CONF_RTSP_TRANSPORT: list(config_flow.RTSP_TRANSPORTS)[1], @@ -691,7 +691,7 @@ async def test_discovered_by_dhcp_updates_host(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 config_entry.data[CONF_HOST] == DHCP_DISCOVERY.ip @@ -716,7 +716,7 @@ async def test_discovered_by_dhcp_does_nothing_if_host_is_the_same( ) 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.data[CONF_HOST] == DHCP_DISCOVERY_SAME_IP.ip @@ -740,7 +740,7 @@ async def test_discovered_by_dhcp_does_not_update_if_already_loaded( ) 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.data[CONF_HOST] != DHCP_DISCOVERY.ip @@ -754,7 +754,7 @@ async def test_discovered_by_dhcp_does_not_update_if_no_matching_entry( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found" @@ -775,7 +775,7 @@ async def test_form_reauth(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_REAUTH, "entry_id": entry.entry_id}, data=entry.data, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "reauth_confirm" assert ( _get_schema_default(result["data_schema"].schema, CONF_USERNAME) @@ -804,7 +804,7 @@ async def test_form_reauth(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["step_id"] == "reauth_confirm" assert result2["errors"] == {config_flow.CONF_PASSWORD: "auth_failed"} assert result2["description_placeholders"] == { @@ -833,7 +833,7 @@ async def test_form_reauth(hass: HomeAssistant) -> None: ) await hass.async_block_till_done() - assert result3["type"] == FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "reauth_successful" assert len(mock_setup_entry.mock_calls) == 1 assert entry.data[config_flow.CONF_USERNAME] == "new-test-username" @@ -850,7 +850,7 @@ async def test_flow_manual_entry_updates_existing_user_password( config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with ( @@ -871,7 +871,7 @@ async def test_flow_manual_entry_updates_existing_user_password( result["flow_id"], user_input={"auto": False}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "configure" with patch( @@ -890,7 +890,7 @@ async def test_flow_manual_entry_updates_existing_user_password( await hass.async_block_till_done() - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert entry.data[config_flow.CONF_USERNAME] == USERNAME assert entry.data[config_flow.CONF_PASSWORD] == "new_password" @@ -903,7 +903,7 @@ async def test_flow_manual_entry_wrong_port(hass: HomeAssistant) -> None: config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with ( @@ -925,7 +925,7 @@ async def test_flow_manual_entry_wrong_port(hass: HomeAssistant) -> None: user_input={"auto": False}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "configure" with patch( @@ -945,7 +945,7 @@ async def test_flow_manual_entry_wrong_port(hass: HomeAssistant) -> None: await hass.async_block_till_done() assert len(mock_setup_entry.mock_calls) == 0 - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "configure" assert result["errors"] == {"port": "no_onvif_service"} assert result["description_placeholders"] == {} diff --git a/tests/components/open_meteo/test_config_flow.py b/tests/components/open_meteo/test_config_flow.py index 2eda6a8192b..5ff01da0fe9 100644 --- a/tests/components/open_meteo/test_config_flow.py +++ b/tests/components/open_meteo/test_config_flow.py @@ -19,7 +19,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( @@ -27,6 +27,6 @@ async def test_full_user_flow( user_input={CONF_ZONE: ENTITY_ID_HOME}, ) - assert result2.get("type") == FlowResultType.CREATE_ENTRY + assert result2.get("type") is FlowResultType.CREATE_ENTRY assert result2.get("title") == "test home" assert result2.get("data") == {CONF_ZONE: ENTITY_ID_HOME} diff --git a/tests/components/openai_conversation/test_config_flow.py b/tests/components/openai_conversation/test_config_flow.py index 659b3825472..57f03d0c0bf 100644 --- a/tests/components/openai_conversation/test_config_flow.py +++ b/tests/components/openai_conversation/test_config_flow.py @@ -30,7 +30,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 ( @@ -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["data"] == { "api_key": "bla", } @@ -72,7 +72,7 @@ async def test_options( }, ) await hass.async_block_till_done() - assert options["type"] == FlowResultType.CREATE_ENTRY + assert options["type"] is FlowResultType.CREATE_ENTRY assert options["data"]["prompt"] == "Speak like a pirate" assert options["data"]["max_tokens"] == 200 assert options["data"][CONF_CHAT_MODEL] == DEFAULT_CHAT_MODEL @@ -113,5 +113,5 @@ async def test_form_invalid_auth(hass: HomeAssistant, side_effect, error) -> Non }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": error} diff --git a/tests/components/openexchangerates/test_config_flow.py b/tests/components/openexchangerates/test_config_flow.py index e0896f64340..7c8ad7dfc77 100644 --- a/tests/components/openexchangerates/test_config_flow.py +++ b/tests/components/openexchangerates/test_config_flow.py @@ -38,7 +38,7 @@ async def test_user_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"] is None result = await hass.config_entries.flow.async_configure( @@ -47,7 +47,7 @@ async def test_user_create_entry( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "USD" assert result["data"] == { "api_key": "test-api-key", @@ -71,7 +71,7 @@ async def test_form_invalid_auth( {"api_key": "bad-api-key"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "invalid_auth"} @@ -90,7 +90,7 @@ async def test_form_cannot_connect( {"api_key": "test-api-key"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} @@ -109,7 +109,7 @@ async def test_form_unknown_error( {"api_key": "test-api-key"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "unknown"} @@ -123,7 +123,7 @@ async def test_already_configured_service( 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( @@ -131,7 +131,7 @@ async def test_already_configured_service( {"api_key": "test-api-key"}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -141,7 +141,7 @@ async def test_no_currencies(hass: HomeAssistant, currencies: AsyncMock) -> 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"] == "cannot_connect" @@ -160,7 +160,7 @@ async def test_currencies_timeout(hass: HomeAssistant, currencies: AsyncMock) -> 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"] == "timeout_connect" @@ -188,7 +188,7 @@ async def test_latest_rates_timeout( {"api_key": "test-api-key"}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "timeout_connect"} @@ -210,7 +210,7 @@ async def test_reauth( result = await hass.config_entries.flow.async_init( DOMAIN, context=flow_context, data=mock_config_entry.data ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] is None mock_latest_rates_config_flow.side_effect = OpenExchangeRatesAuthError() @@ -222,7 +222,7 @@ async def test_reauth( }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "invalid_auth"} mock_latest_rates_config_flow.side_effect = None diff --git a/tests/components/opengarage/test_config_flow.py b/tests/components/opengarage/test_config_flow.py index 7d3e44017b0..be15ea425ae 100644 --- a/tests/components/opengarage/test_config_flow.py +++ b/tests/components/opengarage/test_config_flow.py @@ -18,7 +18,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 ( @@ -37,7 +37,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"] == "Name of the device" assert result2["data"] == { "host": "http://1.1.1.1", @@ -63,7 +63,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None: {"host": "http://1.1.1.1", "device_key": "AfsasdnfkjDD"}, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "invalid_auth"} @@ -82,7 +82,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None: {"host": "http://1.1.1.1", "device_key": "AfsasdnfkjDD"}, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "cannot_connect"} @@ -101,7 +101,7 @@ async def test_form_unknown_error(hass: HomeAssistant) -> None: {"host": "http://1.1.1.1", "device_key": "AfsasdnfkjDD"}, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": "unknown"} @@ -132,5 +132,5 @@ async def test_flow_entry_already_exists(hass: HomeAssistant) -> None: }, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" diff --git a/tests/components/openhome/test_config_flow.py b/tests/components/openhome/test_config_flow.py index 4cc5c58dda5..7ab1e69106c 100644 --- a/tests/components/openhome/test_config_flow.py +++ b/tests/components/openhome/test_config_flow.py @@ -1,6 +1,5 @@ """Tests for the Openhome config flow module.""" -from homeassistant import data_entry_flow from homeassistant.components import ssdp from homeassistant.components.openhome.const import DOMAIN from homeassistant.components.ssdp import ATTR_UPNP_FRIENDLY_NAME, ATTR_UPNP_UDN @@ -31,7 +30,7 @@ async def test_ssdp(hass: HomeAssistant) -> None: data=MOCK_DISCOVER, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" assert result["description_placeholders"] == {CONF_NAME: MOCK_FRIENDLY_NAME} @@ -55,7 +54,7 @@ async def test_device_exists(hass: HomeAssistant) -> None: context={CONF_SOURCE: SOURCE_SSDP}, data=MOCK_DISCOVER, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -74,7 +73,7 @@ async def test_missing_udn(hass: HomeAssistant) -> None: context={CONF_SOURCE: SOURCE_SSDP}, data=broken_discovery, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "incomplete_discovery" @@ -91,7 +90,7 @@ async def test_missing_ssdp_location(hass: HomeAssistant) -> None: context={CONF_SOURCE: SOURCE_SSDP}, data=broken_discovery, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "incomplete_discovery" @@ -110,7 +109,7 @@ async def test_host_updated(hass: HomeAssistant) -> None: context={CONF_SOURCE: SOURCE_SSDP}, data=MOCK_DISCOVER, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" assert entry.data[CONF_HOST] == MOCK_SSDP_LOCATION diff --git a/tests/components/opensky/test_config_flow.py b/tests/components/opensky/test_config_flow.py index 8168511a16c..e30d5ad8475 100644 --- a/tests/components/opensky/test_config_flow.py +++ b/tests/components/opensky/test_config_flow.py @@ -6,7 +6,6 @@ from unittest.mock import AsyncMock import pytest from python_opensky.exceptions import OpenSkyUnauthenticatedError -from homeassistant import data_entry_flow from homeassistant.components.opensky.const import ( CONF_ALTITUDE, CONF_CONTRIBUTING_USER, @@ -43,7 +42,7 @@ async def test_full_user_flow(hass: HomeAssistant, mock_setup_entry) -> None: CONF_ALTITUDE: 0, }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "OpenSky" assert result["data"] == { CONF_LATITUDE: 0.0, @@ -89,7 +88,7 @@ async def test_options_flow_failures( result = await hass.config_entries.options.async_init(config_entry.entry_id) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" result = await hass.config_entries.options.async_configure( @@ -98,7 +97,7 @@ async def test_options_flow_failures( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" assert result["errors"]["base"] == error opensky_client.authenticate.side_effect = None @@ -113,7 +112,7 @@ async def test_options_flow_failures( ) await hass.async_block_till_done() - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"] == { CONF_RADIUS: 10000, CONF_USERNAME: "homeassistant", @@ -143,7 +142,7 @@ async def test_options_flow( ) 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_RADIUS: 10000, CONF_USERNAME: "homeassistant", diff --git a/tests/components/opentherm_gw/test_config_flow.py b/tests/components/opentherm_gw/test_config_flow.py index c92f23f46b4..ff4ea9d7bb4 100644 --- a/tests/components/opentherm_gw/test_config_flow.py +++ b/tests/components/opentherm_gw/test_config_flow.py @@ -5,7 +5,7 @@ from unittest.mock import patch from pyotgw.vars import OTGW, OTGW_ABOUT from serial import SerialException -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.opentherm_gw.const import ( CONF_FLOOR_TEMP, CONF_PRECISION, @@ -22,6 +22,7 @@ from homeassistant.const import ( PRECISION_TENTHS, ) from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -241,7 +242,7 @@ async def test_options_migration(hass: HomeAssistant) -> None: entry.entry_id, 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"] == "init" result = await hass.config_entries.options.async_configure( @@ -249,7 +250,7 @@ async def test_options_migration(hass: HomeAssistant) -> None: user_input={}, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_READ_PRECISION] == PRECISION_TENTHS assert result["data"][CONF_SET_PRECISION] == PRECISION_TENTHS assert result["data"][CONF_FLOOR_TEMP] is True @@ -281,7 +282,7 @@ async def test_options_form(hass: HomeAssistant) -> None: result = await hass.config_entries.options.async_init( entry.entry_id, context={"source": "test"}, 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( @@ -294,7 +295,7 @@ async def test_options_form(hass: HomeAssistant) -> None: }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_READ_PRECISION] == PRECISION_HALVES assert result["data"][CONF_SET_PRECISION] == PRECISION_HALVES assert result["data"][CONF_TEMPORARY_OVRD_MODE] is True @@ -308,7 +309,7 @@ async def test_options_form(hass: HomeAssistant) -> None: result["flow_id"], user_input={CONF_READ_PRECISION: 0} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_READ_PRECISION] == 0.0 assert result["data"][CONF_SET_PRECISION] == PRECISION_HALVES assert result["data"][CONF_TEMPORARY_OVRD_MODE] is True @@ -328,7 +329,7 @@ async def test_options_form(hass: HomeAssistant) -> None: }, ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["data"][CONF_READ_PRECISION] == PRECISION_TENTHS assert result["data"][CONF_SET_PRECISION] == PRECISION_HALVES assert result["data"][CONF_TEMPORARY_OVRD_MODE] is False diff --git a/tests/components/openuv/test_config_flow.py b/tests/components/openuv/test_config_flow.py index db71b712fd9..3d31cf53250 100644 --- a/tests/components/openuv/test_config_flow.py +++ b/tests/components/openuv/test_config_flow.py @@ -6,7 +6,6 @@ from pyopenuv.errors import InvalidApiKeyError import pytest import voluptuous as vol -from homeassistant import data_entry_flow from homeassistant.components.openuv import CONF_FROM_WINDOW, CONF_TO_WINDOW, DOMAIN from homeassistant.config_entries import SOURCE_REAUTH, SOURCE_USER from homeassistant.const import ( @@ -16,6 +15,7 @@ from homeassistant.const import ( CONF_LONGITUDE, ) from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from .conftest import TEST_API_KEY, TEST_ELEVATION, TEST_LATITUDE, TEST_LONGITUDE @@ -27,7 +27,7 @@ async def test_create_entry(hass: HomeAssistant, client, config, mock_pyopenuv) 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 an error occurring: @@ -35,7 +35,7 @@ async def test_create_entry(hass: HomeAssistant, client, config, mock_pyopenuv) 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"] == {CONF_API_KEY: "invalid_api_key"} @@ -43,7 +43,7 @@ async def test_create_entry(hass: HomeAssistant, client, config, mock_pyopenuv) 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_LATITUDE}, {TEST_LONGITUDE}" assert result["data"] == { CONF_API_KEY: TEST_API_KEY, @@ -60,7 +60,7 @@ async def test_duplicate_error( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=config ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -69,7 +69,7 @@ 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" def get_schema_marker(data_schema: vol.Schema, key: str) -> vol.Marker: @@ -89,12 +89,12 @@ async def test_options_flow( result = await hass.config_entries.options.async_configure( result["flow_id"], user_input={CONF_FROM_WINDOW: 3.5, CONF_TO_WINDOW: 2.0} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == {CONF_FROM_WINDOW: 3.5, CONF_TO_WINDOW: 2.0} # Subsequent schema uses previous input for suggested values: result = await hass.config_entries.options.async_init(config_entry.entry_id) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "init" assert get_schema_marker(result["data_schema"], CONF_FROM_WINDOW).description == { "suggested_value": 3.5 @@ -114,12 +114,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_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 diff --git a/tests/components/openweathermap/test_config_flow.py b/tests/components/openweathermap/test_config_flow.py index 77a10c5b26f..d6c043b62a8 100644 --- a/tests/components/openweathermap/test_config_flow.py +++ b/tests/components/openweathermap/test_config_flow.py @@ -4,7 +4,6 @@ from unittest.mock import MagicMock, patch from pyowm.commons.exceptions import APIRequestError, UnauthorizedError -from homeassistant import data_entry_flow from homeassistant.components.openweathermap.const import ( DEFAULT_FORECAST_MODE, DEFAULT_LANGUAGE, @@ -20,6 +19,7 @@ from homeassistant.const import ( CONF_NAME, ) from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -47,7 +47,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"] == {} @@ -65,7 +65,7 @@ async def test_form(hass: HomeAssistant) -> None: await hass.async_block_till_done() assert entry.state == ConfigEntryState.NOT_LOADED - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == CONFIG[CONF_NAME] assert result["data"][CONF_LATITUDE] == CONFIG[CONF_LATITUDE] assert result["data"][CONF_LONGITUDE] == CONFIG[CONF_LONGITUDE] @@ -92,14 +92,14 @@ async def test_form_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"] == "init" result = await hass.config_entries.options.async_configure( result["flow_id"], user_input={CONF_MODE: "daily"} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { CONF_MODE: "daily", CONF_LANGUAGE: DEFAULT_LANGUAGE, @@ -111,14 +111,14 @@ async def test_form_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"] == "init" result = await hass.config_entries.options.async_configure( result["flow_id"], user_input={CONF_MODE: "onecall_daily"} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == { CONF_MODE: "onecall_daily", CONF_LANGUAGE: DEFAULT_LANGUAGE, diff --git a/tests/components/opower/test_config_flow.py b/tests/components/opower/test_config_flow.py index cb796d8e255..512a602a043 100644 --- a/tests/components/opower/test_config_flow.py +++ b/tests/components/opower/test_config_flow.py @@ -42,7 +42,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 not result["errors"] with patch( @@ -58,7 +58,7 @@ async def test_form( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Pacific Gas and Electric Company (PG&E) (test-username)" assert result2["data"] == { "utility": "Pacific Gas and Electric Company (PG&E)", @@ -76,7 +76,7 @@ async def test_form_with_mfa( 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"] result2 = await hass.config_entries.flow.async_configure( @@ -87,7 +87,7 @@ async def test_form_with_mfa( "password": "test-password", }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert not result2["errors"] with patch( @@ -100,7 +100,7 @@ async def test_form_with_mfa( }, ) - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == "Consolidated Edison (ConEd) (test-username)" assert result3["data"] == { "utility": "Consolidated Edison (ConEd)", @@ -119,7 +119,7 @@ async def test_form_with_mfa_bad_secret( 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"] result2 = await hass.config_entries.flow.async_configure( @@ -130,7 +130,7 @@ async def test_form_with_mfa_bad_secret( "password": "test-password", }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert not result2["errors"] with patch( @@ -144,7 +144,7 @@ async def test_form_with_mfa_bad_secret( }, ) - assert result3["type"] == FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["errors"] == { "base": "invalid_auth", } @@ -161,7 +161,7 @@ async def test_form_with_mfa_bad_secret( }, ) - assert result4["type"] == FlowResultType.CREATE_ENTRY + assert result4["type"] is FlowResultType.CREATE_ENTRY assert result4["title"] == "Consolidated Edison (ConEd) (test-username)" assert result4["data"] == { "utility": "Consolidated Edison (ConEd)", @@ -201,7 +201,7 @@ async def test_form_exceptions( }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": expected_error} assert mock_login.call_count == 1 @@ -228,7 +228,7 @@ async def test_form_already_configured( }, ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" assert mock_login.call_count == 0 @@ -257,7 +257,7 @@ async def test_form_not_already_configured( ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert ( result2["title"] == "Pacific Gas and Electric Company (PG&E) (test-username2)" ) @@ -297,7 +297,7 @@ async def test_form_valid_reauth( {"username": "test-username", "password": "test-password2"}, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" await hass.async_block_till_done() @@ -347,7 +347,7 @@ async def test_form_valid_reauth_with_mfa( }, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_successful" await hass.async_block_till_done() diff --git a/tests/components/oralb/test_config_flow.py b/tests/components/oralb/test_config_flow.py index 197da4264d1..dee16cd0632 100644 --- a/tests/components/oralb/test_config_flow.py +++ b/tests/components/oralb/test_config_flow.py @@ -19,13 +19,13 @@ async def test_async_step_bluetooth_valid_device(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=ORALB_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch("homeassistant.components.oralb.async_setup_entry", return_value=True): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Smart Series 7000 48BE" assert result2["data"] == {} assert result2["result"].unique_id == "78:DB:2F:C2:48:BE" @@ -40,13 +40,13 @@ async def test_async_step_bluetooth_valid_io_series4_device( context={"source": config_entries.SOURCE_BLUETOOTH}, data=ORALB_IO_SERIES_4_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch("homeassistant.components.oralb.async_setup_entry", return_value=True): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "IO Series 4 48BE" assert result2["data"] == {} assert result2["result"].unique_id == "78:DB:2F:C2:48:BE" @@ -59,7 +59,7 @@ async def test_async_step_bluetooth_not_oralb(hass: HomeAssistant) -> None: context={"source": config_entries.SOURCE_BLUETOOTH}, data=NOT_ORALB_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "not_supported" @@ -69,7 +69,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" @@ -83,14 +83,14 @@ async def test_async_step_user_with_found_devices(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" with patch("homeassistant.components.oralb.async_setup_entry", return_value=True): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={"address": "78:DB:2F:C2:48:BE"}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Smart Series 7000 48BE" assert result2["data"] == {} assert result2["result"].unique_id == "78:DB:2F:C2:48:BE" @@ -106,7 +106,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( @@ -120,7 +120,7 @@ async def test_async_step_user_device_added_between_steps(hass: HomeAssistant) - result["flow_id"], user_input={"address": "78:DB:2F:C2:48:BE"}, ) - assert result2["type"] == FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "already_configured" @@ -142,7 +142,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" @@ -159,7 +159,7 @@ async def test_async_step_bluetooth_devices_already_setup(hass: HomeAssistant) - context={"source": config_entries.SOURCE_BLUETOOTH}, data=ORALB_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -170,7 +170,7 @@ async def test_async_step_bluetooth_already_in_progress(hass: HomeAssistant) -> context={"source": config_entries.SOURCE_BLUETOOTH}, data=ORALB_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( @@ -178,7 +178,7 @@ async def test_async_step_bluetooth_already_in_progress(hass: HomeAssistant) -> context={"source": config_entries.SOURCE_BLUETOOTH}, data=ORALB_SERVICE_INFO, ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_in_progress" @@ -191,7 +191,7 @@ async def test_async_step_user_takes_precedence_over_discovery( context={"source": config_entries.SOURCE_BLUETOOTH}, data=ORALB_SERVICE_INFO, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == "bluetooth_confirm" with patch( @@ -202,14 +202,14 @@ async def test_async_step_user_takes_precedence_over_discovery( DOMAIN, context={"source": config_entries.SOURCE_USER}, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM with patch("homeassistant.components.oralb.async_setup_entry", return_value=True): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={"address": "78:DB:2F:C2:48:BE"}, ) - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "Smart Series 7000 48BE" assert result2["data"] == {} assert result2["result"].unique_id == "78:DB:2F:C2:48:BE" diff --git a/tests/components/osoenergy/test_config_flow.py b/tests/components/osoenergy/test_config_flow.py index c88035eef28..d9db5888cc3 100644 --- a/tests/components/osoenergy/test_config_flow.py +++ b/tests/components/osoenergy/test_config_flow.py @@ -4,10 +4,11 @@ from unittest.mock import patch from apyosoenergyapi.helper import osoenergy_exceptions -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.osoenergy.const import DOMAIN from homeassistant.const import CONF_API_KEY from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -23,7 +24,7 @@ async def test_user_flow(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with ( @@ -41,7 +42,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_USER_EMAIL assert result2["data"] == { CONF_API_KEY: SUBSCRIPTION_KEY, @@ -74,7 +75,7 @@ async def test_reauth_flow(hass: HomeAssistant) -> None: data=mock_config.data, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "invalid_auth"} with patch( @@ -90,7 +91,7 @@ async def test_reauth_flow(hass: HomeAssistant) -> None: await hass.async_block_till_done() assert mock_config.data.get(CONF_API_KEY) == SUBSCRIPTION_KEY - assert result2["type"] == data_entry_flow.FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "reauth_successful" assert len(hass.config_entries.async_entries(DOMAIN)) == 1 @@ -116,7 +117,7 @@ async def test_abort_if_existing_entry(hass: HomeAssistant) -> None: }, ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -126,7 +127,7 @@ async def test_user_flow_invalid_subscription_key(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with patch( @@ -138,7 +139,7 @@ async def test_user_flow_invalid_subscription_key(hass: HomeAssistant) -> None: {CONF_API_KEY: SUBSCRIPTION_KEY}, ) - 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"} @@ -151,7 +152,7 @@ async def test_user_flow_exception_on_subscription_key_check( 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( @@ -163,6 +164,6 @@ async def test_user_flow_exception_on_subscription_key_check( {CONF_API_KEY: SUBSCRIPTION_KEY}, ) - 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"} diff --git a/tests/components/otbr/test_config_flow.py b/tests/components/otbr/test_config_flow.py index 81dcb894be6..224f77931e5 100644 --- a/tests/components/otbr/test_config_flow.py +++ b/tests/components/otbr/test_config_flow.py @@ -61,7 +61,7 @@ async def test_user_flow( expected_data = {"url": url} - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with patch( @@ -74,7 +74,7 @@ async def test_user_flow( "url": url, }, ) - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Open Thread Border Router" assert result["data"] == expected_data assert result["options"] == {} @@ -102,7 +102,7 @@ async def test_user_flow_router_not_setup( result = await hass.config_entries.flow.async_init( otbr.DOMAIN, context={"source": "user"} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with ( @@ -140,7 +140,7 @@ async def test_user_flow_router_not_setup( "url": "http://custom_url:1234", } - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Open Thread Border Router" assert result["data"] == expected_data assert result["options"] == {} @@ -163,7 +163,7 @@ async def test_user_flow_404( otbr.DOMAIN, context={"source": "user"} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} result = await hass.config_entries.flow.async_configure( @@ -172,7 +172,7 @@ async def test_user_flow_404( "url": url, }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} @@ -190,7 +190,7 @@ async def test_user_flow_connect_error(hass: HomeAssistant, error) -> None: otbr.DOMAIN, context={"source": "user"} ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {} with patch("python_otbr_api.OTBR.get_active_dataset_tlvs", side_effect=error): @@ -200,7 +200,7 @@ async def test_user_flow_connect_error(hass: HomeAssistant, error) -> None: "url": "http://custom_url:1234", }, ) - assert result["type"] == FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["errors"] == {"base": "cannot_connect"} @@ -223,7 +223,7 @@ async def test_hassio_discovery_flow( "url": f"http://{HASSIO_DATA.config['host']}:{HASSIO_DATA.config['port']}", } - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Silicon Labs Multiprotocol" assert result["data"] == expected_data assert result["options"] == {} @@ -267,7 +267,7 @@ async def test_hassio_discovery_flow_yellow( "url": f"http://{HASSIO_DATA.config['host']}:{HASSIO_DATA.config['port']}", } - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Home Assistant Yellow (Silicon Labs Multiprotocol)" assert result["data"] == expected_data assert result["options"] == {} @@ -325,7 +325,7 @@ async def test_hassio_discovery_flow_sky_connect( "url": f"http://{HASSIO_DATA.config['host']}:{HASSIO_DATA.config['port']}", } - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == title assert result["data"] == expected_data assert result["options"] == {} @@ -396,13 +396,13 @@ async def test_hassio_discovery_flow_2x_addons( "url": f"http://{HASSIO_DATA.config['host']}:{HASSIO_DATA.config['port']}", } - assert results[0]["type"] == FlowResultType.CREATE_ENTRY + assert results[0]["type"] is FlowResultType.CREATE_ENTRY assert ( results[0]["title"] == "Home Assistant SkyConnect (Silicon Labs Multiprotocol)" ) assert results[0]["data"] == expected_data assert results[0]["options"] == {} - assert results[1]["type"] == FlowResultType.ABORT + assert results[1]["type"] is FlowResultType.ABORT assert results[1]["reason"] == "single_instance_allowed" assert len(hass.config_entries.async_entries(otbr.DOMAIN)) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -460,7 +460,7 @@ async def test_hassio_discovery_flow_router_not_setup( "url": f"http://{HASSIO_DATA.config['host']}:{HASSIO_DATA.config['port']}", } - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Silicon Labs Multiprotocol" assert result["data"] == expected_data assert result["options"] == {} @@ -512,7 +512,7 @@ async def test_hassio_discovery_flow_router_not_setup_has_preferred( "url": f"http://{HASSIO_DATA.config['host']}:{HASSIO_DATA.config['port']}", } - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Silicon Labs Multiprotocol" assert result["data"] == expected_data assert result["options"] == {} @@ -575,7 +575,7 @@ async def test_hassio_discovery_flow_router_not_setup_has_preferred_2( "url": f"http://{HASSIO_DATA.config['host']}:{HASSIO_DATA.config['port']}", } - assert result["type"] == FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Silicon Labs Multiprotocol" assert result["data"] == expected_data assert result["options"] == {} @@ -598,7 +598,7 @@ async def test_hassio_discovery_flow_404( otbr.DOMAIN, context={"source": "hassio"}, data=HASSIO_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "unknown" @@ -624,7 +624,7 @@ async def test_hassio_discovery_flow_new_port_missing_unique_id( otbr.DOMAIN, context={"source": "hassio"}, data=HASSIO_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" expected_data = { @@ -655,7 +655,7 @@ async def test_hassio_discovery_flow_new_port(hass: HomeAssistant) -> None: otbr.DOMAIN, context={"source": "hassio"}, data=HASSIO_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" expected_data = { @@ -683,7 +683,7 @@ async def test_hassio_discovery_flow_new_port_other_addon(hass: HomeAssistant) - otbr.DOMAIN, context={"source": "hassio"}, data=HASSIO_DATA ) - assert result["type"] == FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" # Make sure the data was not updated @@ -718,6 +718,6 @@ async def test_config_flow_single_entry( otbr.DOMAIN, context={"source": source}, data=data ) - 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/ourgroceries/test_config_flow.py b/tests/components/ourgroceries/test_config_flow.py index 0eb17cd4ff6..b18fd699c9a 100644 --- a/tests/components/ourgroceries/test_config_flow.py +++ b/tests/components/ourgroceries/test_config_flow.py @@ -19,7 +19,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( @@ -35,7 +35,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: ) await hass.async_block_till_done() - assert result2["type"] == FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["title"] == "test-username" assert result2["data"] == { "username": "test-username", @@ -73,7 +73,7 @@ async def test_form_error( }, ) - assert result2["type"] == FlowResultType.FORM + assert result2["type"] is FlowResultType.FORM assert result2["errors"] == {"base": error} with patch( "homeassistant.components.ourgroceries.config_flow.OurGroceries.login", @@ -87,7 +87,7 @@ async def test_form_error( }, ) - assert result3["type"] == FlowResultType.CREATE_ENTRY + assert result3["type"] is FlowResultType.CREATE_ENTRY assert result3["title"] == "test-username" assert result3["data"] == { "username": "test-username", diff --git a/tests/components/overkiz/test_config_flow.py b/tests/components/overkiz/test_config_flow.py index dbe8c690bc4..d99fe57233c 100644 --- a/tests/components/overkiz/test_config_flow.py +++ b/tests/components/overkiz/test_config_flow.py @@ -16,11 +16,12 @@ from pyoverkiz.exceptions import ( ) import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components import dhcp from homeassistant.components.overkiz.const import DOMAIN from homeassistant.components.zeroconf import ZeroconfServiceInfo from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry @@ -243,7 +244,7 @@ async def test_form_invalid_auth_cloud( await hass.async_block_till_done() - assert result4["type"] == data_entry_flow.FlowResultType.FORM + assert result4["type"] is FlowResultType.FORM assert result4["errors"] == {"base": error} @@ -304,7 +305,7 @@ async def test_form_invalid_auth_local( await hass.async_block_till_done() - assert result4["type"] == data_entry_flow.FlowResultType.FORM + assert result4["type"] is FlowResultType.FORM assert result4["errors"] == {"base": error} @@ -350,7 +351,7 @@ async def test_form_local_developer_mode_disabled( }, ) - assert result4["type"] == data_entry_flow.FlowResultType.FORM + assert result4["type"] is FlowResultType.FORM assert result4["errors"] == {"base": "developer_mode_disabled"} @@ -386,7 +387,7 @@ async def test_form_invalid_cozytouch_auth( await hass.async_block_till_done() - assert result3["type"] == data_entry_flow.FlowResultType.FORM + assert result3["type"] is FlowResultType.FORM assert result3["errors"] == {"base": error} assert result3["step_id"] == "cloud" @@ -436,7 +437,7 @@ async def test_cloud_abort_on_duplicate_entry( {"username": TEST_EMAIL, "password": TEST_PASSWORD}, ) - assert result4["type"] == data_entry_flow.FlowResultType.ABORT + assert result4["type"] is FlowResultType.ABORT assert result4["reason"] == "already_configured" @@ -496,7 +497,7 @@ async def test_local_abort_on_duplicate_entry( }, ) - assert result4["type"] == data_entry_flow.FlowResultType.ABORT + assert result4["type"] is FlowResultType.ABORT assert result4["reason"] == "already_configured" @@ -582,7 +583,7 @@ async def test_cloud_reauth_success(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"] == "cloud" with ( @@ -600,7 +601,7 @@ async def test_cloud_reauth_success(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == data_entry_flow.FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "reauth_successful" assert mock_entry.data["username"] == TEST_EMAIL assert mock_entry.data["password"] == TEST_PASSWORD2 @@ -632,7 +633,7 @@ async def test_cloud_reauth_wrong_account(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"] == "cloud" with ( @@ -650,7 +651,7 @@ async def test_cloud_reauth_wrong_account(hass: HomeAssistant) -> None: }, ) - assert result2["type"] == data_entry_flow.FlowResultType.ABORT + assert result2["type"] is FlowResultType.ABORT assert result2["reason"] == "reauth_wrong_account" @@ -681,7 +682,7 @@ async def test_local_reauth_success(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"] == "local_or_cloud" result2 = await hass.config_entries.flow.async_configure( @@ -707,7 +708,7 @@ async def test_local_reauth_success(hass: HomeAssistant) -> None: }, ) - assert result3["type"] == data_entry_flow.FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "reauth_successful" assert mock_entry.data["username"] == TEST_EMAIL assert mock_entry.data["password"] == TEST_PASSWORD2 @@ -739,7 +740,7 @@ async def test_local_reauth_wrong_account(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"] == "local_or_cloud" result2 = await hass.config_entries.flow.async_configure( @@ -765,7 +766,7 @@ async def test_local_reauth_wrong_account(hass: HomeAssistant) -> None: }, ) - assert result3["type"] == data_entry_flow.FlowResultType.ABORT + assert result3["type"] is FlowResultType.ABORT assert result3["reason"] == "reauth_wrong_account" @@ -781,7 +782,7 @@ async def test_dhcp_flow(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> No context={"source": config_entries.SOURCE_DHCP}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == config_entries.SOURCE_USER result2 = await hass.config_entries.flow.async_configure( @@ -840,7 +841,7 @@ async def test_dhcp_flow_already_configured(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"] == "already_configured" @@ -852,7 +853,7 @@ async def test_zeroconf_flow(hass: HomeAssistant, mock_setup_entry: AsyncMock) - context={"source": config_entries.SOURCE_ZEROCONF}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == config_entries.SOURCE_USER result2 = await hass.config_entries.flow.async_configure( @@ -905,7 +906,7 @@ async def test_local_zeroconf_flow( context={"source": config_entries.SOURCE_ZEROCONF}, ) - assert result["type"] == data_entry_flow.FlowResultType.FORM + assert result["type"] is FlowResultType.FORM assert result["step_id"] == config_entries.SOURCE_USER result2 = await hass.config_entries.flow.async_configure( @@ -967,5 +968,5 @@ async def test_zeroconf_flow_already_configured(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" diff --git a/tests/components/ovo_energy/test_config_flow.py b/tests/components/ovo_energy/test_config_flow.py index 3975be7cf80..7575f1edb29 100644 --- a/tests/components/ovo_energy/test_config_flow.py +++ b/tests/components/ovo_energy/test_config_flow.py @@ -4,10 +4,11 @@ from unittest.mock import patch import aiohttp -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.ovo_energy.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 @@ -23,7 +24,7 @@ async def test_show_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" @@ -33,7 +34,7 @@ async def test_authorization_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["step_id"] == "user" with patch( @@ -45,7 +46,7 @@ async def test_authorization_error(hass: HomeAssistant) -> None: FIXTURE_USER_INPUT, ) - 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"} @@ -56,7 +57,7 @@ async def test_connection_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["step_id"] == "user" with patch( @@ -68,7 +69,7 @@ async def test_connection_error(hass: HomeAssistant) -> None: FIXTURE_USER_INPUT, ) - 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"} @@ -79,7 +80,7 @@ async def test_full_flow_implementation(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" with ( @@ -101,7 +102,7 @@ async def test_full_flow_implementation(hass: HomeAssistant) -> None: FIXTURE_USER_INPUT, ) - assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result2["type"] is FlowResultType.CREATE_ENTRY assert result2["data"][CONF_USERNAME] == FIXTURE_USER_INPUT[CONF_USERNAME] assert result2["data"][CONF_PASSWORD] == FIXTURE_USER_INPUT[CONF_PASSWORD] @@ -118,7 +119,7 @@ async def test_reauth_authorization_error(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"] == "reauth" result2 = await hass.config_entries.flow.async_configure( @@ -127,7 +128,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"] == "reauth" assert result2["errors"] == {"base": "authorization_error"} @@ -144,7 +145,7 @@ async def test_reauth_connection_error(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"] == "reauth" result2 = await hass.config_entries.flow.async_configure( @@ -153,7 +154,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"] == "reauth" assert result2["errors"] == {"base": "connection_error"} @@ -175,7 +176,7 @@ async def test_reauth_flow(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"] == "reauth" assert result["errors"] == {"base": "authorization_error"} @@ -195,5 +196,5 @@ 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" diff --git a/tests/components/owntracks/test_config_flow.py b/tests/components/owntracks/test_config_flow.py index 8b353789c83..818524c1c50 100644 --- a/tests/components/owntracks/test_config_flow.py +++ b/tests/components/owntracks/test_config_flow.py @@ -4,13 +4,14 @@ from unittest.mock import patch import pytest -from homeassistant import config_entries, data_entry_flow +from homeassistant import config_entries from homeassistant.components.owntracks import config_flow from homeassistant.components.owntracks.config_flow import CONF_CLOUDHOOK, CONF_SECRET from homeassistant.components.owntracks.const import DOMAIN from homeassistant.config import async_process_ha_core_config from homeassistant.const import CONF_WEBHOOK_ID from homeassistant.core import HomeAssistant +from homeassistant.data_entry_flow import FlowResultType from homeassistant.setup import async_setup_component from tests.common import MockConfigEntry @@ -66,11 +67,11 @@ async def test_user(hass: HomeAssistant, webhook_id, secret) -> None: flow = await 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({}) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "OwnTracks" assert result["data"][CONF_WEBHOOK_ID] == WEBHOOK_ID assert result["data"][CONF_SECRET] == SECRET @@ -100,7 +101,7 @@ async def test_abort_if_already_setup(hass: HomeAssistant) -> None: # Should fail, already setup (flow) result = await flow.async_step_user({}) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" @@ -111,7 +112,7 @@ async def test_user_not_supports_encryption( flow = await init_config_flow(hass) result = await flow.async_step_user({}) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY assert ( result["description_placeholders"]["secret"] == "Encryption is not supported because nacl is not installed." @@ -169,7 +170,7 @@ async def test_with_cloud_sub(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER}, data={} ) - assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY + assert result["type"] is FlowResultType.CREATE_ENTRY entry = result["result"] assert entry.data["cloudhook"] assert ( @@ -198,5 +199,5 @@ async def test_with_cloud_sub_not_connected(hass: HomeAssistant) -> None: DOMAIN, context={"source": config_entries.SOURCE_USER}, data={} ) - assert result["type"] == data_entry_flow.FlowResultType.ABORT + assert result["type"] is FlowResultType.ABORT assert result["reason"] == "cloud_not_connected"