mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Search/replace RESULT_TYPE_* by FlowResultType enum (#74656)
This commit is contained in:
parent
46beae9061
commit
a6244eea28
@ -10,7 +10,7 @@ from homeassistant import auth
|
||||
from homeassistant.auth import auth_store
|
||||
from homeassistant.auth.providers import trusted_networks as tn_auth
|
||||
from homeassistant.components.http import CONF_TRUSTED_PROXIES, CONF_USE_X_FORWARDED_FOR
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_ABORT, RESULT_TYPE_CREATE_ENTRY
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
||||
@ -209,7 +209,7 @@ async def test_login_flow(manager, provider):
|
||||
# not from trusted network
|
||||
flow = await provider.async_login_flow({"ip_address": ip_address("127.0.0.1")})
|
||||
step = await flow.async_step_init()
|
||||
assert step["type"] == RESULT_TYPE_ABORT
|
||||
assert step["type"] == FlowResultType.ABORT
|
||||
assert step["reason"] == "not_allowed"
|
||||
|
||||
# from trusted network, list users
|
||||
@ -224,7 +224,7 @@ async def test_login_flow(manager, provider):
|
||||
|
||||
# login with valid user
|
||||
step = await flow.async_step_init({"user": user.id})
|
||||
assert step["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert step["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert step["data"]["user"] == user.id
|
||||
|
||||
|
||||
@ -248,7 +248,7 @@ async def test_trusted_users_login(manager_with_user, provider_with_user):
|
||||
{"ip_address": ip_address("127.0.0.1")}
|
||||
)
|
||||
step = await flow.async_step_init()
|
||||
assert step["type"] == RESULT_TYPE_ABORT
|
||||
assert step["type"] == FlowResultType.ABORT
|
||||
assert step["reason"] == "not_allowed"
|
||||
|
||||
# from trusted network, list users intersect trusted_users
|
||||
@ -332,7 +332,7 @@ async def test_trusted_group_login(manager_with_user, provider_with_user):
|
||||
{"ip_address": ip_address("127.0.0.1")}
|
||||
)
|
||||
step = await flow.async_step_init()
|
||||
assert step["type"] == RESULT_TYPE_ABORT
|
||||
assert step["type"] == FlowResultType.ABORT
|
||||
assert step["reason"] == "not_allowed"
|
||||
|
||||
# from trusted network, list users intersect trusted_users
|
||||
@ -370,7 +370,7 @@ async def test_bypass_login_flow(manager_bypass_login, provider_bypass_login):
|
||||
{"ip_address": ip_address("127.0.0.1")}
|
||||
)
|
||||
step = await flow.async_step_init()
|
||||
assert step["type"] == RESULT_TYPE_ABORT
|
||||
assert step["type"] == FlowResultType.ABORT
|
||||
assert step["reason"] == "not_allowed"
|
||||
|
||||
# from trusted network, only one available user, bypass the login flow
|
||||
@ -378,7 +378,7 @@ async def test_bypass_login_flow(manager_bypass_login, provider_bypass_login):
|
||||
{"ip_address": ip_address("192.168.0.1")}
|
||||
)
|
||||
step = await flow.async_step_init()
|
||||
assert step["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert step["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert step["data"]["user"] == owner.id
|
||||
|
||||
user = await manager_bypass_login.async_create_user("test-user")
|
||||
|
@ -15,7 +15,7 @@ from homeassistant.components.adax.const import (
|
||||
)
|
||||
from homeassistant.const import CONF_PASSWORD
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_ABORT, RESULT_TYPE_FORM
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -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"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -39,7 +39,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
CONNECTION_TYPE: CLOUD,
|
||||
},
|
||||
)
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
|
||||
with patch("adax.get_adax_token", return_value="test_token",), patch(
|
||||
"homeassistant.components.adax.async_setup_entry",
|
||||
@ -73,7 +73,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None:
|
||||
CONNECTION_TYPE: CLOUD,
|
||||
},
|
||||
)
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
|
||||
with patch(
|
||||
"adax.get_adax_token",
|
||||
@ -83,7 +83,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None:
|
||||
result2["flow_id"],
|
||||
TEST_DATA,
|
||||
)
|
||||
assert result3["type"] == RESULT_TYPE_FORM
|
||||
assert result3["type"] == FlowResultType.FORM
|
||||
assert result3["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -108,7 +108,7 @@ async def test_flow_entry_already_exists(hass: HomeAssistant) -> None:
|
||||
CONNECTION_TYPE: CLOUD,
|
||||
},
|
||||
)
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
|
||||
with patch("adax.get_adax_token", return_value="token"):
|
||||
result3 = await hass.config_entries.flow.async_configure(
|
||||
@ -129,7 +129,7 @@ async def test_local_create_entry(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -138,7 +138,7 @@ async def test_local_create_entry(hass):
|
||||
CONNECTION_TYPE: LOCAL,
|
||||
},
|
||||
)
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
|
||||
test_data = {
|
||||
WIFI_SSID: "ssid",
|
||||
@ -190,7 +190,7 @@ async def test_local_flow_entry_already_exists(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -199,7 +199,7 @@ async def test_local_flow_entry_already_exists(hass):
|
||||
CONNECTION_TYPE: LOCAL,
|
||||
},
|
||||
)
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
|
||||
test_data = {
|
||||
WIFI_SSID: "ssid",
|
||||
@ -228,7 +228,7 @@ async def test_local_connection_error(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -237,7 +237,7 @@ async def test_local_connection_error(hass):
|
||||
CONNECTION_TYPE: LOCAL,
|
||||
},
|
||||
)
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
|
||||
test_data = {
|
||||
WIFI_SSID: "ssid",
|
||||
@ -253,7 +253,7 @@ async def test_local_connection_error(hass):
|
||||
test_data,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -263,7 +263,7 @@ async def test_local_heater_not_available(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -272,7 +272,7 @@ async def test_local_heater_not_available(hass):
|
||||
CONNECTION_TYPE: LOCAL,
|
||||
},
|
||||
)
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
|
||||
test_data = {
|
||||
WIFI_SSID: "ssid",
|
||||
@ -288,7 +288,7 @@ async def test_local_heater_not_available(hass):
|
||||
test_data,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "heater_not_available"
|
||||
|
||||
|
||||
@ -298,7 +298,7 @@ async def test_local_heater_not_found(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -307,7 +307,7 @@ async def test_local_heater_not_found(hass):
|
||||
CONNECTION_TYPE: LOCAL,
|
||||
},
|
||||
)
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
|
||||
test_data = {
|
||||
WIFI_SSID: "ssid",
|
||||
@ -323,7 +323,7 @@ async def test_local_heater_not_found(hass):
|
||||
test_data,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "heater_not_found"
|
||||
|
||||
|
||||
@ -333,7 +333,7 @@ async def test_local_invalid_wifi_cred(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -342,7 +342,7 @@ async def test_local_invalid_wifi_cred(hass):
|
||||
CONNECTION_TYPE: LOCAL,
|
||||
},
|
||||
)
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
|
||||
test_data = {
|
||||
WIFI_SSID: "ssid",
|
||||
@ -358,5 +358,5 @@ async def test_local_invalid_wifi_cred(hass):
|
||||
test_data,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "invalid_auth"
|
||||
|
@ -6,7 +6,7 @@ import airthings
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.airthings.const import CONF_ID, CONF_SECRET, DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_CREATE_ENTRY, RESULT_TYPE_FORM
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -22,7 +22,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
with patch("airthings.get_token", return_value="test_token",), patch(
|
||||
@ -35,7 +35,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "Airthings"
|
||||
assert result2["data"] == TEST_DATA
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
@ -56,7 +56,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None:
|
||||
TEST_DATA,
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None:
|
||||
TEST_DATA,
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -94,7 +94,7 @@ async def test_form_unknown_error(hass: HomeAssistant) -> None:
|
||||
TEST_DATA,
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "unknown"}
|
||||
|
||||
|
||||
|
@ -7,11 +7,7 @@ from homeassistant import config_entries
|
||||
from homeassistant.components.aladdin_connect.const import DOMAIN
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -22,7 +18,7 @@ async def test_form(hass: HomeAssistant, mock_aladdinconnect_api: MagicMock) ->
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
with patch(
|
||||
@ -40,7 +36,7 @@ async def test_form(hass: HomeAssistant, mock_aladdinconnect_api: MagicMock) ->
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "Aladdin Connect"
|
||||
assert result2["data"] == {
|
||||
CONF_USERNAME: "test-username",
|
||||
@ -70,7 +66,7 @@ async def test_form_failed_auth(
|
||||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
|
||||
@ -94,7 +90,7 @@ async def test_form_connection_timeout(
|
||||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -153,7 +149,7 @@ async def test_import_flow_success(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "Aladdin Connect"
|
||||
assert result2["data"] == {
|
||||
CONF_USERNAME: "test-user",
|
||||
@ -185,7 +181,7 @@ async def test_reauth_flow(
|
||||
)
|
||||
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
@ -201,7 +197,7 @@ async def test_reauth_flow(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_ABORT
|
||||
assert result2["type"] == FlowResultType.ABORT
|
||||
assert result2["reason"] == "reauth_successful"
|
||||
assert mock_entry.data == {
|
||||
CONF_USERNAME: "test-username",
|
||||
@ -232,7 +228,7 @@ async def test_reauth_flow_auth_error(
|
||||
)
|
||||
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
mock_aladdinconnect_api.login.return_value = False
|
||||
with patch(
|
||||
@ -251,7 +247,7 @@ async def test_reauth_flow_auth_error(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
|
||||
@ -278,7 +274,7 @@ async def test_reauth_flow_connnection_error(
|
||||
)
|
||||
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
mock_aladdinconnect_api.login.side_effect = ClientConnectionError
|
||||
|
||||
@ -292,5 +288,5 @@ async def test_reauth_flow_connnection_error(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
@ -8,11 +8,7 @@ from homeassistant.components.ambee.const import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_REAUTH, SOURCE_USER
|
||||
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -23,7 +19,7 @@ async def test_full_user_flow(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -42,7 +38,7 @@ async def test_full_user_flow(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result2.get("title") == "Name"
|
||||
assert result2.get("data") == {
|
||||
CONF_API_KEY: "example",
|
||||
@ -64,7 +60,7 @@ async def test_full_flow_with_authentication_error(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -82,7 +78,7 @@ async def test_full_flow_with_authentication_error(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_FORM
|
||||
assert result2.get("type") == FlowResultType.FORM
|
||||
assert result2.get("step_id") == SOURCE_USER
|
||||
assert result2.get("errors") == {"base": "invalid_api_key"}
|
||||
assert "flow_id" in result2
|
||||
@ -102,7 +98,7 @@ async def test_full_flow_with_authentication_error(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result3.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result3.get("title") == "Name"
|
||||
assert result3.get("data") == {
|
||||
CONF_API_KEY: "example",
|
||||
@ -131,7 +127,7 @@ async def test_api_error(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("errors") == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -150,7 +146,7 @@ async def test_reauth_flow(
|
||||
},
|
||||
data=mock_config_entry.data,
|
||||
)
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == "reauth_confirm"
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -165,7 +161,7 @@ async def test_reauth_flow(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_ABORT
|
||||
assert result2.get("type") == FlowResultType.ABORT
|
||||
assert result2.get("reason") == "reauth_successful"
|
||||
assert mock_config_entry.data == {
|
||||
CONF_API_KEY: "other_key",
|
||||
@ -196,7 +192,7 @@ async def test_reauth_with_authentication_error(
|
||||
},
|
||||
data=mock_config_entry.data,
|
||||
)
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == "reauth_confirm"
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -211,7 +207,7 @@ async def test_reauth_with_authentication_error(
|
||||
},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_FORM
|
||||
assert result2.get("type") == FlowResultType.FORM
|
||||
assert result2.get("step_id") == "reauth_confirm"
|
||||
assert result2.get("errors") == {"base": "invalid_api_key"}
|
||||
assert "flow_id" in result2
|
||||
@ -227,7 +223,7 @@ async def test_reauth_with_authentication_error(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result3.get("type") == RESULT_TYPE_ABORT
|
||||
assert result3.get("type") == FlowResultType.ABORT
|
||||
assert result3.get("reason") == "reauth_successful"
|
||||
assert mock_config_entry.data == {
|
||||
CONF_API_KEY: "other_key",
|
||||
@ -267,6 +263,6 @@ async def test_reauth_api_error(
|
||||
},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_FORM
|
||||
assert result2.get("type") == FlowResultType.FORM
|
||||
assert result2.get("step_id") == "reauth_confirm"
|
||||
assert result2.get("errors") == {"base": "cannot_connect"}
|
||||
|
@ -6,7 +6,7 @@ from anthemav.device_error import DeviceError
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.anthemav.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_CREATE_ENTRY, RESULT_TYPE_FORM
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
|
||||
async def test_form_with_valid_connection(
|
||||
@ -16,7 +16,7 @@ async def test_form_with_valid_connection(
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
with patch(
|
||||
@ -33,7 +33,7 @@ async def test_form_with_valid_connection(
|
||||
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["data"] == {
|
||||
"host": "1.1.1.1",
|
||||
"port": 14999,
|
||||
@ -64,7 +64,7 @@ async def test_form_device_info_error(hass: HomeAssistant) -> None:
|
||||
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_receive_deviceinfo"}
|
||||
|
||||
|
||||
@ -88,7 +88,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None:
|
||||
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -105,7 +105,7 @@ async def test_import_configuration(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, data=config
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == {
|
||||
"host": "1.1.1.1",
|
||||
"port": 14999,
|
||||
|
@ -8,7 +8,7 @@ from homeassistant import config_entries, setup
|
||||
from homeassistant.components.aseko_pool_live.const import DOMAIN
|
||||
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_EMAIL, CONF_PASSWORD
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_CREATE_ENTRY, RESULT_TYPE_FORM
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
|
||||
async def test_form(hass: HomeAssistant) -> None:
|
||||
@ -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"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
@ -41,7 +41,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "aseko@example.com"
|
||||
assert result2["data"] == {CONF_ACCESS_TOKEN: "any_access_token"}
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
@ -82,5 +82,5 @@ async def test_get_account_info_exceptions(
|
||||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": reason}
|
||||
|
@ -8,11 +8,7 @@ from homeassistant import config_entries
|
||||
from homeassistant.components.aussie_broadband.const import DOMAIN
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from .common import FAKE_DATA, FAKE_SERVICES
|
||||
|
||||
@ -25,7 +21,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
result1 = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result1["type"] == RESULT_TYPE_FORM
|
||||
assert result1["type"] == FlowResultType.FORM
|
||||
assert result1["errors"] is None
|
||||
|
||||
with patch("aussiebb.asyncio.AussieBB.__init__", return_value=None), patch(
|
||||
@ -42,7 +38,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == TEST_USERNAME
|
||||
assert result2["data"] == FAKE_DATA
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
@ -87,7 +83,7 @@ async def test_already_configured(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result4["type"] == RESULT_TYPE_ABORT
|
||||
assert result4["type"] == FlowResultType.ABORT
|
||||
assert len(mock_setup_entry.mock_calls) == 0
|
||||
|
||||
|
||||
@ -96,7 +92,7 @@ async def test_no_services(hass: HomeAssistant) -> None:
|
||||
result1 = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result1["type"] == RESULT_TYPE_FORM
|
||||
assert result1["type"] == FlowResultType.FORM
|
||||
assert result1["errors"] is None
|
||||
|
||||
with patch("aussiebb.asyncio.AussieBB.__init__", return_value=None), patch(
|
||||
@ -111,7 +107,7 @@ async def test_no_services(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_ABORT
|
||||
assert result2["type"] == FlowResultType.ABORT
|
||||
assert result2["reason"] == "no_services_found"
|
||||
assert len(mock_setup_entry.mock_calls) == 0
|
||||
|
||||
@ -130,7 +126,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None:
|
||||
FAKE_DATA,
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
|
||||
@ -148,7 +144,7 @@ async def test_form_network_issue(hass: HomeAssistant) -> None:
|
||||
FAKE_DATA,
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -176,7 +172,7 @@ async def test_reauth(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == TEST_USERNAME
|
||||
assert result2["data"] == FAKE_DATA
|
||||
|
||||
|
@ -6,11 +6,7 @@ from homeassistant import config_entries
|
||||
from homeassistant.components import zeroconf
|
||||
from homeassistant.components.baf.const import DOMAIN
|
||||
from homeassistant.const import CONF_IP_ADDRESS
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import MOCK_NAME, MOCK_UUID, MockBAFDevice
|
||||
|
||||
@ -45,7 +41,7 @@ async def test_form_user(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == MOCK_NAME
|
||||
assert result2["data"] == {CONF_IP_ADDRESS: "127.0.0.1"}
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
@ -63,7 +59,7 @@ async def test_form_cannot_connect(hass):
|
||||
{CONF_IP_ADDRESS: "127.0.0.1"},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {CONF_IP_ADDRESS: "cannot_connect"}
|
||||
|
||||
|
||||
@ -79,7 +75,7 @@ async def test_form_unknown_exception(hass):
|
||||
{CONF_IP_ADDRESS: "127.0.0.1"},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "unknown"}
|
||||
|
||||
|
||||
@ -99,7 +95,7 @@ async def test_zeroconf_discovery(hass):
|
||||
type="mock_type",
|
||||
),
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
with patch(
|
||||
@ -137,7 +133,7 @@ async def test_zeroconf_updates_existing_ip(hass):
|
||||
type="mock_type",
|
||||
),
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
assert entry.data[CONF_IP_ADDRESS] == "127.0.0.1"
|
||||
|
||||
@ -157,7 +153,7 @@ async def test_zeroconf_rejects_ipv6(hass):
|
||||
type="mock_type",
|
||||
),
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "ipv6_not_supported"
|
||||
|
||||
|
||||
@ -176,7 +172,7 @@ async def test_user_flow_is_not_blocked_by_discovery(hass):
|
||||
type="mock_type",
|
||||
),
|
||||
)
|
||||
assert discovery_result["type"] == RESULT_TYPE_FORM
|
||||
assert discovery_result["type"] == FlowResultType.FORM
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
@ -194,7 +190,7 @@ async def test_user_flow_is_not_blocked_by_discovery(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == MOCK_NAME
|
||||
assert result2["data"] == {CONF_IP_ADDRESS: "127.0.0.1"}
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
@ -6,11 +6,7 @@ from homeassistant.components.balboa.const import CONF_SYNC_TIME, DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.const import CONF_HOST
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -25,7 +21,7 @@ async def test_form(hass: HomeAssistant, client: MagicMock) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
@ -41,7 +37,7 @@ async def test_form(hass: HomeAssistant, client: MagicMock) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["data"] == TEST_DATA
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
||||
@ -62,7 +58,7 @@ async def test_form_cannot_connect(hass: HomeAssistant, client: MagicMock) -> No
|
||||
TEST_DATA,
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -82,7 +78,7 @@ async def test_unknown_error(hass: HomeAssistant, client: MagicMock) -> None:
|
||||
TEST_DATA,
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "unknown"}
|
||||
|
||||
|
||||
@ -94,7 +90,7 @@ async def test_already_configured(hass: HomeAssistant, client: MagicMock) -> Non
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == SOURCE_USER
|
||||
|
||||
with patch(
|
||||
@ -110,7 +106,7 @@ async def test_already_configured(hass: HomeAssistant, client: MagicMock) -> Non
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_ABORT
|
||||
assert result2["type"] == FlowResultType.ABORT
|
||||
assert result2["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -11,11 +11,7 @@ from homeassistant.components.canary.const import (
|
||||
)
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.const import CONF_TIMEOUT
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import USER_INPUT, _patch_async_setup, _patch_async_setup_entry, init_integration
|
||||
|
||||
@ -26,7 +22,7 @@ async def test_user_form(hass, canary_config_flow):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with _patch_async_setup() as mock_setup, _patch_async_setup_entry() as mock_setup_entry:
|
||||
@ -36,7 +32,7 @@ async def test_user_form(hass, canary_config_flow):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "test-username"
|
||||
assert result["data"] == {**USER_INPUT, CONF_TIMEOUT: DEFAULT_TIMEOUT}
|
||||
|
||||
@ -57,7 +53,7 @@ async def test_user_form_cannot_connect(hass, canary_config_flow):
|
||||
USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
canary_config_flow.side_effect = ConnectTimeout()
|
||||
@ -67,7 +63,7 @@ async def test_user_form_cannot_connect(hass, canary_config_flow):
|
||||
USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -84,7 +80,7 @@ async def test_user_form_unexpected_exception(hass, canary_config_flow):
|
||||
USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "unknown"
|
||||
|
||||
|
||||
@ -97,7 +93,7 @@ async def test_user_form_single_instance_allowed(hass, canary_config_flow):
|
||||
context={"source": SOURCE_USER},
|
||||
data=USER_INPUT,
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "single_instance_allowed"
|
||||
|
||||
|
||||
@ -110,7 +106,7 @@ async def test_options_flow(hass, canary):
|
||||
assert entry.options[CONF_TIMEOUT] == DEFAULT_TIMEOUT
|
||||
|
||||
result = await hass.config_entries.options.async_init(entry.entry_id)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
with _patch_async_setup(), _patch_async_setup_entry():
|
||||
@ -120,6 +116,6 @@ async def test_options_flow(hass, canary):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"][CONF_FFMPEG_ARGUMENTS] == "-v"
|
||||
assert result["data"][CONF_TIMEOUT] == 7
|
||||
|
@ -8,11 +8,7 @@ from pycfdns.exceptions import (
|
||||
from homeassistant.components.cloudflare.const import CONF_RECORDS, DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_REAUTH, SOURCE_USER
|
||||
from homeassistant.const import CONF_API_TOKEN, CONF_SOURCE, CONF_ZONE
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import (
|
||||
ENTRY_CONFIG,
|
||||
@ -31,7 +27,7 @@ async def test_user_form(hass, cfupdate_flow):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {}
|
||||
|
||||
@ -41,7 +37,7 @@ async def test_user_form(hass, cfupdate_flow):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "zone"
|
||||
assert result["errors"] == {}
|
||||
|
||||
@ -51,7 +47,7 @@ async def test_user_form(hass, cfupdate_flow):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "records"
|
||||
assert result["errors"] is None
|
||||
|
||||
@ -62,7 +58,7 @@ async def test_user_form(hass, cfupdate_flow):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == USER_INPUT_ZONE[CONF_ZONE]
|
||||
|
||||
assert result["data"]
|
||||
@ -90,7 +86,7 @@ async def test_user_form_cannot_connect(hass, cfupdate_flow):
|
||||
USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -108,7 +104,7 @@ async def test_user_form_invalid_auth(hass, cfupdate_flow):
|
||||
USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
|
||||
@ -126,7 +122,7 @@ async def test_user_form_invalid_zone(hass, cfupdate_flow):
|
||||
USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "invalid_zone"}
|
||||
|
||||
|
||||
@ -144,7 +140,7 @@ async def test_user_form_unexpected_exception(hass, cfupdate_flow):
|
||||
USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "unknown"}
|
||||
|
||||
|
||||
@ -158,7 +154,7 @@ async def test_user_form_single_instance_allowed(hass):
|
||||
context={CONF_SOURCE: SOURCE_USER},
|
||||
data=USER_INPUT,
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "single_instance_allowed"
|
||||
|
||||
|
||||
@ -176,7 +172,7 @@ async def test_reauth_flow(hass, cfupdate_flow):
|
||||
},
|
||||
data=entry.data,
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
|
||||
with _patch_async_setup_entry() as mock_setup_entry:
|
||||
@ -186,7 +182,7 @@ async def test_reauth_flow(hass, cfupdate_flow):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "reauth_successful"
|
||||
|
||||
assert entry.data[CONF_API_TOKEN] == "other_token"
|
||||
|
@ -6,7 +6,7 @@ import pytest
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.co2signal import DOMAIN, config_flow
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_CREATE_ENTRY, RESULT_TYPE_FORM
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import VALID_PAYLOAD
|
||||
|
||||
@ -17,7 +17,7 @@ async def test_form_home(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
with patch("CO2Signal.get_latest", return_value=VALID_PAYLOAD,), patch(
|
||||
@ -33,7 +33,7 @@ async def test_form_home(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "CO2 Signal"
|
||||
assert result2["data"] == {
|
||||
"api_key": "api_key",
|
||||
@ -47,7 +47,7 @@ async def test_form_coordinates(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -57,7 +57,7 @@ async def test_form_coordinates(hass: HomeAssistant) -> None:
|
||||
"api_key": "api_key",
|
||||
},
|
||||
)
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
|
||||
with patch("CO2Signal.get_latest", return_value=VALID_PAYLOAD,), patch(
|
||||
"homeassistant.components.co2signal.async_setup_entry",
|
||||
@ -72,7 +72,7 @@ async def test_form_coordinates(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result3["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result3["title"] == "12.3, 45.6"
|
||||
assert result3["data"] == {
|
||||
"latitude": 12.3,
|
||||
@ -88,7 +88,7 @@ async def test_form_country(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -98,7 +98,7 @@ async def test_form_country(hass: HomeAssistant) -> None:
|
||||
"api_key": "api_key",
|
||||
},
|
||||
)
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
|
||||
with patch("CO2Signal.get_latest", return_value=VALID_PAYLOAD,), patch(
|
||||
"homeassistant.components.co2signal.async_setup_entry",
|
||||
@ -112,7 +112,7 @@ async def test_form_country(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result3["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result3["title"] == "fr"
|
||||
assert result3["data"] == {
|
||||
"country_code": "fr",
|
||||
@ -147,7 +147,7 @@ async def test_form_error_handling(hass: HomeAssistant, err_str, err_code) -> No
|
||||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": err_code}
|
||||
|
||||
|
||||
@ -169,7 +169,7 @@ async def test_form_error_unexpected_error(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "unknown"}
|
||||
|
||||
|
||||
@ -191,5 +191,5 @@ async def test_form_error_unexpected_data(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "unknown"}
|
||||
|
@ -5,11 +5,7 @@ from unittest.mock import AsyncMock, MagicMock
|
||||
from homeassistant.components.cpuspeed.const import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -24,7 +20,7 @@ async def test_full_user_flow(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -33,7 +29,7 @@ async def test_full_user_flow(
|
||||
user_input={},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result2.get("title") == "CPU Speed"
|
||||
assert result2.get("data") == {}
|
||||
|
||||
@ -54,7 +50,7 @@ async def test_already_configured(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_ABORT
|
||||
assert result.get("type") == FlowResultType.ABORT
|
||||
assert result.get("reason") == "already_configured"
|
||||
|
||||
assert len(mock_setup_entry.mock_calls) == 0
|
||||
@ -71,7 +67,7 @@ async def test_not_compatible(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -81,7 +77,7 @@ async def test_not_compatible(
|
||||
user_input={},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_ABORT
|
||||
assert result2.get("type") == FlowResultType.ABORT
|
||||
assert result2.get("reason") == "not_compatible"
|
||||
|
||||
assert len(mock_setup_entry.mock_calls) == 0
|
||||
|
@ -11,11 +11,7 @@ from homeassistant.components import zeroconf
|
||||
from homeassistant.components.daikin.const import KEY_MAC
|
||||
from homeassistant.config_entries import SOURCE_USER, SOURCE_ZEROCONF
|
||||
from homeassistant.const import CONF_API_KEY, CONF_HOST, CONF_PASSWORD
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -54,7 +50,7 @@ async def test_user(hass, mock_daikin):
|
||||
context={"source": SOURCE_USER},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
@ -62,7 +58,7 @@ async def test_user(hass, mock_daikin):
|
||||
context={"source": SOURCE_USER},
|
||||
data={CONF_HOST: HOST},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == HOST
|
||||
assert result["data"][CONF_HOST] == HOST
|
||||
assert result["data"][KEY_MAC] == MAC
|
||||
@ -77,7 +73,7 @@ async def test_abort_if_already_setup(hass, mock_daikin):
|
||||
data={CONF_HOST: HOST, KEY_MAC: MAC},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -100,7 +96,7 @@ async def test_device_abort(hass, mock_daikin, s_effect, reason):
|
||||
context={"source": SOURCE_USER},
|
||||
data={CONF_HOST: HOST, KEY_MAC: MAC},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": reason}
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
@ -112,7 +108,7 @@ async def test_api_password_abort(hass):
|
||||
context={"source": SOURCE_USER},
|
||||
data={CONF_HOST: HOST, CONF_API_KEY: "aa", CONF_PASSWORD: "aa"},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "api_password"}
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
@ -144,7 +140,7 @@ async def test_discovery_zeroconf(
|
||||
context={"source": source},
|
||||
data=data,
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
MockConfigEntry(domain="daikin", unique_id=unique_id).add_to_hass(hass)
|
||||
@ -154,7 +150,7 @@ async def test_discovery_zeroconf(
|
||||
data={CONF_HOST: HOST},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
@ -163,5 +159,5 @@ async def test_discovery_zeroconf(
|
||||
data=data,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_in_progress"
|
||||
|
@ -7,11 +7,7 @@ from homeassistant.components.deluge.const import DEFAULT_NAME, DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_REAUTH, SOURCE_USER
|
||||
from homeassistant.const import CONF_SOURCE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import CONF_DATA
|
||||
|
||||
@ -60,7 +56,7 @@ async def test_flow_user(hass: HomeAssistant, api):
|
||||
context={"source": SOURCE_USER},
|
||||
data=CONF_DATA,
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == DEFAULT_NAME
|
||||
assert result["data"] == CONF_DATA
|
||||
|
||||
@ -78,7 +74,7 @@ async def test_flow_user_already_configured(hass: HomeAssistant, api):
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data=CONF_DATA
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -87,7 +83,7 @@ async def test_flow_user_cannot_connect(hass: HomeAssistant, conn_error):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data=CONF_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
@ -97,7 +93,7 @@ async def test_flow_user_unknown_error(hass: HomeAssistant, unknown_error):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data=CONF_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "unknown"}
|
||||
|
||||
@ -121,13 +117,13 @@ async def test_flow_reauth(hass: HomeAssistant, api):
|
||||
data=CONF_DATA,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input=CONF_DATA,
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "reauth_successful"
|
||||
assert entry.data == CONF_DATA
|
||||
|
@ -6,7 +6,7 @@ import pytest
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.derivative.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_CREATE_ENTRY, RESULT_TYPE_FORM
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -19,7 +19,7 @@ async def test_config_flow(hass: HomeAssistant, platform) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
with patch(
|
||||
@ -39,7 +39,7 @@ async def test_config_flow(hass: HomeAssistant, platform) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "My derivative"
|
||||
assert result["data"] == {}
|
||||
assert result["options"] == {
|
||||
@ -98,7 +98,7 @@ async def test_options(hass: HomeAssistant, platform) -> None:
|
||||
await hass.async_block_till_done()
|
||||
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
schema = result["data_schema"].schema
|
||||
assert get_suggested(schema, "round") == 1.0
|
||||
@ -115,7 +115,7 @@ async def test_options(hass: HomeAssistant, platform) -> None:
|
||||
"unit_time": "h",
|
||||
},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == {
|
||||
"name": "My derivative",
|
||||
"round": 2.0,
|
||||
|
@ -16,11 +16,7 @@ from homeassistant.components.devolo_home_network.const import (
|
||||
)
|
||||
from homeassistant.const import CONF_BASE, CONF_IP_ADDRESS, CONF_NAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from .const import DISCOVERY_INFO, DISCOVERY_INFO_WRONG_DEVICE, IP
|
||||
|
||||
@ -30,7 +26,7 @@ async def test_form(hass: HomeAssistant, info: dict[str, Any]):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
@ -45,7 +41,7 @@ async def test_form(hass: HomeAssistant, info: dict[str, Any]):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["result"].unique_id == info["serial_number"]
|
||||
assert result2["title"] == info["title"]
|
||||
assert result2["data"] == {
|
||||
@ -75,7 +71,7 @@ async def test_form_error(hass: HomeAssistant, exception_type, expected_error):
|
||||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {CONF_BASE: expected_error}
|
||||
|
||||
|
||||
@ -88,7 +84,7 @@ async def test_zeroconf(hass: HomeAssistant):
|
||||
)
|
||||
|
||||
assert result["step_id"] == "zeroconf_confirm"
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["description_placeholders"] == {"host_name": "test"}
|
||||
|
||||
context = next(
|
||||
@ -125,7 +121,7 @@ async def test_abort_zeroconf_wrong_device(hass: HomeAssistant):
|
||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||
data=DISCOVERY_INFO_WRONG_DEVICE,
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "home_control"
|
||||
|
||||
|
||||
@ -158,7 +154,7 @@ async def test_abort_if_configued(hass: HomeAssistant):
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result2["type"] == RESULT_TYPE_ABORT
|
||||
assert result2["type"] == FlowResultType.ABORT
|
||||
assert result2["reason"] == "already_configured"
|
||||
|
||||
# Abort on concurrent zeroconf discovery flow
|
||||
@ -167,7 +163,7 @@ async def test_abort_if_configued(hass: HomeAssistant):
|
||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||
data=DISCOVERY_INFO,
|
||||
)
|
||||
assert result3["type"] == RESULT_TYPE_ABORT
|
||||
assert result3["type"] == FlowResultType.ABORT
|
||||
assert result3["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -9,11 +9,7 @@ from homeassistant.components.ssdp import ATTR_UPNP_SERIAL
|
||||
from homeassistant.config_entries import SOURCE_SSDP, SOURCE_USER
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_SOURCE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.components.directv import (
|
||||
HOST,
|
||||
@ -35,7 +31,7 @@ async def test_show_user_form(hass: HomeAssistant) -> None:
|
||||
)
|
||||
|
||||
assert result["step_id"] == "user"
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
|
||||
|
||||
async def test_show_ssdp_form(
|
||||
@ -49,7 +45,7 @@ async def test_show_ssdp_form(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_SSDP}, data=discovery_info
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "ssdp_confirm"
|
||||
assert result["description_placeholders"] == {CONF_NAME: HOST}
|
||||
|
||||
@ -67,7 +63,7 @@ async def test_cannot_connect(
|
||||
data=user_input,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
@ -85,7 +81,7 @@ async def test_ssdp_cannot_connect(
|
||||
data=discovery_info,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "cannot_connect"
|
||||
|
||||
|
||||
@ -102,7 +98,7 @@ async def test_ssdp_confirm_cannot_connect(
|
||||
data=discovery_info,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "cannot_connect"
|
||||
|
||||
|
||||
@ -119,7 +115,7 @@ async def test_user_device_exists_abort(
|
||||
data=user_input,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -136,7 +132,7 @@ async def test_ssdp_device_exists_abort(
|
||||
data=discovery_info,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -154,7 +150,7 @@ async def test_ssdp_with_receiver_id_device_exists_abort(
|
||||
data=discovery_info,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -173,7 +169,7 @@ async def test_unknown_error(
|
||||
data=user_input,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "unknown"
|
||||
|
||||
|
||||
@ -192,7 +188,7 @@ async def test_ssdp_unknown_error(
|
||||
data=discovery_info,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "unknown"
|
||||
|
||||
|
||||
@ -211,7 +207,7 @@ async def test_ssdp_confirm_unknown_error(
|
||||
data=discovery_info,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "unknown"
|
||||
|
||||
|
||||
@ -226,7 +222,7 @@ async def test_full_user_flow_implementation(
|
||||
context={CONF_SOURCE: SOURCE_USER},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
user_input = MOCK_USER_INPUT.copy()
|
||||
@ -236,7 +232,7 @@ async def test_full_user_flow_implementation(
|
||||
user_input=user_input,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == HOST
|
||||
|
||||
assert result["data"]
|
||||
@ -255,7 +251,7 @@ async def test_full_ssdp_flow_implementation(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_SSDP}, data=discovery_info
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "ssdp_confirm"
|
||||
assert result["description_placeholders"] == {CONF_NAME: HOST}
|
||||
|
||||
@ -263,7 +259,7 @@ async def test_full_ssdp_flow_implementation(
|
||||
result["flow_id"], user_input={}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == HOST
|
||||
|
||||
assert result["data"]
|
||||
|
@ -18,11 +18,7 @@ from homeassistant.components.dnsip.const import (
|
||||
)
|
||||
from homeassistant.const import CONF_NAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -66,7 +62,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "home-assistant.io"
|
||||
assert result2["data"] == {
|
||||
"hostname": "home-assistant.io",
|
||||
@ -108,7 +104,7 @@ async def test_form_adv(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "home-assistant.io"
|
||||
assert result2["data"] == {
|
||||
"hostname": "home-assistant.io",
|
||||
@ -141,7 +137,7 @@ async def test_form_error(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["step_id"] == "user"
|
||||
assert result2["errors"] == {"base": "invalid_hostname"}
|
||||
|
||||
@ -183,7 +179,7 @@ async def test_flow_already_exist(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_ABORT
|
||||
assert result2["type"] == FlowResultType.ABORT
|
||||
assert result2["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -217,7 +213,7 @@ async def test_options_flow(hass: HomeAssistant) -> None:
|
||||
|
||||
result = await hass.config_entries.options.async_init(entry.entry_id)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
@ -228,7 +224,7 @@ async def test_options_flow(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == {
|
||||
"resolver": "8.8.8.8",
|
||||
"resolver_ipv6": "2001:4860:4860::8888",
|
||||
@ -287,7 +283,7 @@ async def test_options_error(hass: HomeAssistant, p_input: dict[str, str]) -> No
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["step_id"] == "init"
|
||||
if p_input[CONF_IPV4]:
|
||||
assert result2["errors"] == {"resolver": "invalid_resolver"}
|
||||
|
@ -7,11 +7,7 @@ from pyeconet.errors import InvalidCredentialsError, PyeconetError
|
||||
from homeassistant.components.econet import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -22,7 +18,7 @@ async def test_bad_credentials(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == SOURCE_USER
|
||||
|
||||
with patch(
|
||||
@ -39,7 +35,7 @@ async def test_bad_credentials(hass):
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {
|
||||
"base": "invalid_auth",
|
||||
@ -52,7 +48,7 @@ async def test_generic_error_from_library(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == SOURCE_USER
|
||||
|
||||
with patch(
|
||||
@ -69,7 +65,7 @@ async def test_generic_error_from_library(hass):
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {
|
||||
"base": "cannot_connect",
|
||||
@ -82,7 +78,7 @@ async def test_auth_worked(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == SOURCE_USER
|
||||
|
||||
with patch(
|
||||
@ -99,7 +95,7 @@ async def test_auth_worked(hass):
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == {
|
||||
CONF_EMAIL: "admin@localhost.com",
|
||||
CONF_PASSWORD: "password0",
|
||||
@ -119,7 +115,7 @@ async def test_already_configured(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == SOURCE_USER
|
||||
|
||||
with patch(
|
||||
@ -136,5 +132,5 @@ async def test_already_configured(hass):
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
@ -7,11 +7,7 @@ from homeassistant.components.efergy.const import DEFAULT_NAME, DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_REAUTH, SOURCE_USER
|
||||
from homeassistant.const import CONF_API_KEY, CONF_SOURCE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import CONF_DATA, HID, _patch_efergy, _patch_efergy_status, create_entry
|
||||
|
||||
@ -27,14 +23,14 @@ async def test_flow_user(hass: HomeAssistant):
|
||||
DOMAIN,
|
||||
context={CONF_SOURCE: SOURCE_USER},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input=CONF_DATA,
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == DEFAULT_NAME
|
||||
assert result["data"] == CONF_DATA
|
||||
assert result["result"].unique_id == HID
|
||||
@ -47,7 +43,7 @@ async def test_flow_user_cannot_connect(hass: HomeAssistant):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data=CONF_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"]["base"] == "cannot_connect"
|
||||
|
||||
@ -59,7 +55,7 @@ async def test_flow_user_invalid_auth(hass: HomeAssistant):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data=CONF_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"]["base"] == "invalid_auth"
|
||||
|
||||
@ -71,7 +67,7 @@ async def test_flow_user_unknown(hass: HomeAssistant):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data=CONF_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"]["base"] == "unknown"
|
||||
|
||||
@ -90,7 +86,7 @@ async def test_flow_reauth(hass: HomeAssistant):
|
||||
data=CONF_DATA,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
new_conf = {CONF_API_KEY: "1234567890"}
|
||||
@ -98,6 +94,6 @@ async def test_flow_reauth(hass: HomeAssistant):
|
||||
result["flow_id"],
|
||||
user_input=new_conf,
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "reauth_successful"
|
||||
assert entry.data == new_conf
|
||||
|
@ -1,11 +1,7 @@
|
||||
"""Test the Eight Sleep config flow."""
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.eight_sleep.const import DOMAIN
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
|
||||
async def test_form(hass) -> None:
|
||||
@ -13,7 +9,7 @@ async def test_form(hass) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -24,7 +20,7 @@ async def test_form(hass) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "test-username"
|
||||
assert result2["data"] == {
|
||||
"username": "test-username",
|
||||
@ -37,7 +33,7 @@ async def test_form_invalid_auth(hass, token_error) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -48,7 +44,7 @@ async def test_form_invalid_auth(hass, token_error) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -63,7 +59,7 @@ async def test_import(hass) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "test-username"
|
||||
assert result["data"] == {
|
||||
"username": "test-username",
|
||||
@ -81,5 +77,5 @@ async def test_import_invalid_auth(hass, token_error) -> None:
|
||||
"password": "bad-password",
|
||||
},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "cannot_connect"
|
||||
|
@ -8,11 +8,7 @@ from homeassistant.components.elgato.const import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_USER, SOURCE_ZEROCONF
|
||||
from homeassistant.const import CONF_HOST, CONF_MAC, CONF_PORT, CONF_SOURCE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -28,7 +24,7 @@ async def test_full_user_flow_implementation(
|
||||
context={"source": SOURCE_USER},
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -36,7 +32,7 @@ async def test_full_user_flow_implementation(
|
||||
result["flow_id"], user_input={CONF_HOST: "127.0.0.1", CONF_PORT: 9123}
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result2.get("title") == "CN11A1A00001"
|
||||
assert result2.get("data") == {
|
||||
CONF_HOST: "127.0.0.1",
|
||||
@ -72,7 +68,7 @@ async def test_full_zeroconf_flow_implementation(
|
||||
|
||||
assert result.get("description_placeholders") == {"serial_number": "CN11A1A00001"}
|
||||
assert result.get("step_id") == "zeroconf_confirm"
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert "flow_id" in result
|
||||
|
||||
progress = hass.config_entries.flow.async_progress()
|
||||
@ -85,7 +81,7 @@ async def test_full_zeroconf_flow_implementation(
|
||||
result["flow_id"], user_input={}
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result2.get("title") == "CN11A1A00001"
|
||||
assert result2.get("data") == {
|
||||
CONF_HOST: "127.0.0.1",
|
||||
@ -111,7 +107,7 @@ async def test_connection_error(
|
||||
data={CONF_HOST: "127.0.0.1", CONF_PORT: 9123},
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("errors") == {"base": "cannot_connect"}
|
||||
assert result.get("step_id") == "user"
|
||||
|
||||
@ -137,7 +133,7 @@ async def test_zeroconf_connection_error(
|
||||
)
|
||||
|
||||
assert result.get("reason") == "cannot_connect"
|
||||
assert result.get("type") == RESULT_TYPE_ABORT
|
||||
assert result.get("type") == FlowResultType.ABORT
|
||||
|
||||
|
||||
async def test_user_device_exists_abort(
|
||||
@ -153,7 +149,7 @@ async def test_user_device_exists_abort(
|
||||
data={CONF_HOST: "127.0.0.1", CONF_PORT: 9123},
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_ABORT
|
||||
assert result.get("type") == FlowResultType.ABORT
|
||||
assert result.get("reason") == "already_configured"
|
||||
|
||||
|
||||
@ -178,7 +174,7 @@ async def test_zeroconf_device_exists_abort(
|
||||
),
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_ABORT
|
||||
assert result.get("type") == FlowResultType.ABORT
|
||||
assert result.get("reason") == "already_configured"
|
||||
|
||||
entries = hass.config_entries.async_entries(DOMAIN)
|
||||
@ -199,7 +195,7 @@ async def test_zeroconf_device_exists_abort(
|
||||
),
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_ABORT
|
||||
assert result.get("type") == FlowResultType.ABORT
|
||||
assert result.get("reason") == "already_configured"
|
||||
|
||||
entries = hass.config_entries.async_entries(DOMAIN)
|
||||
@ -227,7 +223,7 @@ async def test_zeroconf_during_onboarding(
|
||||
),
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result.get("title") == "CN11A1A00001"
|
||||
assert result.get("data") == {
|
||||
CONF_HOST: "127.0.0.1",
|
||||
|
@ -8,7 +8,7 @@ from homeassistant import config_entries
|
||||
from homeassistant.components import dhcp
|
||||
from homeassistant.components.elkm1.const import DOMAIN
|
||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_ABORT, RESULT_TYPE_FORM
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import (
|
||||
ELK_DISCOVERY,
|
||||
@ -47,7 +47,7 @@ async def test_discovery_ignored_entry(hass):
|
||||
data=ELK_DISCOVERY_INFO,
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -242,7 +242,7 @@ async def test_form_user_with_insecure_elk_times_out(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -280,7 +280,7 @@ async def test_form_user_with_secure_elk_no_discovery_ip_already_configured(hass
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_ABORT
|
||||
assert result2["type"] == FlowResultType.ABORT
|
||||
assert result2["reason"] == "address_already_configured"
|
||||
|
||||
|
||||
@ -961,7 +961,7 @@ async def test_form_import_existing(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "address_already_configured"
|
||||
|
||||
|
||||
@ -989,7 +989,7 @@ async def test_discovered_by_dhcp_or_discovery_mac_address_mismatch_host_already
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
assert config_entry.unique_id == "cc:cc:cc:cc:cc:cc"
|
||||
@ -1018,7 +1018,7 @@ async def test_discovered_by_dhcp_or_discovery_adds_missing_unique_id(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
assert config_entry.unique_id == MOCK_MAC
|
||||
@ -1034,7 +1034,7 @@ async def test_discovered_by_discovery_and_dhcp(hass):
|
||||
data=ELK_DISCOVERY_INFO,
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with _patch_discovery(), _patch_elk():
|
||||
@ -1044,7 +1044,7 @@ async def test_discovered_by_discovery_and_dhcp(hass):
|
||||
data=DHCP_DISCOVERY,
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result2["type"] == RESULT_TYPE_ABORT
|
||||
assert result2["type"] == FlowResultType.ABORT
|
||||
assert result2["reason"] == "already_in_progress"
|
||||
|
||||
with _patch_discovery(), _patch_elk():
|
||||
@ -1058,7 +1058,7 @@ async def test_discovered_by_discovery_and_dhcp(hass):
|
||||
),
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result3["type"] == RESULT_TYPE_ABORT
|
||||
assert result3["type"] == FlowResultType.ABORT
|
||||
assert result3["reason"] == "already_in_progress"
|
||||
|
||||
|
||||
@ -1073,7 +1073,7 @@ async def test_discovered_by_discovery(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "discovered_connection"
|
||||
assert result["errors"] == {}
|
||||
|
||||
@ -1118,7 +1118,7 @@ async def test_discovered_by_discovery_non_standard_port(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "discovered_connection"
|
||||
assert result["errors"] == {}
|
||||
|
||||
@ -1169,7 +1169,7 @@ async def test_discovered_by_discovery_url_already_configured(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -1182,7 +1182,7 @@ async def test_discovered_by_dhcp_udp_responds(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "discovered_connection"
|
||||
assert result["errors"] == {}
|
||||
|
||||
@ -1225,7 +1225,7 @@ async def test_discovered_by_dhcp_udp_responds_with_nonsecure_port(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "discovered_connection"
|
||||
assert result["errors"] == {}
|
||||
|
||||
@ -1275,7 +1275,7 @@ async def test_discovered_by_dhcp_udp_responds_existing_config_entry(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "discovered_connection"
|
||||
assert result["errors"] == {}
|
||||
|
||||
@ -1315,5 +1315,5 @@ async def test_discovered_by_dhcp_no_udp_response(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "cannot_connect"
|
||||
|
@ -15,11 +15,7 @@ from homeassistant import config_entries
|
||||
from homeassistant.components import dhcp, zeroconf
|
||||
from homeassistant.components.esphome import CONF_NOISE_PSK, DOMAIN, DomainData
|
||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -66,7 +62,7 @@ async def test_user_connection_works(hass, mock_client, mock_zeroconf):
|
||||
data=None,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
mock_client.device_info = AsyncMock(return_value=MockDeviceInfo(False, "test"))
|
||||
@ -77,7 +73,7 @@ async def test_user_connection_works(hass, mock_client, mock_zeroconf):
|
||||
data={CONF_HOST: "127.0.0.1", CONF_PORT: 80},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == {
|
||||
CONF_HOST: "127.0.0.1",
|
||||
CONF_PORT: 80,
|
||||
@ -109,7 +105,7 @@ async def test_user_resolve_error(hass, mock_client, mock_zeroconf):
|
||||
data={CONF_HOST: "127.0.0.1", CONF_PORT: 6053},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "resolve_error"}
|
||||
|
||||
@ -128,7 +124,7 @@ async def test_user_connection_error(hass, mock_client, mock_zeroconf):
|
||||
data={CONF_HOST: "127.0.0.1", CONF_PORT: 6053},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "connection_error"}
|
||||
|
||||
@ -147,14 +143,14 @@ async def test_user_with_password(hass, mock_client, mock_zeroconf):
|
||||
data={CONF_HOST: "127.0.0.1", CONF_PORT: 6053},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "authenticate"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={CONF_PASSWORD: "password1"}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == {
|
||||
CONF_HOST: "127.0.0.1",
|
||||
CONF_PORT: 6053,
|
||||
@ -174,7 +170,7 @@ async def test_user_invalid_password(hass, mock_client, mock_zeroconf):
|
||||
data={CONF_HOST: "127.0.0.1", CONF_PORT: 6053},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "authenticate"
|
||||
|
||||
mock_client.connect.side_effect = InvalidAuthAPIError
|
||||
@ -183,7 +179,7 @@ async def test_user_invalid_password(hass, mock_client, mock_zeroconf):
|
||||
result["flow_id"], user_input={CONF_PASSWORD: "invalid"}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "authenticate"
|
||||
assert result["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
@ -198,7 +194,7 @@ async def test_login_connection_error(hass, mock_client, mock_zeroconf):
|
||||
data={CONF_HOST: "127.0.0.1", CONF_PORT: 6053},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "authenticate"
|
||||
|
||||
mock_client.connect.side_effect = APIConnectionError
|
||||
@ -207,7 +203,7 @@ async def test_login_connection_error(hass, mock_client, mock_zeroconf):
|
||||
result["flow_id"], user_input={CONF_PASSWORD: "valid"}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "authenticate"
|
||||
assert result["errors"] == {"base": "connection_error"}
|
||||
|
||||
@ -233,7 +229,7 @@ async def test_discovery_initiation(hass, mock_client, mock_zeroconf):
|
||||
flow["flow_id"], user_input={}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "test8266"
|
||||
assert result["data"][CONF_HOST] == "192.168.43.183"
|
||||
assert result["data"][CONF_PORT] == 6053
|
||||
@ -264,7 +260,7 @@ async def test_discovery_already_configured_hostname(hass, mock_client):
|
||||
"esphome", context={"source": config_entries.SOURCE_ZEROCONF}, data=service_info
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
assert entry.unique_id == "test8266"
|
||||
@ -292,7 +288,7 @@ async def test_discovery_already_configured_ip(hass, mock_client):
|
||||
"esphome", context={"source": config_entries.SOURCE_ZEROCONF}, data=service_info
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
assert entry.unique_id == "test8266"
|
||||
@ -324,7 +320,7 @@ async def test_discovery_already_configured_name(hass, mock_client):
|
||||
"esphome", context={"source": config_entries.SOURCE_ZEROCONF}, data=service_info
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
assert entry.unique_id == "test8266"
|
||||
@ -348,13 +344,13 @@ async def test_discovery_duplicate_data(hass, mock_client):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
"esphome", data=service_info, context={"source": config_entries.SOURCE_ZEROCONF}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "discovery_confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
"esphome", data=service_info, context={"source": config_entries.SOURCE_ZEROCONF}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_in_progress"
|
||||
|
||||
|
||||
@ -380,7 +376,7 @@ async def test_discovery_updates_unique_id(hass, mock_client):
|
||||
"esphome", context={"source": config_entries.SOURCE_ZEROCONF}, data=service_info
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
assert entry.unique_id == "test8266"
|
||||
@ -396,7 +392,7 @@ async def test_user_requires_psk(hass, mock_client, mock_zeroconf):
|
||||
data={CONF_HOST: "127.0.0.1", CONF_PORT: 6053},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "encryption_key"
|
||||
assert result["errors"] == {}
|
||||
|
||||
@ -416,7 +412,7 @@ async def test_encryption_key_valid_psk(hass, mock_client, mock_zeroconf):
|
||||
data={CONF_HOST: "127.0.0.1", CONF_PORT: 6053},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "encryption_key"
|
||||
|
||||
mock_client.device_info = AsyncMock(return_value=MockDeviceInfo(False, "test"))
|
||||
@ -424,7 +420,7 @@ async def test_encryption_key_valid_psk(hass, mock_client, mock_zeroconf):
|
||||
result["flow_id"], user_input={CONF_NOISE_PSK: VALID_NOISE_PSK}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == {
|
||||
CONF_HOST: "127.0.0.1",
|
||||
CONF_PORT: 6053,
|
||||
@ -445,7 +441,7 @@ async def test_encryption_key_invalid_psk(hass, mock_client, mock_zeroconf):
|
||||
data={CONF_HOST: "127.0.0.1", CONF_PORT: 6053},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "encryption_key"
|
||||
|
||||
mock_client.device_info.side_effect = InvalidEncryptionKeyAPIError
|
||||
@ -453,7 +449,7 @@ async def test_encryption_key_invalid_psk(hass, mock_client, mock_zeroconf):
|
||||
result["flow_id"], user_input={CONF_NOISE_PSK: INVALID_NOISE_PSK}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "encryption_key"
|
||||
assert result["errors"] == {"base": "invalid_psk"}
|
||||
assert mock_client.noise_psk == INVALID_NOISE_PSK
|
||||
@ -475,7 +471,7 @@ async def test_reauth_initiation(hass, mock_client, mock_zeroconf):
|
||||
"unique_id": entry.unique_id,
|
||||
},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
|
||||
|
||||
@ -501,7 +497,7 @@ async def test_reauth_confirm_valid(hass, mock_client, mock_zeroconf):
|
||||
result["flow_id"], user_input={CONF_NOISE_PSK: VALID_NOISE_PSK}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "reauth_successful"
|
||||
assert entry.data[CONF_NOISE_PSK] == VALID_NOISE_PSK
|
||||
|
||||
@ -528,7 +524,7 @@ async def test_reauth_confirm_invalid(hass, mock_client, mock_zeroconf):
|
||||
result["flow_id"], user_input={CONF_NOISE_PSK: INVALID_NOISE_PSK}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
assert result["errors"]
|
||||
assert result["errors"]["base"] == "invalid_psk"
|
||||
@ -556,7 +552,7 @@ async def test_discovery_dhcp_updates_host(hass, mock_client):
|
||||
"esphome", context={"source": config_entries.SOURCE_DHCP}, data=service_info
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
assert entry.unique_id == "test8266"
|
||||
@ -585,7 +581,7 @@ async def test_discovery_dhcp_no_changes(hass, mock_client):
|
||||
"esphome", context={"source": config_entries.SOURCE_DHCP}, data=service_info
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
assert entry.unique_id == "test8266"
|
||||
|
@ -7,7 +7,7 @@ import aiohttp
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.evil_genius_labs.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_CREATE_ENTRY, RESULT_TYPE_FORM
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
|
||||
async def test_form(
|
||||
@ -17,7 +17,7 @@ async def test_form(
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
with patch(
|
||||
@ -41,7 +41,7 @@ async def test_form(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "Fibonacci256-23D4"
|
||||
assert result2["data"] == {
|
||||
"host": "1.1.1.1",
|
||||
@ -66,7 +66,7 @@ async def test_form_cannot_connect(hass: HomeAssistant, caplog) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
assert "Unable to connect" in caplog.text
|
||||
|
||||
@ -88,7 +88,7 @@ async def test_form_timeout(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "timeout"}
|
||||
|
||||
|
||||
@ -109,5 +109,5 @@ async def test_form_unknown(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "unknown"}
|
||||
|
@ -29,11 +29,7 @@ from homeassistant.const import (
|
||||
CONF_URL,
|
||||
CONF_USERNAME,
|
||||
)
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import (
|
||||
DISCOVERY_INFO,
|
||||
@ -50,7 +46,7 @@ async def test_user_form(hass, ezviz_config_flow):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {}
|
||||
|
||||
@ -61,7 +57,7 @@ async def test_user_form(hass, ezviz_config_flow):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "test-username"
|
||||
assert result["data"] == {**USER_INPUT}
|
||||
|
||||
@ -70,7 +66,7 @@ async def test_user_form(hass, ezviz_config_flow):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured_account"
|
||||
|
||||
|
||||
@ -85,7 +81,7 @@ async def test_user_custom_url(hass, ezviz_config_flow):
|
||||
{CONF_USERNAME: "test-user", CONF_PASSWORD: "test-pass", CONF_URL: "customize"},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user_custom_url"
|
||||
assert result["errors"] == {}
|
||||
|
||||
@ -95,7 +91,7 @@ async def test_user_custom_url(hass, ezviz_config_flow):
|
||||
{CONF_URL: "test-user"},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == {
|
||||
CONF_PASSWORD: "test-pass",
|
||||
CONF_TYPE: ATTR_TYPE_CLOUD,
|
||||
@ -112,7 +108,7 @@ async def test_step_discovery_abort_if_cloud_account_missing(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_INTEGRATION_DISCOVERY}, data=DISCOVERY_INFO
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
assert result["errors"] == {}
|
||||
|
||||
@ -125,7 +121,7 @@ async def test_step_discovery_abort_if_cloud_account_missing(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "ezviz_cloud_account_missing"
|
||||
|
||||
|
||||
@ -139,7 +135,7 @@ async def test_async_step_integration_discovery(
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_INTEGRATION_DISCOVERY}, data=DISCOVERY_INFO
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
assert result["errors"] == {}
|
||||
|
||||
@ -153,7 +149,7 @@ async def test_async_step_integration_discovery(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == {
|
||||
CONF_PASSWORD: "test-pass",
|
||||
CONF_TYPE: ATTR_TYPE_CAMERA,
|
||||
@ -172,7 +168,7 @@ async def test_options_flow(hass):
|
||||
assert entry.options[CONF_TIMEOUT] == DEFAULT_TIMEOUT
|
||||
|
||||
result = await hass.config_entries.options.async_init(entry.entry_id)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
assert result["errors"] is None
|
||||
|
||||
@ -182,7 +178,7 @@ async def test_options_flow(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"][CONF_FFMPEG_ARGUMENTS] == "/H.264"
|
||||
assert result["data"][CONF_TIMEOUT] == 25
|
||||
|
||||
@ -202,7 +198,7 @@ async def test_user_form_exception(hass, ezviz_config_flow):
|
||||
USER_INPUT_VALIDATE,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
@ -213,7 +209,7 @@ async def test_user_form_exception(hass, ezviz_config_flow):
|
||||
USER_INPUT_VALIDATE,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "invalid_host"}
|
||||
|
||||
@ -224,7 +220,7 @@ async def test_user_form_exception(hass, ezviz_config_flow):
|
||||
USER_INPUT_VALIDATE,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
@ -235,7 +231,7 @@ async def test_user_form_exception(hass, ezviz_config_flow):
|
||||
USER_INPUT_VALIDATE,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "unknown"
|
||||
|
||||
|
||||
@ -252,7 +248,7 @@ async def test_discover_exception_step1(
|
||||
context={"source": SOURCE_INTEGRATION_DISCOVERY},
|
||||
data={ATTR_SERIAL: "C66666", CONF_IP_ADDRESS: "test-ip"},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
assert result["errors"] == {}
|
||||
|
||||
@ -267,7 +263,7 @@ async def test_discover_exception_step1(
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
assert result["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
@ -281,7 +277,7 @@ async def test_discover_exception_step1(
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
assert result["errors"] == {"base": "invalid_host"}
|
||||
|
||||
@ -295,7 +291,7 @@ async def test_discover_exception_step1(
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
assert result["errors"] == {"base": "invalid_host"}
|
||||
|
||||
@ -309,7 +305,7 @@ async def test_discover_exception_step1(
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "unknown"
|
||||
|
||||
|
||||
@ -327,7 +323,7 @@ async def test_discover_exception_step3(
|
||||
context={"source": SOURCE_INTEGRATION_DISCOVERY},
|
||||
data={ATTR_SERIAL: "C66666", CONF_IP_ADDRESS: "test-ip"},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
assert result["errors"] == {}
|
||||
|
||||
@ -342,7 +338,7 @@ async def test_discover_exception_step3(
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
assert result["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
@ -356,7 +352,7 @@ async def test_discover_exception_step3(
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
assert result["errors"] == {"base": "invalid_host"}
|
||||
|
||||
@ -370,7 +366,7 @@ async def test_discover_exception_step3(
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "unknown"
|
||||
|
||||
|
||||
@ -390,7 +386,7 @@ async def test_user_custom_url_exception(hass, ezviz_config_flow):
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user_custom_url"
|
||||
assert result["errors"] == {}
|
||||
|
||||
@ -399,7 +395,7 @@ async def test_user_custom_url_exception(hass, ezviz_config_flow):
|
||||
{CONF_URL: "test-user"},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user_custom_url"
|
||||
assert result["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
@ -410,7 +406,7 @@ async def test_user_custom_url_exception(hass, ezviz_config_flow):
|
||||
{CONF_URL: "test-user"},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user_custom_url"
|
||||
assert result["errors"] == {"base": "invalid_host"}
|
||||
|
||||
@ -421,7 +417,7 @@ async def test_user_custom_url_exception(hass, ezviz_config_flow):
|
||||
{CONF_URL: "test-user"},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user_custom_url"
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
@ -432,5 +428,5 @@ async def test_user_custom_url_exception(hass, ezviz_config_flow):
|
||||
{CONF_URL: "test-user"},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "unknown"
|
||||
|
@ -5,11 +5,7 @@ from homeassistant.components.filesize.const import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.const import CONF_FILE_PATH
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import TEST_DIR, TEST_FILE, TEST_FILE_NAME, async_create_file
|
||||
|
||||
@ -24,7 +20,7 @@ async def test_full_user_flow(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -33,7 +29,7 @@ async def test_full_user_flow(hass: HomeAssistant) -> None:
|
||||
user_input={CONF_FILE_PATH: TEST_FILE},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result2.get("title") == TEST_FILE_NAME
|
||||
assert result2.get("data") == {CONF_FILE_PATH: TEST_FILE}
|
||||
|
||||
@ -51,7 +47,7 @@ async def test_unique_path(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data={CONF_FILE_PATH: TEST_FILE}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_ABORT
|
||||
assert result.get("type") == FlowResultType.ABORT
|
||||
assert result.get("reason") == "already_configured"
|
||||
|
||||
|
||||
@ -64,7 +60,7 @@ async def test_flow_fails_on_validation(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == SOURCE_USER
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -103,7 +99,7 @@ async def test_flow_fails_on_validation(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == TEST_FILE_NAME
|
||||
assert result2["data"] == {
|
||||
CONF_FILE_PATH: TEST_FILE,
|
||||
|
@ -8,7 +8,7 @@ from homeassistant.components.fivem.config_flow import DEFAULT_PORT
|
||||
from homeassistant.components.fivem.const import DOMAIN
|
||||
from homeassistant.const import CONF_HOST, CONF_PORT
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_CREATE_ENTRY, RESULT_TYPE_FORM
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
USER_INPUT = {
|
||||
CONF_HOST: "fivem.dummyserver.com",
|
||||
@ -54,7 +54,7 @@ async def test_show_config_form(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
with patch(
|
||||
@ -79,7 +79,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == USER_INPUT[CONF_HOST]
|
||||
assert result2["data"] == USER_INPUT
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
@ -101,7 +101,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -121,7 +121,7 @@ async def test_form_invalid(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "unknown"}
|
||||
|
||||
|
||||
@ -141,5 +141,5 @@ async def test_form_invalid_game_name(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "invalid_game_name"}
|
||||
|
@ -9,11 +9,7 @@ from pytest import fixture
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.fjaraskupan.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
|
||||
@fixture(name="mock_setup_entry", autouse=True)
|
||||
@ -32,10 +28,10 @@ async def test_configure(hass: HomeAssistant, mock_setup_entry) -> None:
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "Fjäråskupan"
|
||||
assert result["data"] == {}
|
||||
|
||||
@ -51,8 +47,8 @@ async def test_scan_no_devices(hass: HomeAssistant, scanner: list[BLEDevice]) ->
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "no_devices_found"
|
||||
|
@ -24,7 +24,7 @@ from homeassistant.components.flux_led.const import (
|
||||
)
|
||||
from homeassistant.const import CONF_DEVICE, CONF_HOST, CONF_MODEL
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_ABORT, RESULT_TYPE_FORM
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import (
|
||||
DEFAULT_ENTRY_TITLE,
|
||||
@ -386,7 +386,7 @@ async def test_discovered_by_discovery_and_dhcp(hass):
|
||||
data=FLUX_DISCOVERY,
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
with _patch_discovery(), _patch_wifibulb():
|
||||
@ -396,7 +396,7 @@ async def test_discovered_by_discovery_and_dhcp(hass):
|
||||
data=DHCP_DISCOVERY,
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result2["type"] == RESULT_TYPE_ABORT
|
||||
assert result2["type"] == FlowResultType.ABORT
|
||||
assert result2["reason"] == "already_in_progress"
|
||||
|
||||
with _patch_discovery(), _patch_wifibulb():
|
||||
@ -410,7 +410,7 @@ async def test_discovered_by_discovery_and_dhcp(hass):
|
||||
),
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result3["type"] == RESULT_TYPE_ABORT
|
||||
assert result3["type"] == FlowResultType.ABORT
|
||||
assert result3["reason"] == "already_in_progress"
|
||||
|
||||
|
||||
@ -425,7 +425,7 @@ async def test_discovered_by_discovery(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
with _patch_discovery(), _patch_wifibulb(), patch(
|
||||
@ -462,7 +462,7 @@ async def test_discovered_by_dhcp_udp_responds(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
with _patch_discovery(), _patch_wifibulb(), patch(
|
||||
@ -499,7 +499,7 @@ async def test_discovered_by_dhcp_no_udp_response(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
with _patch_discovery(no_device=True), _patch_wifibulb(), patch(
|
||||
@ -529,7 +529,7 @@ async def test_discovered_by_dhcp_partial_udp_response_fallback_tcp(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
with _patch_discovery(device=FLUX_DISCOVERY_PARTIAL), _patch_wifibulb(), patch(
|
||||
@ -560,7 +560,7 @@ async def test_discovered_by_dhcp_no_udp_response_or_tcp_response(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "cannot_connect"
|
||||
|
||||
|
||||
@ -584,7 +584,7 @@ async def test_discovered_by_dhcp_or_discovery_adds_missing_unique_id(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
assert config_entry.unique_id == MAC_ADDRESS
|
||||
@ -605,7 +605,7 @@ async def test_mac_address_off_by_one_updated_via_discovery(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
assert config_entry.unique_id == MAC_ADDRESS
|
||||
@ -624,7 +624,7 @@ async def test_mac_address_off_by_one_not_updated_from_dhcp(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
assert config_entry.unique_id == MAC_ADDRESS_ONE_OFF
|
||||
@ -652,7 +652,7 @@ async def test_discovered_by_dhcp_or_discovery_mac_address_mismatch_host_already
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
assert config_entry.unique_id == MAC_ADDRESS_DIFFERENT
|
||||
|
@ -12,7 +12,7 @@ from homeassistant.components.forecast_solar.const import (
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_CREATE_ENTRY, RESULT_TYPE_FORM
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -23,7 +23,7 @@ async def test_user_flow(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -42,7 +42,7 @@ async def test_user_flow(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result2.get("title") == "Name"
|
||||
assert result2.get("data") == {
|
||||
CONF_LATITUDE: 52.42,
|
||||
@ -70,7 +70,7 @@ async def test_options_flow(
|
||||
|
||||
result = await hass.config_entries.options.async_init(mock_config_entry.entry_id)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == "init"
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -86,7 +86,7 @@ async def test_options_flow(
|
||||
},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result2.get("data") == {
|
||||
CONF_API_KEY: "solarPOWER!",
|
||||
CONF_DECLINATION: 21,
|
||||
|
@ -18,11 +18,7 @@ from homeassistant.components.ssdp import ATTR_UPNP_UDN
|
||||
from homeassistant.config_entries import SOURCE_REAUTH, SOURCE_SSDP, SOURCE_USER
|
||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from .const import (
|
||||
MOCK_FIRMWARE_INFO,
|
||||
@ -62,13 +58,13 @@ async def test_user(hass: HomeAssistant, fc_class_mock, mock_get_source_ip):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input=MOCK_USER_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"][CONF_HOST] == "fake_host"
|
||||
assert result["data"][CONF_PASSWORD] == "fake_pass"
|
||||
assert result["data"][CONF_USERNAME] == "fake_user"
|
||||
@ -113,13 +109,13 @@ async def test_user_already_configured(
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input=MOCK_USER_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"]["base"] == "already_configured"
|
||||
|
||||
@ -130,7 +126,7 @@ async def test_exception_security(hass: HomeAssistant, mock_get_source_ip):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
with patch(
|
||||
@ -142,7 +138,7 @@ async def test_exception_security(hass: HomeAssistant, mock_get_source_ip):
|
||||
result["flow_id"], user_input=MOCK_USER_DATA
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"]["base"] == ERROR_AUTH_INVALID
|
||||
|
||||
@ -153,7 +149,7 @@ async def test_exception_connection(hass: HomeAssistant, mock_get_source_ip):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
with patch(
|
||||
@ -165,7 +161,7 @@ async def test_exception_connection(hass: HomeAssistant, mock_get_source_ip):
|
||||
result["flow_id"], user_input=MOCK_USER_DATA
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"]["base"] == ERROR_CANNOT_CONNECT
|
||||
|
||||
@ -176,7 +172,7 @@ async def test_exception_unknown(hass: HomeAssistant, mock_get_source_ip):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
with patch(
|
||||
@ -188,7 +184,7 @@ async def test_exception_unknown(hass: HomeAssistant, mock_get_source_ip):
|
||||
result["flow_id"], user_input=MOCK_USER_DATA
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"]["base"] == ERROR_UNKNOWN
|
||||
|
||||
@ -226,7 +222,7 @@ async def test_reauth_successful(
|
||||
data=mock_config.data,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -237,7 +233,7 @@ async def test_reauth_successful(
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "reauth_successful"
|
||||
|
||||
assert mock_setup_entry.called
|
||||
@ -262,7 +258,7 @@ async def test_reauth_not_successful(
|
||||
data=mock_config.data,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -273,7 +269,7 @@ async def test_reauth_not_successful(
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
assert result["errors"]["base"] == "cannot_connect"
|
||||
|
||||
@ -301,7 +297,7 @@ async def test_ssdp_already_configured(
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -328,7 +324,7 @@ async def test_ssdp_already_configured_host(
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -355,7 +351,7 @@ async def test_ssdp_already_configured_host_uuid(
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -371,7 +367,7 @@ async def test_ssdp_already_in_progress_host(
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
|
||||
MOCK_NO_UNIQUE_ID = dataclasses.replace(MOCK_SSDP_DATA)
|
||||
@ -380,7 +376,7 @@ async def test_ssdp_already_in_progress_host(
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_NO_UNIQUE_ID
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_in_progress"
|
||||
|
||||
|
||||
@ -408,7 +404,7 @@ async def test_ssdp(hass: HomeAssistant, fc_class_mock, mock_get_source_ip):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -419,7 +415,7 @@ async def test_ssdp(hass: HomeAssistant, fc_class_mock, mock_get_source_ip):
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"][CONF_HOST] == MOCK_IPS["fritz.box"]
|
||||
assert result["data"][CONF_PASSWORD] == "fake_pass"
|
||||
assert result["data"][CONF_USERNAME] == "fake_user"
|
||||
@ -437,7 +433,7 @@ async def test_ssdp_exception(hass: HomeAssistant, mock_get_source_ip):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -448,7 +444,7 @@ async def test_ssdp_exception(hass: HomeAssistant, mock_get_source_ip):
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
|
||||
|
||||
@ -463,7 +459,7 @@ async def test_options_flow(hass: HomeAssistant, fc_class_mock, mock_get_source_
|
||||
side_effect=fc_class_mock,
|
||||
), patch("homeassistant.components.fritz.common.FritzBoxTools"):
|
||||
result = await hass.config_entries.options.async_init(mock_config.entry_id)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_init(mock_config.entry_id)
|
||||
@ -473,5 +469,5 @@ async def test_options_flow(hass: HomeAssistant, fc_class_mock, mock_get_source_
|
||||
CONF_CONSIDER_HOME: 37,
|
||||
},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert mock_config.options[CONF_CONSIDER_HOME] == 37
|
||||
|
@ -14,11 +14,7 @@ from homeassistant.components.ssdp import ATTR_UPNP_FRIENDLY_NAME, ATTR_UPNP_UDN
|
||||
from homeassistant.config_entries import SOURCE_REAUTH, SOURCE_SSDP, SOURCE_USER
|
||||
from homeassistant.const import CONF_DEVICES, CONF_HOST, CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from .const import CONF_FAKE_NAME, MOCK_CONFIG
|
||||
|
||||
@ -70,13 +66,13 @@ async def test_user(hass: HomeAssistant, fritz: Mock):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input=MOCK_USER_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "10.0.0.1"
|
||||
assert result["data"][CONF_HOST] == "10.0.0.1"
|
||||
assert result["data"][CONF_PASSWORD] == "fake_pass"
|
||||
@ -91,7 +87,7 @@ async def test_user_auth_failed(hass: HomeAssistant, fritz: Mock):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=MOCK_USER_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"]["base"] == "invalid_auth"
|
||||
|
||||
@ -103,7 +99,7 @@ async def test_user_not_successful(hass: HomeAssistant, fritz: Mock):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=MOCK_USER_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "no_devices_found"
|
||||
|
||||
|
||||
@ -112,13 +108,13 @@ async def test_user_already_configured(hass: HomeAssistant, fritz: Mock):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=MOCK_USER_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert not result["result"].unique_id
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=MOCK_USER_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -132,7 +128,7 @@ async def test_reauth_success(hass: HomeAssistant, fritz: Mock):
|
||||
context={"source": SOURCE_REAUTH, "entry_id": mock_config.entry_id},
|
||||
data=mock_config.data,
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -143,7 +139,7 @@ async def test_reauth_success(hass: HomeAssistant, fritz: Mock):
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "reauth_successful"
|
||||
assert mock_config.data[CONF_USERNAME] == "other_fake_user"
|
||||
assert mock_config.data[CONF_PASSWORD] == "other_fake_password"
|
||||
@ -161,7 +157,7 @@ async def test_reauth_auth_failed(hass: HomeAssistant, fritz: Mock):
|
||||
context={"source": SOURCE_REAUTH, "entry_id": mock_config.entry_id},
|
||||
data=mock_config.data,
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -172,7 +168,7 @@ async def test_reauth_auth_failed(hass: HomeAssistant, fritz: Mock):
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
assert result["errors"]["base"] == "invalid_auth"
|
||||
|
||||
@ -189,7 +185,7 @@ async def test_reauth_not_successful(hass: HomeAssistant, fritz: Mock):
|
||||
context={"source": SOURCE_REAUTH, "entry_id": mock_config.entry_id},
|
||||
data=mock_config.data,
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -200,16 +196,16 @@ async def test_reauth_not_successful(hass: HomeAssistant, fritz: Mock):
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "no_devices_found"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"test_data,expected_result",
|
||||
[
|
||||
(MOCK_SSDP_DATA["ip4_valid"], RESULT_TYPE_FORM),
|
||||
(MOCK_SSDP_DATA["ip6_valid"], RESULT_TYPE_FORM),
|
||||
(MOCK_SSDP_DATA["ip6_invalid"], RESULT_TYPE_ABORT),
|
||||
(MOCK_SSDP_DATA["ip4_valid"], FlowResultType.FORM),
|
||||
(MOCK_SSDP_DATA["ip6_valid"], FlowResultType.FORM),
|
||||
(MOCK_SSDP_DATA["ip6_invalid"], FlowResultType.ABORT),
|
||||
],
|
||||
)
|
||||
async def test_ssdp(
|
||||
@ -224,7 +220,7 @@ async def test_ssdp(
|
||||
)
|
||||
assert result["type"] == expected_result
|
||||
|
||||
if expected_result == RESULT_TYPE_ABORT:
|
||||
if expected_result == FlowResultType.ABORT:
|
||||
return
|
||||
|
||||
assert result["step_id"] == "confirm"
|
||||
@ -233,7 +229,7 @@ async def test_ssdp(
|
||||
result["flow_id"],
|
||||
user_input={CONF_PASSWORD: "fake_pass", CONF_USERNAME: "fake_user"},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == CONF_FAKE_NAME
|
||||
assert result["data"][CONF_HOST] == urlparse(test_data.ssdp_location).hostname
|
||||
assert result["data"][CONF_PASSWORD] == "fake_pass"
|
||||
@ -249,14 +245,14 @@ async def test_ssdp_no_friendly_name(hass: HomeAssistant, fritz: Mock):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_NO_NAME
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={CONF_PASSWORD: "fake_pass", CONF_USERNAME: "fake_user"},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "10.0.0.1"
|
||||
assert result["data"][CONF_HOST] == "10.0.0.1"
|
||||
assert result["data"][CONF_PASSWORD] == "fake_pass"
|
||||
@ -271,7 +267,7 @@ async def test_ssdp_auth_failed(hass: HomeAssistant, fritz: Mock):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA["ip4_valid"]
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
assert result["errors"] == {}
|
||||
|
||||
@ -279,7 +275,7 @@ async def test_ssdp_auth_failed(hass: HomeAssistant, fritz: Mock):
|
||||
result["flow_id"],
|
||||
user_input={CONF_PASSWORD: "whatever", CONF_USERNAME: "whatever"},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
assert result["errors"]["base"] == "invalid_auth"
|
||||
|
||||
@ -291,14 +287,14 @@ async def test_ssdp_not_successful(hass: HomeAssistant, fritz: Mock):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA["ip4_valid"]
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={CONF_PASSWORD: "whatever", CONF_USERNAME: "whatever"},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "no_devices_found"
|
||||
|
||||
|
||||
@ -309,14 +305,14 @@ async def test_ssdp_not_supported(hass: HomeAssistant, fritz: Mock):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA["ip4_valid"]
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={CONF_PASSWORD: "whatever", CONF_USERNAME: "whatever"},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "not_supported"
|
||||
|
||||
|
||||
@ -325,13 +321,13 @@ async def test_ssdp_already_in_progress_unique_id(hass: HomeAssistant, fritz: Mo
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA["ip4_valid"]
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA["ip4_valid"]
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_in_progress"
|
||||
|
||||
|
||||
@ -340,7 +336,7 @@ async def test_ssdp_already_in_progress_host(hass: HomeAssistant, fritz: Mock):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA["ip4_valid"]
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
|
||||
MOCK_NO_UNIQUE_ID = dataclasses.replace(MOCK_SSDP_DATA["ip4_valid"])
|
||||
@ -349,7 +345,7 @@ async def test_ssdp_already_in_progress_host(hass: HomeAssistant, fritz: Mock):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_NO_UNIQUE_ID
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_in_progress"
|
||||
|
||||
|
||||
@ -358,12 +354,12 @@ async def test_ssdp_already_configured(hass: HomeAssistant, fritz: Mock):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=MOCK_USER_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert not result["result"].unique_id
|
||||
|
||||
result2 = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_SSDP}, data=MOCK_SSDP_DATA["ip4_valid"]
|
||||
)
|
||||
assert result2["type"] == RESULT_TYPE_ABORT
|
||||
assert result2["type"] == FlowResultType.ABORT
|
||||
assert result2["reason"] == "already_configured"
|
||||
assert result["result"].unique_id == "only-a-test"
|
||||
|
@ -22,11 +22,7 @@ from homeassistant.const import (
|
||||
CONF_USERNAME,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry, patch
|
||||
|
||||
@ -74,7 +70,7 @@ async def test_setup_one_phonebook(hass: HomeAssistant) -> None:
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_USER},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
with patch(
|
||||
@ -104,7 +100,7 @@ async def test_setup_one_phonebook(hass: HomeAssistant) -> None:
|
||||
result["flow_id"], user_input=MOCK_USER_DATA
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == MOCK_PHONEBOOK_NAME_1
|
||||
assert result["data"] == MOCK_CONFIG_ENTRY
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
@ -116,7 +112,7 @@ async def test_setup_multiple_phonebooks(hass: HomeAssistant) -> None:
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_USER},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
with patch(
|
||||
@ -140,7 +136,7 @@ async def test_setup_multiple_phonebooks(hass: HomeAssistant) -> None:
|
||||
result["flow_id"], user_input=MOCK_USER_DATA
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "phonebook"
|
||||
assert result["errors"] == {}
|
||||
|
||||
@ -156,7 +152,7 @@ async def test_setup_multiple_phonebooks(hass: HomeAssistant) -> None:
|
||||
{CONF_PHONEBOOK: MOCK_PHONEBOOK_NAME_2},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == MOCK_PHONEBOOK_NAME_2
|
||||
assert result["data"] == {
|
||||
CONF_HOST: MOCK_HOST,
|
||||
@ -184,7 +180,7 @@ async def test_setup_cannot_connect(hass: HomeAssistant) -> None:
|
||||
result["flow_id"], user_input=MOCK_USER_DATA
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == ConnectResult.NO_DEVIES_FOUND
|
||||
|
||||
|
||||
@ -203,7 +199,7 @@ async def test_setup_insufficient_permissions(hass: HomeAssistant) -> None:
|
||||
result["flow_id"], user_input=MOCK_USER_DATA
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == ConnectResult.INSUFFICIENT_PERMISSIONS
|
||||
|
||||
|
||||
@ -222,7 +218,7 @@ async def test_setup_invalid_auth(hass: HomeAssistant) -> None:
|
||||
result["flow_id"], user_input=MOCK_USER_DATA
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": ConnectResult.INVALID_AUTH}
|
||||
|
||||
|
||||
@ -244,14 +240,14 @@ async def test_options_flow_correct_prefixes(hass: HomeAssistant) -> None:
|
||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"], user_input={CONF_PREFIXES: "+49, 491234"}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {CONF_PREFIXES: ["+49", "491234"]}
|
||||
|
||||
|
||||
@ -273,14 +269,14 @@ async def test_options_flow_incorrect_prefixes(hass: HomeAssistant) -> None:
|
||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"], user_input={CONF_PREFIXES: ""}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": ConnectResult.MALFORMED_PREFIXES}
|
||||
|
||||
|
||||
@ -302,12 +298,12 @@ async def test_options_flow_no_prefixes(hass: HomeAssistant) -> None:
|
||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"], user_input={}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {CONF_PREFIXES: None}
|
||||
|
@ -9,11 +9,7 @@ from homeassistant.components.dhcp import DhcpServiceInfo
|
||||
from homeassistant.components.fronius.const import DOMAIN
|
||||
from homeassistant.const import CONF_HOST
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import mock_responses
|
||||
|
||||
@ -51,7 +47,7 @@ async def test_form_with_logger(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
with patch(
|
||||
@ -69,7 +65,7 @@ async def test_form_with_logger(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "SolarNet Datalogger at 10.9.8.1"
|
||||
assert result2["data"] == {
|
||||
"host": "10.9.8.1",
|
||||
@ -83,7 +79,7 @@ async def test_form_with_inverter(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
with patch(
|
||||
@ -104,7 +100,7 @@ async def test_form_with_inverter(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "SolarNet Inverter at 10.9.1.1"
|
||||
assert result2["data"] == {
|
||||
"host": "10.9.1.1",
|
||||
@ -133,7 +129,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -157,7 +153,7 @@ async def test_form_no_device(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -178,7 +174,7 @@ async def test_form_unexpected(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "unknown"}
|
||||
|
||||
|
||||
@ -206,7 +202,7 @@ async def test_form_already_existing(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_ABORT
|
||||
assert result2["type"] == FlowResultType.ABORT
|
||||
assert result2["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -246,7 +242,7 @@ async def test_form_updates_host(hass, aioclient_mock):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_ABORT
|
||||
assert result2["type"] == FlowResultType.ABORT
|
||||
assert result2["reason"] == "already_configured"
|
||||
|
||||
mock_unload_entry.assert_called_with(hass, entry)
|
||||
@ -269,13 +265,13 @@ async def test_dhcp(hass, aioclient_mock):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_DHCP}, data=MOCK_DHCP_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm_discovery"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == f"SolarNet Datalogger at {MOCK_DHCP_DATA.ip}"
|
||||
assert result["data"] == {
|
||||
"host": MOCK_DHCP_DATA.ip,
|
||||
@ -298,7 +294,7 @@ async def test_dhcp_already_configured(hass, aioclient_mock):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_DHCP}, data=MOCK_DHCP_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -313,5 +309,5 @@ async def test_dhcp_invalid(hass, aioclient_mock):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_DHCP}, data=MOCK_DHCP_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "invalid_host"
|
||||
|
@ -8,11 +8,7 @@ import pytest
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.garages_amsterdam.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
|
||||
async def test_full_flow(hass: HomeAssistant) -> None:
|
||||
@ -21,7 +17,7 @@ async def test_full_flow(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert "flow_id" in result
|
||||
|
||||
with patch(
|
||||
@ -34,7 +30,7 @@ async def test_full_flow(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result2.get("title") == "IJDok"
|
||||
assert "result" in result2
|
||||
assert result2["result"].unique_id == "IJDok"
|
||||
@ -63,5 +59,5 @@ async def test_error_handling(
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result.get("type") == RESULT_TYPE_ABORT
|
||||
assert result.get("type") == FlowResultType.ABORT
|
||||
assert result.get("reason") == reason
|
||||
|
@ -17,7 +17,7 @@ from homeassistant.components.geocaching.const import (
|
||||
)
|
||||
from homeassistant.config_entries import SOURCE_REAUTH, SOURCE_USER
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_ABORT, RESULT_TYPE_EXTERNAL_STEP
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
from homeassistant.helpers import config_entry_oauth2_flow
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
@ -63,7 +63,7 @@ async def test_full_flow(
|
||||
},
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_EXTERNAL_STEP
|
||||
assert result.get("type") == FlowResultType.EXTERNAL_STEP
|
||||
assert result.get("step_id") == "auth"
|
||||
assert result.get("url") == (
|
||||
f"{CURRENT_ENVIRONMENT_URLS['authorize_url']}?response_type=code&client_id={CLIENT_ID}"
|
||||
@ -161,7 +161,7 @@ async def test_oauth_error(
|
||||
"redirect_uri": REDIRECT_URI,
|
||||
},
|
||||
)
|
||||
assert result.get("type") == RESULT_TYPE_EXTERNAL_STEP
|
||||
assert result.get("type") == FlowResultType.EXTERNAL_STEP
|
||||
|
||||
client = await hass_client_no_auth()
|
||||
resp = await client.get(f"/auth/external/callback?code=abcd&state={state}")
|
||||
@ -181,7 +181,7 @@ async def test_oauth_error(
|
||||
)
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(result["flow_id"])
|
||||
assert result2.get("type") == RESULT_TYPE_ABORT
|
||||
assert result2.get("type") == FlowResultType.ABORT
|
||||
assert result2.get("reason") == "oauth_error"
|
||||
|
||||
assert len(hass.config_entries.async_entries(DOMAIN)) == 0
|
||||
|
@ -12,12 +12,7 @@ from homeassistant.components.github.const import (
|
||||
DOMAIN,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_SHOW_PROGRESS,
|
||||
RESULT_TYPE_SHOW_PROGRESS_DONE,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from .common import MOCK_ACCESS_TOKEN
|
||||
|
||||
@ -63,7 +58,7 @@ async def test_full_user_flow_implementation(
|
||||
)
|
||||
|
||||
assert result["step_id"] == "device"
|
||||
assert result["type"] == RESULT_TYPE_SHOW_PROGRESS
|
||||
assert result["type"] == FlowResultType.SHOW_PROGRESS
|
||||
assert "flow_id" in result
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"])
|
||||
@ -76,7 +71,7 @@ async def test_full_user_flow_implementation(
|
||||
)
|
||||
|
||||
assert result["title"] == ""
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert "data" in result
|
||||
assert result["data"][CONF_ACCESS_TOKEN] == MOCK_ACCESS_TOKEN
|
||||
assert "options" in result
|
||||
@ -96,7 +91,7 @@ async def test_flow_with_registration_failure(
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_USER},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result.get("reason") == "could_not_register"
|
||||
|
||||
|
||||
@ -125,10 +120,10 @@ async def test_flow_with_activation_failure(
|
||||
context={"source": config_entries.SOURCE_USER},
|
||||
)
|
||||
assert result["step_id"] == "device"
|
||||
assert result["type"] == RESULT_TYPE_SHOW_PROGRESS
|
||||
assert result["type"] == FlowResultType.SHOW_PROGRESS
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"])
|
||||
assert result["type"] == RESULT_TYPE_SHOW_PROGRESS_DONE
|
||||
assert result["type"] == FlowResultType.SHOW_PROGRESS_DONE
|
||||
assert result["step_id"] == "could_not_register"
|
||||
|
||||
|
||||
@ -144,7 +139,7 @@ async def test_already_configured(
|
||||
context={"source": config_entries.SOURCE_USER},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result.get("reason") == "already_configured"
|
||||
|
||||
|
||||
|
@ -20,11 +20,7 @@ from homeassistant.const import (
|
||||
CONF_USERNAME,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import _mocked_ismartgate_closed_door_response
|
||||
|
||||
@ -59,7 +55,7 @@ async def test_auth_fail(
|
||||
},
|
||||
)
|
||||
assert result
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {
|
||||
"base": "invalid_auth",
|
||||
}
|
||||
@ -79,7 +75,7 @@ async def test_auth_fail(
|
||||
},
|
||||
)
|
||||
assert result
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
api.reset_mock()
|
||||
@ -97,7 +93,7 @@ async def test_auth_fail(
|
||||
},
|
||||
)
|
||||
assert result
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -117,7 +113,7 @@ async def test_form_homekit_unique_id_already_setup(hass):
|
||||
type="mock_type",
|
||||
),
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
flow = next(
|
||||
flow
|
||||
@ -145,7 +141,7 @@ async def test_form_homekit_unique_id_already_setup(hass):
|
||||
type="mock_type",
|
||||
),
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
|
||||
|
||||
async def test_form_homekit_ip_address_already_setup(hass):
|
||||
@ -170,7 +166,7 @@ async def test_form_homekit_ip_address_already_setup(hass):
|
||||
type="mock_type",
|
||||
),
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
|
||||
|
||||
async def test_form_homekit_ip_address(hass):
|
||||
@ -189,7 +185,7 @@ async def test_form_homekit_ip_address(hass):
|
||||
type="mock_type",
|
||||
),
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
data_schema = result["data_schema"]
|
||||
@ -219,7 +215,7 @@ async def test_discovered_dhcp(
|
||||
ip="1.2.3.4", macaddress=MOCK_MAC_ADDR, hostname="mock_hostname"
|
||||
),
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
@ -231,7 +227,7 @@ async def test_discovered_dhcp(
|
||||
},
|
||||
)
|
||||
assert result2
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
api.reset_mock()
|
||||
|
||||
@ -247,7 +243,7 @@ async def test_discovered_dhcp(
|
||||
},
|
||||
)
|
||||
assert result3
|
||||
assert result3["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result3["data"] == {
|
||||
"device": "ismartgate",
|
||||
"ip_address": "1.2.3.4",
|
||||
@ -272,7 +268,7 @@ async def test_discovered_by_homekit_and_dhcp(hass):
|
||||
type="mock_type",
|
||||
),
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
result2 = await hass.config_entries.flow.async_init(
|
||||
@ -282,7 +278,7 @@ async def test_discovered_by_homekit_and_dhcp(hass):
|
||||
ip="1.2.3.4", macaddress=MOCK_MAC_ADDR, hostname="mock_hostname"
|
||||
),
|
||||
)
|
||||
assert result2["type"] == RESULT_TYPE_ABORT
|
||||
assert result2["type"] == FlowResultType.ABORT
|
||||
assert result2["reason"] == "already_in_progress"
|
||||
|
||||
result3 = await hass.config_entries.flow.async_init(
|
||||
@ -292,5 +288,5 @@ async def test_discovered_by_homekit_and_dhcp(hass):
|
||||
ip="1.2.3.4", macaddress="00:00:00:00:00:00", hostname="mock_hostname"
|
||||
),
|
||||
)
|
||||
assert result3["type"] == RESULT_TYPE_ABORT
|
||||
assert result3["type"] == FlowResultType.ABORT
|
||||
assert result3["reason"] == "already_in_progress"
|
||||
|
@ -11,11 +11,7 @@ from homeassistant.components.goodwe.const import (
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.const import CONF_HOST
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -35,7 +31,7 @@ async def test_manual_setup(hass: HomeAssistant):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert not result["errors"]
|
||||
|
||||
@ -50,7 +46,7 @@ async def test_manual_setup(hass: HomeAssistant):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == DEFAULT_NAME
|
||||
assert result["data"] == {
|
||||
CONF_HOST: TEST_HOST,
|
||||
@ -68,7 +64,7 @@ async def test_manual_setup_already_exists(hass: HomeAssistant):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert not result["errors"]
|
||||
|
||||
@ -81,7 +77,7 @@ async def test_manual_setup_already_exists(hass: HomeAssistant):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -90,7 +86,7 @@ async def test_manual_setup_device_offline(hass: HomeAssistant):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert not result["errors"]
|
||||
|
||||
@ -103,5 +99,5 @@ async def test_manual_setup_device_offline(hass: HomeAssistant):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {CONF_HOST: "connection_error"}
|
||||
|
@ -6,11 +6,7 @@ import pytest
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.group import DOMAIN, async_setup_entry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
RESULT_TYPE_MENU,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
@ -47,14 +43,14 @@ async def test_config_flow(
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_MENU
|
||||
assert result["type"] == FlowResultType.MENU
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
{"next_step_id": group_type},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == group_type
|
||||
|
||||
with patch(
|
||||
@ -70,7 +66,7 @@ async def test_config_flow(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "Living Room"
|
||||
assert result["data"] == {}
|
||||
assert result["options"] == {
|
||||
@ -136,14 +132,14 @@ async def test_config_flow_hides_members(
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_MENU
|
||||
assert result["type"] == FlowResultType.MENU
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
{"next_step_id": group_type},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == group_type
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -157,7 +153,7 @@ async def test_config_flow_hides_members(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
|
||||
assert registry.async_get(f"{group_type}.one").hidden_by == hidden_by
|
||||
assert registry.async_get(f"{group_type}.three").hidden_by == hidden_by
|
||||
@ -220,7 +216,7 @@ async def test_options(
|
||||
config_entry = hass.config_entries.async_entries(DOMAIN)[0]
|
||||
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == group_type
|
||||
assert get_suggested(result["data_schema"].schema, "entities") == members1
|
||||
assert "name" not in result["data_schema"].schema
|
||||
@ -234,7 +230,7 @@ async def test_options(
|
||||
"entities": members2,
|
||||
},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == {
|
||||
"entities": members2,
|
||||
"group_type": group_type,
|
||||
@ -261,14 +257,14 @@ async def test_options(
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_MENU
|
||||
assert result["type"] == FlowResultType.MENU
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
{"next_step_id": group_type},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == group_type
|
||||
|
||||
assert get_suggested(result["data_schema"].schema, "entities") is None
|
||||
@ -318,7 +314,7 @@ async def test_all_options(
|
||||
result = await hass.config_entries.options.async_init(
|
||||
config_entry.entry_id, context={"show_advanced_options": advanced}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == group_type
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
@ -327,7 +323,7 @@ async def test_all_options(
|
||||
"entities": members2,
|
||||
},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == {
|
||||
"entities": members2,
|
||||
"group_type": group_type,
|
||||
@ -414,7 +410,7 @@ async def test_options_flow_hides_members(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
result = await hass.config_entries.options.async_init(group_config_entry.entry_id)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"],
|
||||
@ -425,7 +421,7 @@ async def test_options_flow_hides_members(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
|
||||
assert registry.async_get(f"{group_type}.one").hidden_by == hidden_by
|
||||
assert registry.async_get(f"{group_type}.three").hidden_by == hidden_by
|
||||
|
@ -3,7 +3,7 @@ from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.hardkernel.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_ABORT, RESULT_TYPE_CREATE_ENTRY
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry, MockModule, mock_integration
|
||||
|
||||
@ -20,7 +20,7 @@ async def test_config_flow(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": "system"}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "Hardkernel"
|
||||
assert result["data"] == {}
|
||||
assert result["options"] == {}
|
||||
@ -53,6 +53,6 @@ async def test_config_flow_single_entry(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": "system"}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "single_instance_allowed"
|
||||
mock_setup_entry.assert_not_called()
|
||||
|
@ -154,7 +154,7 @@ async def test_step_user(hass: HomeAssistant, menu_options) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_MENU
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.MENU
|
||||
assert result2["menu_options"] == menu_options
|
||||
|
||||
|
||||
@ -178,7 +178,7 @@ async def test_step_origin_coordinates(
|
||||
}
|
||||
},
|
||||
)
|
||||
assert location_selector_result["type"] == data_entry_flow.RESULT_TYPE_MENU
|
||||
assert location_selector_result["type"] == data_entry_flow.FlowResultType.MENU
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("valid_response")
|
||||
@ -195,7 +195,7 @@ async def test_step_origin_entity(
|
||||
menu_result["flow_id"],
|
||||
{"origin_entity_id": "zone.home"},
|
||||
)
|
||||
assert entity_selector_result["type"] == data_entry_flow.RESULT_TYPE_MENU
|
||||
assert entity_selector_result["type"] == data_entry_flow.FlowResultType.MENU
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("valid_response")
|
||||
@ -341,7 +341,7 @@ async def test_options_flow(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_MENU
|
||||
assert result["type"] == data_entry_flow.FlowResultType.MENU
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("valid_response")
|
||||
|
@ -3,7 +3,7 @@ from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.homeassistant_yellow.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_ABORT, RESULT_TYPE_CREATE_ENTRY
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry, MockModule, mock_integration
|
||||
|
||||
@ -20,7 +20,7 @@ async def test_config_flow(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": "system"}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "Home Assistant Yellow"
|
||||
assert result["data"] == {}
|
||||
assert result["options"] == {}
|
||||
@ -53,6 +53,6 @@ async def test_config_flow_single_entry(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": "system"}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "single_instance_allowed"
|
||||
mock_setup_entry.assert_not_called()
|
||||
|
@ -15,7 +15,7 @@ from homeassistant import config_entries
|
||||
from homeassistant.components import zeroconf
|
||||
from homeassistant.components.homekit_controller import config_flow
|
||||
from homeassistant.components.homekit_controller.const import KNOWN_DEVICES
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_ABORT, RESULT_TYPE_CREATE_ENTRY
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
from homeassistant.helpers import device_registry
|
||||
|
||||
from tests.common import MockConfigEntry, mock_device_registry
|
||||
@ -943,10 +943,10 @@ async def test_mdns_update_to_paired_during_pairing(hass, controller):
|
||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||
data=discovery_info_paired,
|
||||
)
|
||||
assert result2["type"] == RESULT_TYPE_ABORT
|
||||
assert result2["type"] == FlowResultType.ABORT
|
||||
assert result2["reason"] == "already_paired"
|
||||
mdns_update_to_paired.set()
|
||||
result = await task
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "Koogeek-LS1-20833F"
|
||||
assert result["data"] == {}
|
||||
|
@ -8,11 +8,7 @@ from homeassistant import config_entries
|
||||
from homeassistant.components import zeroconf
|
||||
from homeassistant.components.homewizard.const import DOMAIN
|
||||
from homeassistant.const import CONF_IP_ADDRESS
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from .generator import get_mock_device
|
||||
|
||||
@ -95,7 +91,7 @@ async def test_discovery_flow_works(hass, aioclient_mock):
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
flow["flow_id"], user_input=None
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "discovery_confirm"
|
||||
|
||||
with patch(
|
||||
@ -109,7 +105,7 @@ async def test_discovery_flow_works(hass, aioclient_mock):
|
||||
flow["flow_id"], user_input={"ip_address": "192.168.43.183"}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "P1 meter (aabbccddeeff)"
|
||||
assert result["data"][CONF_IP_ADDRESS] == "192.168.43.183"
|
||||
|
||||
@ -176,7 +172,7 @@ async def test_discovery_disabled_api(hass, aioclient_mock):
|
||||
data=service_info,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.homewizard.async_setup_entry",
|
||||
@ -189,7 +185,7 @@ async def test_discovery_disabled_api(hass, aioclient_mock):
|
||||
result["flow_id"], user_input={"ip_address": "192.168.43.183"}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "api_not_enabled"
|
||||
|
||||
|
||||
@ -218,7 +214,7 @@ async def test_discovery_missing_data_in_service_info(hass, aioclient_mock):
|
||||
data=service_info,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "invalid_discovery_parameters"
|
||||
|
||||
|
||||
@ -247,7 +243,7 @@ async def test_discovery_invalid_api(hass, aioclient_mock):
|
||||
data=service_info,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "unsupported_api_version"
|
||||
|
||||
|
||||
@ -275,7 +271,7 @@ async def test_check_disabled_api(hass, aioclient_mock):
|
||||
result["flow_id"], {CONF_IP_ADDRESS: "2.2.2.2"}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "api_not_enabled"
|
||||
|
||||
|
||||
@ -303,7 +299,7 @@ async def test_check_error_handling_api(hass, aioclient_mock):
|
||||
result["flow_id"], {CONF_IP_ADDRESS: "2.2.2.2"}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "unknown_error"
|
||||
|
||||
|
||||
@ -331,7 +327,7 @@ async def test_check_detects_invalid_api(hass, aioclient_mock):
|
||||
result["flow_id"], {CONF_IP_ADDRESS: "2.2.2.2"}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "unsupported_api_version"
|
||||
|
||||
|
||||
@ -359,5 +355,5 @@ async def test_check_requesterror(hass, aioclient_mock):
|
||||
result["flow_id"], {CONF_IP_ADDRESS: "2.2.2.2"}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "unknown_error"
|
||||
|
@ -6,7 +6,7 @@ import pytest
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.integration.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_CREATE_ENTRY, RESULT_TYPE_FORM
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -19,7 +19,7 @@ async def test_config_flow(hass: HomeAssistant, platform) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
with patch(
|
||||
@ -39,7 +39,7 @@ async def test_config_flow(hass: HomeAssistant, platform) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "My integration"
|
||||
assert result["data"] == {}
|
||||
assert result["options"] == {
|
||||
@ -98,7 +98,7 @@ async def test_options(hass: HomeAssistant, platform) -> None:
|
||||
await hass.async_block_till_done()
|
||||
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
schema = result["data_schema"].schema
|
||||
assert get_suggested(schema, "round") == 1.0
|
||||
@ -109,7 +109,7 @@ async def test_options(hass: HomeAssistant, platform) -> None:
|
||||
"round": 2.0,
|
||||
},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == {
|
||||
"method": "left",
|
||||
"name": "My integration",
|
||||
|
@ -9,11 +9,7 @@ from homeassistant.components.intellifire.config_flow import MANUAL_ENTRY_STRING
|
||||
from homeassistant.components.intellifire.const import CONF_USER_ID, DOMAIN
|
||||
from homeassistant.const import CONF_API_KEY, CONF_HOST, CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.intellifire.conftest import mock_api_connection_error
|
||||
@ -38,7 +34,7 @@ async def test_no_discovery(
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
assert result["step_id"] == "manual_device_entry"
|
||||
|
||||
@ -50,7 +46,7 @@ async def test_no_discovery(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["step_id"] == "api_config"
|
||||
|
||||
result3 = await hass.config_entries.flow.async_configure(
|
||||
@ -59,7 +55,7 @@ async def test_no_discovery(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result3["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result3["title"] == "Fireplace 12345"
|
||||
assert result3["data"] == {
|
||||
CONF_HOST: "1.1.1.1",
|
||||
@ -100,7 +96,7 @@ async def test_single_discovery(
|
||||
{CONF_USERNAME: "test", CONF_PASSWORD: "AROONIE"},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result3["type"] == RESULT_TYPE_FORM
|
||||
assert result3["type"] == FlowResultType.FORM
|
||||
assert result3["errors"] == {"base": "iftapi_connect"}
|
||||
|
||||
|
||||
@ -133,7 +129,7 @@ async def test_single_discovery_loign_error(
|
||||
{CONF_USERNAME: "test", CONF_PASSWORD: "AROONIE"},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result3["type"] == RESULT_TYPE_FORM
|
||||
assert result3["type"] == FlowResultType.FORM
|
||||
assert result3["errors"] == {"base": "api_error"}
|
||||
|
||||
|
||||
@ -199,14 +195,14 @@ async def test_multi_discovery_cannot_connect(
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "pick_device"
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={CONF_HOST: "192.168.1.33"}
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -221,7 +217,7 @@ async def test_form_cannot_connect_manual_entry(
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "manual_device_entry"
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -231,7 +227,7 @@ async def test_form_cannot_connect_manual_entry(
|
||||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -266,7 +262,7 @@ async def test_picker_already_discovered(
|
||||
CONF_HOST: "192.168.1.4",
|
||||
},
|
||||
)
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert len(mock_setup_entry.mock_calls) == 0
|
||||
|
||||
|
||||
@ -303,7 +299,7 @@ async def test_reauth_flow(
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "api_config"
|
||||
|
||||
result3 = await hass.config_entries.flow.async_configure(
|
||||
@ -311,7 +307,7 @@ async def test_reauth_flow(
|
||||
{CONF_USERNAME: "test", CONF_PASSWORD: "AROONIE"},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result3["type"] == RESULT_TYPE_ABORT
|
||||
assert result3["type"] == FlowResultType.ABORT
|
||||
assert entry.data[CONF_PASSWORD] == "AROONIE"
|
||||
assert entry.data[CONF_USERNAME] == "test"
|
||||
|
||||
@ -331,10 +327,10 @@ async def test_dhcp_discovery_intellifire_device(
|
||||
hostname="zentrios-Test",
|
||||
),
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "dhcp_confirm"
|
||||
result2 = await hass.config_entries.flow.async_configure(result["flow_id"])
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["step_id"] == "dhcp_confirm"
|
||||
result3 = await hass.config_entries.flow.async_configure(
|
||||
result2["flow_id"], user_input={}
|
||||
|
@ -6,7 +6,7 @@ import httpx
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.iotawatt.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_CREATE_ENTRY, RESULT_TYPE_FORM
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
|
||||
async def test_form(hass: HomeAssistant) -> None:
|
||||
@ -15,7 +15,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == config_entries.SOURCE_USER
|
||||
|
||||
with patch(
|
||||
@ -34,7 +34,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["data"] == {
|
||||
"host": "1.1.1.1",
|
||||
}
|
||||
@ -46,7 +46,7 @@ async def test_form_auth(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
with patch(
|
||||
@ -59,7 +59,7 @@ async def test_form_auth(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["step_id"] == "auth"
|
||||
|
||||
with patch(
|
||||
@ -75,7 +75,7 @@ async def test_form_auth(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result3["type"] == RESULT_TYPE_FORM
|
||||
assert result3["type"] == FlowResultType.FORM
|
||||
assert result3["step_id"] == "auth"
|
||||
assert result3["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
@ -95,7 +95,7 @@ async def test_form_auth(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result4["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result4["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
assert result4["data"] == {
|
||||
"host": "1.1.1.1",
|
||||
@ -119,7 +119,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None:
|
||||
{"host": "1.1.1.1"},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -138,5 +138,5 @@ async def test_form_setup_exception(hass: HomeAssistant) -> None:
|
||||
{"host": "1.1.1.1"},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "unknown"}
|
||||
|
@ -6,11 +6,7 @@ from homeassistant.components.ipp.const import CONF_BASE_PATH, CONF_UUID, DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_USER, SOURCE_ZEROCONF
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_SSL
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import (
|
||||
MOCK_USER_INPUT,
|
||||
@ -31,7 +27,7 @@ async def test_show_user_form(hass: HomeAssistant) -> None:
|
||||
)
|
||||
|
||||
assert result["step_id"] == "user"
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
|
||||
|
||||
async def test_show_zeroconf_form(
|
||||
@ -48,7 +44,7 @@ async def test_show_zeroconf_form(
|
||||
)
|
||||
|
||||
assert result["step_id"] == "zeroconf_confirm"
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["description_placeholders"] == {CONF_NAME: "EPSON XP-6000 Series"}
|
||||
|
||||
|
||||
@ -66,7 +62,7 @@ async def test_connection_error(
|
||||
)
|
||||
|
||||
assert result["step_id"] == "user"
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -83,7 +79,7 @@ async def test_zeroconf_connection_error(
|
||||
data=discovery_info,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "cannot_connect"
|
||||
|
||||
|
||||
@ -98,7 +94,7 @@ async def test_zeroconf_confirm_connection_error(
|
||||
DOMAIN, context={"source": SOURCE_ZEROCONF}, data=discovery_info
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "cannot_connect"
|
||||
|
||||
|
||||
@ -116,7 +112,7 @@ async def test_user_connection_upgrade_required(
|
||||
)
|
||||
|
||||
assert result["step_id"] == "user"
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "connection_upgrade"}
|
||||
|
||||
|
||||
@ -133,7 +129,7 @@ async def test_zeroconf_connection_upgrade_required(
|
||||
data=discovery_info,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "connection_upgrade"
|
||||
|
||||
|
||||
@ -150,7 +146,7 @@ async def test_user_parse_error(
|
||||
data=user_input,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "parse_error"
|
||||
|
||||
|
||||
@ -167,7 +163,7 @@ async def test_zeroconf_parse_error(
|
||||
data=discovery_info,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "parse_error"
|
||||
|
||||
|
||||
@ -184,7 +180,7 @@ async def test_user_ipp_error(
|
||||
data=user_input,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "ipp_error"
|
||||
|
||||
|
||||
@ -201,7 +197,7 @@ async def test_zeroconf_ipp_error(
|
||||
data=discovery_info,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "ipp_error"
|
||||
|
||||
|
||||
@ -218,7 +214,7 @@ async def test_user_ipp_version_error(
|
||||
data=user_input,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "ipp_version_error"
|
||||
|
||||
|
||||
@ -235,7 +231,7 @@ async def test_zeroconf_ipp_version_error(
|
||||
data=discovery_info,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "ipp_version_error"
|
||||
|
||||
|
||||
@ -252,7 +248,7 @@ async def test_user_device_exists_abort(
|
||||
data=user_input,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -269,7 +265,7 @@ async def test_zeroconf_device_exists_abort(
|
||||
data=discovery_info,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -291,7 +287,7 @@ async def test_zeroconf_with_uuid_device_exists_abort(
|
||||
data=discovery_info,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -312,7 +308,7 @@ async def test_zeroconf_empty_unique_id(
|
||||
data=discovery_info,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
|
||||
|
||||
async def test_zeroconf_no_unique_id(
|
||||
@ -328,7 +324,7 @@ async def test_zeroconf_no_unique_id(
|
||||
data=discovery_info,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
|
||||
|
||||
async def test_full_user_flow_implementation(
|
||||
@ -343,7 +339,7 @@ async def test_full_user_flow_implementation(
|
||||
)
|
||||
|
||||
assert result["step_id"] == "user"
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
|
||||
with patch("homeassistant.components.ipp.async_setup_entry", return_value=True):
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -351,7 +347,7 @@ async def test_full_user_flow_implementation(
|
||||
user_input={CONF_HOST: "192.168.1.31", CONF_BASE_PATH: "/ipp/print"},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "192.168.1.31"
|
||||
|
||||
assert result["data"]
|
||||
@ -376,14 +372,14 @@ async def test_full_zeroconf_flow_implementation(
|
||||
)
|
||||
|
||||
assert result["step_id"] == "zeroconf_confirm"
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
|
||||
with patch("homeassistant.components.ipp.async_setup_entry", return_value=True):
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "EPSON XP-6000 Series"
|
||||
|
||||
assert result["data"]
|
||||
@ -410,7 +406,7 @@ async def test_full_zeroconf_tls_flow_implementation(
|
||||
)
|
||||
|
||||
assert result["step_id"] == "zeroconf_confirm"
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["description_placeholders"] == {CONF_NAME: "EPSON XP-6000 Series"}
|
||||
|
||||
with patch("homeassistant.components.ipp.async_setup_entry", return_value=True):
|
||||
@ -418,7 +414,7 @@ async def test_full_zeroconf_tls_flow_implementation(
|
||||
result["flow_id"], user_input={}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "EPSON XP-6000 Series"
|
||||
|
||||
assert result["data"]
|
||||
|
@ -7,11 +7,7 @@ from homeassistant.components.kaleidescape.const import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_SSDP, SOURCE_USER
|
||||
from homeassistant.const import CONF_HOST
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import MOCK_HOST, MOCK_SSDP_DISCOVERY_INFO
|
||||
|
||||
@ -25,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"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -33,7 +29,7 @@ async def test_user_config_flow_success(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert "data" in result
|
||||
assert result["data"][CONF_HOST] == MOCK_HOST
|
||||
|
||||
@ -48,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"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
@ -63,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"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "unsupported"}
|
||||
|
||||
@ -75,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"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -87,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"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "discovery_confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -95,7 +91,7 @@ async def test_ssdp_config_flow_success(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert "data" in result
|
||||
assert result["data"][CONF_HOST] == MOCK_HOST
|
||||
|
||||
@ -111,7 +107,7 @@ async def test_ssdp_config_flow_bad_connect_aborts(
|
||||
DOMAIN, context={"source": SOURCE_SSDP}, data=discovery_info
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "cannot_connect"
|
||||
|
||||
|
||||
@ -126,5 +122,5 @@ async def test_ssdp_config_flow_unsupported_device_aborts(
|
||||
DOMAIN, context={"source": SOURCE_SSDP}, data=discovery_info
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "unsupported"
|
||||
|
@ -41,11 +41,7 @@ from homeassistant.components.knx.const import (
|
||||
)
|
||||
from homeassistant.const import CONF_HOST, CONF_PORT
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
RESULT_TYPE_MENU,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -84,7 +80,7 @@ async def test_routing_setup(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert not result["errors"]
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -94,7 +90,7 @@ async def test_routing_setup(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["step_id"] == "routing"
|
||||
assert not result2["errors"]
|
||||
|
||||
@ -111,7 +107,7 @@ async def test_routing_setup(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result3["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result3["title"] == CONF_KNX_ROUTING.capitalize()
|
||||
assert result3["data"] == {
|
||||
**DEFAULT_ENTRY_DATA,
|
||||
@ -136,7 +132,7 @@ async def test_routing_setup_advanced(hass: HomeAssistant) -> None:
|
||||
"show_advanced_options": True,
|
||||
},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert not result["errors"]
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -146,7 +142,7 @@ async def test_routing_setup_advanced(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["step_id"] == "routing"
|
||||
assert not result2["errors"]
|
||||
|
||||
@ -161,7 +157,7 @@ async def test_routing_setup_advanced(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result_invalid_input["type"] == RESULT_TYPE_FORM
|
||||
assert result_invalid_input["type"] == FlowResultType.FORM
|
||||
assert result_invalid_input["step_id"] == "routing"
|
||||
assert result_invalid_input["errors"] == {
|
||||
CONF_KNX_MCAST_GRP: "invalid_ip_address",
|
||||
@ -184,7 +180,7 @@ async def test_routing_setup_advanced(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result3["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result3["title"] == CONF_KNX_ROUTING.capitalize()
|
||||
assert result3["data"] == {
|
||||
**DEFAULT_ENTRY_DATA,
|
||||
@ -261,7 +257,7 @@ async def test_tunneling_setup(
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert not result["errors"]
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -271,7 +267,7 @@ async def test_tunneling_setup(
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["step_id"] == "manual_tunnel"
|
||||
assert not result2["errors"]
|
||||
|
||||
@ -284,7 +280,7 @@ async def test_tunneling_setup(
|
||||
user_input,
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result3["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result3["title"] == "Tunneling @ 192.168.0.1"
|
||||
assert result3["data"] == config_entry_data
|
||||
|
||||
@ -303,7 +299,7 @@ async def test_tunneling_setup_for_local_ip(hass: HomeAssistant) -> None:
|
||||
"show_advanced_options": True,
|
||||
},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert not result["errors"]
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -313,7 +309,7 @@ async def test_tunneling_setup_for_local_ip(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["step_id"] == "manual_tunnel"
|
||||
assert not result2["errors"]
|
||||
|
||||
@ -328,7 +324,7 @@ async def test_tunneling_setup_for_local_ip(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result_invalid_host["type"] == RESULT_TYPE_FORM
|
||||
assert result_invalid_host["type"] == FlowResultType.FORM
|
||||
assert result_invalid_host["step_id"] == "manual_tunnel"
|
||||
assert result_invalid_host["errors"] == {CONF_HOST: "invalid_ip_address"}
|
||||
# invalid local ip address
|
||||
@ -342,7 +338,7 @@ async def test_tunneling_setup_for_local_ip(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result_invalid_local["type"] == RESULT_TYPE_FORM
|
||||
assert result_invalid_local["type"] == FlowResultType.FORM
|
||||
assert result_invalid_local["step_id"] == "manual_tunnel"
|
||||
assert result_invalid_local["errors"] == {CONF_KNX_LOCAL_IP: "invalid_ip_address"}
|
||||
|
||||
@ -361,7 +357,7 @@ async def test_tunneling_setup_for_local_ip(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result3["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result3["title"] == "Tunneling @ 192.168.0.2"
|
||||
assert result3["data"] == {
|
||||
**DEFAULT_ENTRY_DATA,
|
||||
@ -385,7 +381,7 @@ async def test_tunneling_setup_for_multiple_found_gateways(hass: HomeAssistant)
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert not result["errors"]
|
||||
|
||||
tunnel_flow = await hass.config_entries.flow.async_configure(
|
||||
@ -395,7 +391,7 @@ async def test_tunneling_setup_for_multiple_found_gateways(hass: HomeAssistant)
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert tunnel_flow["type"] == RESULT_TYPE_FORM
|
||||
assert tunnel_flow["type"] == FlowResultType.FORM
|
||||
assert tunnel_flow["step_id"] == "tunnel"
|
||||
assert not tunnel_flow["errors"]
|
||||
|
||||
@ -404,7 +400,7 @@ async def test_tunneling_setup_for_multiple_found_gateways(hass: HomeAssistant)
|
||||
{CONF_KNX_GATEWAY: str(gateway)},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert manual_tunnel["type"] == RESULT_TYPE_FORM
|
||||
assert manual_tunnel["type"] == FlowResultType.FORM
|
||||
assert manual_tunnel["step_id"] == "manual_tunnel"
|
||||
|
||||
with patch(
|
||||
@ -420,7 +416,7 @@ async def test_tunneling_setup_for_multiple_found_gateways(hass: HomeAssistant)
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert manual_tunnel_flow["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert manual_tunnel_flow["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert manual_tunnel_flow["data"] == {
|
||||
**DEFAULT_ENTRY_DATA,
|
||||
CONF_KNX_CONNECTION_TYPE: CONF_KNX_TUNNELING,
|
||||
@ -441,7 +437,7 @@ async def test_manual_tunnel_step_when_no_gateway(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert not result["errors"]
|
||||
|
||||
tunnel_flow = await hass.config_entries.flow.async_configure(
|
||||
@ -451,7 +447,7 @@ async def test_manual_tunnel_step_when_no_gateway(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert tunnel_flow["type"] == RESULT_TYPE_FORM
|
||||
assert tunnel_flow["type"] == FlowResultType.FORM
|
||||
assert tunnel_flow["step_id"] == "manual_tunnel"
|
||||
assert not tunnel_flow["errors"]
|
||||
|
||||
@ -463,7 +459,7 @@ async def test_form_with_automatic_connection_handling(hass: HomeAssistant) -> N
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert not result["errors"]
|
||||
|
||||
with patch(
|
||||
@ -478,7 +474,7 @@ async def test_form_with_automatic_connection_handling(hass: HomeAssistant) -> N
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == CONF_KNX_AUTOMATIC.capitalize()
|
||||
assert result2["data"] == {
|
||||
**DEFAULT_ENTRY_DATA,
|
||||
@ -496,7 +492,7 @@ async def _get_menu_step(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert not result["errors"]
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -506,7 +502,7 @@ async def _get_menu_step(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["step_id"] == "manual_tunnel"
|
||||
assert not result2["errors"]
|
||||
|
||||
@ -519,7 +515,7 @@ async def _get_menu_step(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result3["type"] == RESULT_TYPE_MENU
|
||||
assert result3["type"] == FlowResultType.MENU
|
||||
assert result3["step_id"] == "secure_tunneling"
|
||||
return result3
|
||||
|
||||
@ -532,7 +528,7 @@ async def test_configure_secure_manual(hass: HomeAssistant):
|
||||
menu_step["flow_id"],
|
||||
{"next_step_id": "secure_manual"},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "secure_manual"
|
||||
assert not result["errors"]
|
||||
|
||||
@ -549,7 +545,7 @@ async def test_configure_secure_manual(hass: HomeAssistant):
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert secure_manual["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert secure_manual["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert secure_manual["data"] == {
|
||||
**DEFAULT_ENTRY_DATA,
|
||||
CONF_KNX_CONNECTION_TYPE: CONF_KNX_TUNNELING_TCP_SECURE,
|
||||
@ -574,7 +570,7 @@ async def test_configure_secure_knxkeys(hass: HomeAssistant):
|
||||
menu_step["flow_id"],
|
||||
{"next_step_id": "secure_knxkeys"},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "secure_knxkeys"
|
||||
assert not result["errors"]
|
||||
|
||||
@ -592,7 +588,7 @@ async def test_configure_secure_knxkeys(hass: HomeAssistant):
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert secure_knxkeys["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert secure_knxkeys["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert secure_knxkeys["data"] == {
|
||||
**DEFAULT_ENTRY_DATA,
|
||||
CONF_KNX_CONNECTION_TYPE: CONF_KNX_TUNNELING_TCP_SECURE,
|
||||
@ -616,7 +612,7 @@ async def test_configure_secure_knxkeys_file_not_found(hass: HomeAssistant):
|
||||
menu_step["flow_id"],
|
||||
{"next_step_id": "secure_knxkeys"},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "secure_knxkeys"
|
||||
assert not result["errors"]
|
||||
|
||||
@ -632,7 +628,7 @@ async def test_configure_secure_knxkeys_file_not_found(hass: HomeAssistant):
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert secure_knxkeys["type"] == RESULT_TYPE_FORM
|
||||
assert secure_knxkeys["type"] == FlowResultType.FORM
|
||||
assert secure_knxkeys["errors"]
|
||||
assert secure_knxkeys["errors"][CONF_KNX_KNXKEY_FILENAME] == "file_not_found"
|
||||
|
||||
@ -645,7 +641,7 @@ async def test_configure_secure_knxkeys_invalid_signature(hass: HomeAssistant):
|
||||
menu_step["flow_id"],
|
||||
{"next_step_id": "secure_knxkeys"},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "secure_knxkeys"
|
||||
assert not result["errors"]
|
||||
|
||||
@ -661,7 +657,7 @@ async def test_configure_secure_knxkeys_invalid_signature(hass: HomeAssistant):
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert secure_knxkeys["type"] == RESULT_TYPE_FORM
|
||||
assert secure_knxkeys["type"] == FlowResultType.FORM
|
||||
assert secure_knxkeys["errors"]
|
||||
assert secure_knxkeys["errors"][CONF_KNX_KNXKEY_PASSWORD] == "invalid_signature"
|
||||
|
||||
@ -679,7 +675,7 @@ async def test_options_flow(
|
||||
mock_config_entry.entry_id
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == "init"
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -694,7 +690,7 @@ async def test_options_flow(
|
||||
)
|
||||
|
||||
await hass.async_block_till_done()
|
||||
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert not result2.get("data")
|
||||
|
||||
assert mock_config_entry.data == {
|
||||
@ -787,7 +783,7 @@ async def test_tunneling_options_flow(
|
||||
mock_config_entry.entry_id
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == "init"
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -801,7 +797,7 @@ async def test_tunneling_options_flow(
|
||||
},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_FORM
|
||||
assert result2.get("type") == FlowResultType.FORM
|
||||
assert not result2.get("data")
|
||||
assert "flow_id" in result2
|
||||
|
||||
@ -811,7 +807,7 @@ async def test_tunneling_options_flow(
|
||||
)
|
||||
|
||||
await hass.async_block_till_done()
|
||||
assert result3.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert not result3.get("data")
|
||||
|
||||
assert mock_config_entry.data == config_entry_data
|
||||
@ -880,7 +876,7 @@ async def test_advanced_options(
|
||||
mock_config_entry.entry_id, context={"show_advanced_options": True}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == "init"
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -890,7 +886,7 @@ async def test_advanced_options(
|
||||
)
|
||||
|
||||
await hass.async_block_till_done()
|
||||
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert not result2.get("data")
|
||||
|
||||
assert mock_config_entry.data == config_entry_data
|
||||
|
@ -6,11 +6,7 @@ from homeassistant.components.laundrify.const import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_REAUTH, SOURCE_USER
|
||||
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_CODE, CONF_SOURCE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import create_entry
|
||||
from .const import VALID_ACCESS_TOKEN, VALID_AUTH_CODE, VALID_USER_INPUT
|
||||
@ -21,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"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -30,7 +26,7 @@ async def test_form(hass: HomeAssistant, laundrify_setup_entry) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == DOMAIN
|
||||
assert result["data"] == {
|
||||
CONF_ACCESS_TOKEN: VALID_ACCESS_TOKEN,
|
||||
@ -50,7 +46,7 @@ async def test_form_invalid_format(
|
||||
data={CONF_CODE: "invalidFormat"},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {CONF_CODE: "invalid_format"}
|
||||
|
||||
|
||||
@ -63,7 +59,7 @@ async def test_form_invalid_auth(hass: HomeAssistant, laundrify_exchange_code) -
|
||||
data=VALID_USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {CONF_CODE: "invalid_auth"}
|
||||
|
||||
|
||||
@ -76,7 +72,7 @@ async def test_form_cannot_connect(hass: HomeAssistant, laundrify_exchange_code)
|
||||
data=VALID_USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -89,7 +85,7 @@ async def test_form_unkown_exception(hass: HomeAssistant, laundrify_exchange_cod
|
||||
data=VALID_USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "unknown"}
|
||||
|
||||
|
||||
@ -99,7 +95,7 @@ async def test_step_reauth(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": SOURCE_REAUTH}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -108,7 +104,7 @@ async def test_step_reauth(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
|
||||
|
||||
async def test_integration_already_exists(hass: HomeAssistant):
|
||||
@ -125,5 +121,5 @@ async def test_integration_already_exists(hass: HomeAssistant):
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
@ -10,11 +10,7 @@ from homeassistant import config_entries
|
||||
from homeassistant.components.lookin.const import DOMAIN
|
||||
from homeassistant.const import CONF_HOST
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import (
|
||||
DEFAULT_ENTRY_TITLE,
|
||||
@ -45,7 +41,7 @@ async def test_manual_setup(hass: HomeAssistant):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == {CONF_HOST: IP_ADDRESS}
|
||||
assert result["title"] == DEFAULT_ENTRY_TITLE
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
@ -70,7 +66,7 @@ async def test_manual_setup_already_exists(hass: HomeAssistant):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -123,7 +119,7 @@ async def test_discovered_zeroconf(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
with _patch_get_info(), patch(
|
||||
@ -132,7 +128,7 @@ async def test_discovered_zeroconf(hass):
|
||||
result2 = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["data"] == {CONF_HOST: IP_ADDRESS}
|
||||
assert result2["title"] == DEFAULT_ENTRY_TITLE
|
||||
assert mock_async_setup_entry.called
|
||||
@ -151,7 +147,7 @@ async def test_discovered_zeroconf(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
assert entry.data[CONF_HOST] == "127.0.0.2"
|
||||
|
||||
@ -167,7 +163,7 @@ async def test_discovered_zeroconf_cannot_connect(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "cannot_connect"
|
||||
|
||||
|
||||
@ -182,5 +178,5 @@ async def test_discovered_zeroconf_unknown_exception(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "unknown"
|
||||
|
@ -8,11 +8,7 @@ from homeassistant.components.luftdaten.const import CONF_SENSOR_ID
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.const import CONF_SHOW_ON_MAP
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -27,7 +23,7 @@ async def test_duplicate_error(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -36,7 +32,7 @@ async def test_duplicate_error(
|
||||
user_input={CONF_SENSOR_ID: 12345},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_ABORT
|
||||
assert result2.get("type") == FlowResultType.ABORT
|
||||
assert result2.get("reason") == "already_configured"
|
||||
|
||||
|
||||
@ -48,7 +44,7 @@ async def test_communication_error(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -58,7 +54,7 @@ async def test_communication_error(
|
||||
user_input={CONF_SENSOR_ID: 12345},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_FORM
|
||||
assert result2.get("type") == FlowResultType.FORM
|
||||
assert result2.get("step_id") == SOURCE_USER
|
||||
assert result2.get("errors") == {CONF_SENSOR_ID: "cannot_connect"}
|
||||
assert "flow_id" in result2
|
||||
@ -69,7 +65,7 @@ async def test_communication_error(
|
||||
user_input={CONF_SENSOR_ID: 12345},
|
||||
)
|
||||
|
||||
assert result3.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result3.get("title") == "12345"
|
||||
assert result3.get("data") == {
|
||||
CONF_SENSOR_ID: 12345,
|
||||
@ -85,7 +81,7 @@ async def test_invalid_sensor(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -95,7 +91,7 @@ async def test_invalid_sensor(
|
||||
user_input={CONF_SENSOR_ID: 11111},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_FORM
|
||||
assert result2.get("type") == FlowResultType.FORM
|
||||
assert result2.get("step_id") == SOURCE_USER
|
||||
assert result2.get("errors") == {CONF_SENSOR_ID: "invalid_sensor"}
|
||||
assert "flow_id" in result2
|
||||
@ -106,7 +102,7 @@ async def test_invalid_sensor(
|
||||
user_input={CONF_SENSOR_ID: 12345},
|
||||
)
|
||||
|
||||
assert result3.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result3.get("title") == "12345"
|
||||
assert result3.get("data") == {
|
||||
CONF_SENSOR_ID: 12345,
|
||||
@ -124,7 +120,7 @@ async def test_step_user(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -136,7 +132,7 @@ async def test_step_user(
|
||||
},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result2.get("title") == "12345"
|
||||
assert result2.get("data") == {
|
||||
CONF_SENSOR_ID: 12345,
|
||||
|
@ -4,7 +4,7 @@ from unittest.mock import patch
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.mill.const import CLOUD, CONNECTION_TYPE, DOMAIN, LOCAL
|
||||
from homeassistant.const import CONF_IP_ADDRESS, CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_FORM
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -15,7 +15,7 @@ async def test_show_config_form(hass):
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ async def test_create_entry(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -33,7 +33,7 @@ async def test_create_entry(hass):
|
||||
CONNECTION_TYPE: CLOUD,
|
||||
},
|
||||
)
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
|
||||
with patch("mill.Mill.connect", return_value=True):
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -72,7 +72,7 @@ async def test_flow_entry_already_exists(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -81,7 +81,7 @@ async def test_flow_entry_already_exists(hass):
|
||||
CONNECTION_TYPE: CLOUD,
|
||||
},
|
||||
)
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
|
||||
with patch("mill.Mill.connect", return_value=True):
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -99,7 +99,7 @@ async def test_connection_error(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -108,7 +108,7 @@ async def test_connection_error(hass):
|
||||
CONNECTION_TYPE: CLOUD,
|
||||
},
|
||||
)
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
|
||||
with patch("mill.Mill.connect", return_value=False):
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -119,7 +119,7 @@ async def test_connection_error(hass):
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -128,7 +128,7 @@ async def test_local_create_entry(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -137,7 +137,7 @@ async def test_local_create_entry(hass):
|
||||
CONNECTION_TYPE: LOCAL,
|
||||
},
|
||||
)
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
|
||||
test_data = {
|
||||
CONF_IP_ADDRESS: "192.168.1.59",
|
||||
@ -180,7 +180,7 @@ async def test_local_flow_entry_already_exists(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -189,7 +189,7 @@ async def test_local_flow_entry_already_exists(hass):
|
||||
CONNECTION_TYPE: LOCAL,
|
||||
},
|
||||
)
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
|
||||
test_data = {
|
||||
CONF_IP_ADDRESS: "192.168.1.59",
|
||||
@ -219,7 +219,7 @@ async def test_local_connection_error(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -228,7 +228,7 @@ async def test_local_connection_error(hass):
|
||||
CONNECTION_TYPE: LOCAL,
|
||||
},
|
||||
)
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
|
||||
test_data = {
|
||||
CONF_IP_ADDRESS: "192.168.1.59",
|
||||
@ -243,5 +243,5 @@ async def test_local_connection_error(hass):
|
||||
test_data,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
@ -6,7 +6,7 @@ import pytest
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.min_max.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_CREATE_ENTRY, RESULT_TYPE_FORM
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -19,7 +19,7 @@ async def test_config_flow(hass: HomeAssistant, platform) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
with patch(
|
||||
@ -32,7 +32,7 @@ async def test_config_flow(hass: HomeAssistant, platform) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "My min_max"
|
||||
assert result["data"] == {}
|
||||
assert result["options"] == {
|
||||
@ -92,7 +92,7 @@ async def test_options(hass: HomeAssistant, platform) -> None:
|
||||
await hass.async_block_till_done()
|
||||
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
schema = result["data_schema"].schema
|
||||
assert get_suggested(schema, "entity_ids") == input_sensors1
|
||||
@ -107,7 +107,7 @@ async def test_options(hass: HomeAssistant, platform) -> None:
|
||||
"type": "mean",
|
||||
},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == {
|
||||
"entity_ids": input_sensors2,
|
||||
"name": "My min_max",
|
||||
|
@ -14,11 +14,7 @@ from homeassistant.components.minecraft_server.const import (
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -86,7 +82,7 @@ async def test_show_config_form(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
@ -97,7 +93,7 @@ async def test_invalid_ip(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=USER_INPUT_IPV4
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "invalid_ip"}
|
||||
|
||||
|
||||
@ -122,7 +118,7 @@ async def test_same_host(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=USER_INPUT
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -136,7 +132,7 @@ async def test_port_too_small(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=USER_INPUT_PORT_TOO_SMALL
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "invalid_port"}
|
||||
|
||||
|
||||
@ -150,7 +146,7 @@ async def test_port_too_large(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=USER_INPUT_PORT_TOO_LARGE
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "invalid_port"}
|
||||
|
||||
|
||||
@ -164,7 +160,7 @@ async def test_connection_failed(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=USER_INPUT
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -178,7 +174,7 @@ async def test_connection_succeeded_with_srv_record(hass: HomeAssistant) -> None
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=USER_INPUT_SRV
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == USER_INPUT_SRV[CONF_HOST]
|
||||
assert result["data"][CONF_NAME] == USER_INPUT_SRV[CONF_NAME]
|
||||
assert result["data"][CONF_HOST] == USER_INPUT_SRV[CONF_HOST]
|
||||
@ -194,7 +190,7 @@ async def test_connection_succeeded_with_host(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=USER_INPUT
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == USER_INPUT[CONF_HOST]
|
||||
assert result["data"][CONF_NAME] == USER_INPUT[CONF_NAME]
|
||||
assert result["data"][CONF_HOST] == "mc.dummyserver.com"
|
||||
@ -213,7 +209,7 @@ async def test_connection_succeeded_with_ip4(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=USER_INPUT_IPV4
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == USER_INPUT_IPV4[CONF_HOST]
|
||||
assert result["data"][CONF_NAME] == USER_INPUT_IPV4[CONF_NAME]
|
||||
assert result["data"][CONF_HOST] == "1.1.1.1"
|
||||
@ -232,7 +228,7 @@ async def test_connection_succeeded_with_ip6(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=USER_INPUT_IPV6
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == USER_INPUT_IPV6[CONF_HOST]
|
||||
assert result["data"][CONF_NAME] == USER_INPUT_IPV6[CONF_NAME]
|
||||
assert result["data"][CONF_HOST] == "::ffff:0101:0101"
|
||||
|
@ -20,11 +20,7 @@ from homeassistant.const import (
|
||||
HTTP_BASIC_AUTHENTICATION,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -39,7 +35,7 @@ async def test_full_user_flow(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -55,7 +51,7 @@ async def test_full_user_flow(
|
||||
},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result2.get("title") == "Spy cam"
|
||||
assert result2.get("data") == {}
|
||||
assert result2.get("options") == {
|
||||
@ -85,7 +81,7 @@ async def test_full_flow_with_authentication_error(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -102,7 +98,7 @@ async def test_full_flow_with_authentication_error(
|
||||
},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_FORM
|
||||
assert result2.get("type") == FlowResultType.FORM
|
||||
assert result2.get("step_id") == SOURCE_USER
|
||||
assert result2.get("errors") == {"username": "invalid_auth"}
|
||||
assert "flow_id" in result2
|
||||
@ -121,7 +117,7 @@ async def test_full_flow_with_authentication_error(
|
||||
},
|
||||
)
|
||||
|
||||
assert result3.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result3.get("title") == "Sky cam"
|
||||
assert result3.get("data") == {}
|
||||
assert result3.get("options") == {
|
||||
@ -147,7 +143,7 @@ async def test_connection_error(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -164,7 +160,7 @@ async def test_connection_error(
|
||||
},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_FORM
|
||||
assert result2.get("type") == FlowResultType.FORM
|
||||
assert result2.get("step_id") == SOURCE_USER
|
||||
assert result2.get("errors") == {"mjpeg_url": "cannot_connect"}
|
||||
assert "flow_id" in result2
|
||||
@ -188,7 +184,7 @@ async def test_connection_error(
|
||||
},
|
||||
)
|
||||
|
||||
assert result3.get("type") == RESULT_TYPE_FORM
|
||||
assert result3.get("type") == FlowResultType.FORM
|
||||
assert result3.get("step_id") == SOURCE_USER
|
||||
assert result3.get("errors") == {"still_image_url": "cannot_connect"}
|
||||
assert "flow_id" in result3
|
||||
@ -209,7 +205,7 @@ async def test_connection_error(
|
||||
},
|
||||
)
|
||||
|
||||
assert result4.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result4.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result4.get("title") == "My cam"
|
||||
assert result4.get("data") == {}
|
||||
assert result4.get("options") == {
|
||||
@ -247,7 +243,7 @@ async def test_already_configured(
|
||||
},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_ABORT
|
||||
assert result2.get("type") == FlowResultType.ABORT
|
||||
assert result2.get("reason") == "already_configured"
|
||||
|
||||
|
||||
@ -259,7 +255,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") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == "init"
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -288,7 +284,7 @@ async def test_options_flow(
|
||||
},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_FORM
|
||||
assert result2.get("type") == FlowResultType.FORM
|
||||
assert result2.get("step_id") == "init"
|
||||
assert result2.get("errors") == {"mjpeg_url": "already_configured"}
|
||||
assert "flow_id" in result2
|
||||
@ -307,7 +303,7 @@ async def test_options_flow(
|
||||
},
|
||||
)
|
||||
|
||||
assert result3.get("type") == RESULT_TYPE_FORM
|
||||
assert result3.get("type") == FlowResultType.FORM
|
||||
assert result3.get("step_id") == "init"
|
||||
assert result3.get("errors") == {"mjpeg_url": "cannot_connect"}
|
||||
assert "flow_id" in result3
|
||||
@ -326,7 +322,7 @@ async def test_options_flow(
|
||||
},
|
||||
)
|
||||
|
||||
assert result4.get("type") == RESULT_TYPE_FORM
|
||||
assert result4.get("type") == FlowResultType.FORM
|
||||
assert result4.get("step_id") == "init"
|
||||
assert result4.get("errors") == {"still_image_url": "cannot_connect"}
|
||||
assert "flow_id" in result4
|
||||
@ -346,7 +342,7 @@ async def test_options_flow(
|
||||
},
|
||||
)
|
||||
|
||||
assert result5.get("type") == RESULT_TYPE_FORM
|
||||
assert result5.get("type") == FlowResultType.FORM
|
||||
assert result5.get("step_id") == "init"
|
||||
assert result5.get("errors") == {"username": "invalid_auth"}
|
||||
assert "flow_id" in result5
|
||||
@ -363,7 +359,7 @@ async def test_options_flow(
|
||||
},
|
||||
)
|
||||
|
||||
assert result6.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result6.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result6.get("data") == {
|
||||
CONF_AUTHENTICATION: HTTP_BASIC_AUTHENTICATION,
|
||||
CONF_MJPEG_URL: "https://example.com/mjpeg",
|
||||
|
@ -9,11 +9,7 @@ from homeassistant.components.modern_forms.const import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_USER, SOURCE_ZEROCONF
|
||||
from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME, CONTENT_TYPE_JSON
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import init_integration
|
||||
|
||||
@ -37,7 +33,7 @@ async def test_full_user_flow_implementation(
|
||||
)
|
||||
|
||||
assert result.get("step_id") == "user"
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert "flow_id" in result
|
||||
|
||||
with patch(
|
||||
@ -50,7 +46,7 @@ async def test_full_user_flow_implementation(
|
||||
|
||||
assert result2.get("title") == "ModernFormsFan"
|
||||
assert "data" in result2
|
||||
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == 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
|
||||
@ -85,7 +81,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") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert "flow_id" in result
|
||||
|
||||
flow = flows[0]
|
||||
@ -98,7 +94,7 @@ async def test_full_zeroconf_flow_implementation(
|
||||
)
|
||||
|
||||
assert result2.get("title") == "example"
|
||||
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
||||
|
||||
assert "data" in result2
|
||||
assert result2["data"][CONF_HOST] == "192.168.1.123"
|
||||
@ -121,7 +117,7 @@ async def test_connection_error(
|
||||
data={CONF_HOST: "example.com"},
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == "user"
|
||||
assert result.get("errors") == {"base": "cannot_connect"}
|
||||
|
||||
@ -150,7 +146,7 @@ async def test_zeroconf_connection_error(
|
||||
),
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_ABORT
|
||||
assert result.get("type") == FlowResultType.ABORT
|
||||
assert result.get("reason") == "cannot_connect"
|
||||
|
||||
|
||||
@ -182,7 +178,7 @@ async def test_zeroconf_confirm_connection_error(
|
||||
),
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_ABORT
|
||||
assert result.get("type") == FlowResultType.ABORT
|
||||
assert result.get("reason") == "cannot_connect"
|
||||
|
||||
|
||||
@ -218,7 +214,7 @@ async def test_user_device_exists_abort(
|
||||
},
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_ABORT
|
||||
assert result.get("type") == FlowResultType.ABORT
|
||||
assert result.get("reason") == "already_configured"
|
||||
|
||||
|
||||
@ -252,5 +248,5 @@ async def test_zeroconf_with_mac_device_exists_abort(
|
||||
),
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_ABORT
|
||||
assert result.get("type") == FlowResultType.ABORT
|
||||
assert result.get("reason") == "already_configured"
|
||||
|
@ -5,11 +5,7 @@ from unittest.mock import patch
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.moehlenhoff_alpha2.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -33,7 +29,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_USER},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert not result["errors"]
|
||||
|
||||
with patch("moehlenhoff_alpha2.Alpha2Base.update_data", mock_update_data), patch(
|
||||
@ -46,7 +42,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == MOCK_BASE_NAME
|
||||
assert result2["data"] == {"host": MOCK_BASE_HOST}
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
@ -70,7 +66,7 @@ async def test_form_duplicate_error(hass: HomeAssistant) -> None:
|
||||
data={"host": MOCK_BASE_HOST},
|
||||
context={"source": config_entries.SOURCE_USER},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -87,7 +83,7 @@ async def test_form_cannot_connect_error(hass: HomeAssistant) -> None:
|
||||
user_input={"host": MOCK_BASE_HOST},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -102,5 +98,5 @@ async def test_form_unexpected_error(hass: HomeAssistant) -> None:
|
||||
user_input={"host": MOCK_BASE_HOST},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "unknown"}
|
||||
|
@ -7,11 +7,7 @@ from homeassistant.components.moon.const import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_USER
|
||||
from homeassistant.const import CONF_NAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -25,7 +21,7 @@ async def test_full_user_flow(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -34,7 +30,7 @@ async def test_full_user_flow(
|
||||
user_input={},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result2.get("title") == "Moon"
|
||||
assert result2.get("data") == {}
|
||||
|
||||
@ -52,7 +48,7 @@ async def test_single_instance_allowed(
|
||||
DOMAIN, context={"source": source}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_ABORT
|
||||
assert result.get("type") == FlowResultType.ABORT
|
||||
assert result.get("reason") == "single_instance_allowed"
|
||||
|
||||
|
||||
@ -67,6 +63,6 @@ async def test_import_flow(
|
||||
data={CONF_NAME: "My Moon"},
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result.get("title") == "My Moon"
|
||||
assert result.get("data") == {}
|
||||
|
@ -5,7 +5,7 @@ from mullvad_api import MullvadAPIError
|
||||
|
||||
from homeassistant import config_entries, setup
|
||||
from homeassistant.components.mullvad.const import DOMAIN
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_ABORT, RESULT_TYPE_FORM
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -16,7 +16,7 @@ async def test_form_user(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert not result["errors"]
|
||||
|
||||
with patch(
|
||||
@ -45,7 +45,7 @@ async def test_form_user_only_once(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ async def test_connection_error(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -87,5 +87,5 @@ async def test_unknown_error(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "unknown"}
|
||||
|
@ -6,11 +6,7 @@ from pynzbgetapi import NZBGetAPIException
|
||||
from homeassistant.components.nzbget.const import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.const import CONF_SCAN_INTERVAL, CONF_VERIFY_SSL
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import (
|
||||
ENTRY_CONFIG,
|
||||
@ -30,7 +26,7 @@ async def test_user_form(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with _patch_version(), _patch_status(), _patch_history(), _patch_async_setup_entry() as mock_setup_entry:
|
||||
@ -40,7 +36,7 @@ async def test_user_form(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "10.10.10.30"
|
||||
assert result["data"] == {**USER_INPUT, CONF_VERIFY_SSL: False}
|
||||
|
||||
@ -53,7 +49,7 @@ async def test_user_form_show_advanced_options(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER, "show_advanced_options": True}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
user_input_advanced = {
|
||||
@ -68,7 +64,7 @@ async def test_user_form_show_advanced_options(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "10.10.10.30"
|
||||
assert result["data"] == {**USER_INPUT, CONF_VERIFY_SSL: True}
|
||||
|
||||
@ -90,7 +86,7 @@ async def test_user_form_cannot_connect(hass):
|
||||
USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -109,7 +105,7 @@ async def test_user_form_unexpected_exception(hass):
|
||||
USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "unknown"
|
||||
|
||||
|
||||
@ -123,7 +119,7 @@ async def test_user_form_single_instance_allowed(hass):
|
||||
context={"source": SOURCE_USER},
|
||||
data=USER_INPUT,
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "single_instance_allowed"
|
||||
|
||||
|
||||
@ -143,7 +139,7 @@ async def test_options_flow(hass, nzbget_api):
|
||||
assert entry.options[CONF_SCAN_INTERVAL] == 5
|
||||
|
||||
result = await hass.config_entries.options.async_init(entry.entry_id)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
with _patch_async_setup_entry():
|
||||
@ -153,5 +149,5 @@ async def test_options_flow(hass, nzbget_api):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"][CONF_SCAN_INTERVAL] == 15
|
||||
|
@ -7,11 +7,7 @@ from aiooncue import LoginFailedException
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.oncue.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -21,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"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch("homeassistant.components.oncue.config_flow.Oncue.async_login"), patch(
|
||||
@ -37,7 +33,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "test-username"
|
||||
assert result2["data"] == {
|
||||
"username": "TEST-username",
|
||||
@ -64,7 +60,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
|
||||
@ -86,7 +82,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -108,7 +104,7 @@ async def test_form_unknown_exception(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "unknown"}
|
||||
|
||||
|
||||
@ -137,5 +133,5 @@ async def test_already_configured(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_ABORT
|
||||
assert result2["type"] == FlowResultType.ABORT
|
||||
assert result2["reason"] == "already_configured"
|
||||
|
@ -8,11 +8,7 @@ from homeassistant.components.onewire.const import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_USER, ConfigEntry
|
||||
from homeassistant.const import CONF_HOST, CONF_PORT
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True, name="mock_setup_entry")
|
||||
@ -29,7 +25,7 @@ async def test_user_flow(hass: HomeAssistant, mock_setup_entry: AsyncMock):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert not result["errors"]
|
||||
|
||||
# Invalid server
|
||||
@ -42,7 +38,7 @@ async def test_user_flow(hass: HomeAssistant, mock_setup_entry: AsyncMock):
|
||||
user_input={CONF_HOST: "1.2.3.4", CONF_PORT: 1234},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
@ -55,7 +51,7 @@ async def test_user_flow(hass: HomeAssistant, mock_setup_entry: AsyncMock):
|
||||
user_input={CONF_HOST: "1.2.3.4", CONF_PORT: 1234},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "1.2.3.4"
|
||||
assert result["data"] == {
|
||||
CONF_HOST: "1.2.3.4",
|
||||
@ -76,7 +72,7 @@ async def test_user_duplicate(
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert not result["errors"]
|
||||
|
||||
@ -85,7 +81,7 @@ async def test_user_duplicate(
|
||||
result["flow_id"],
|
||||
user_input={CONF_HOST: "1.2.3.4", CONF_PORT: 1234},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
await hass.async_block_till_done()
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
@ -8,11 +8,7 @@ from homeassistant.components.onewire.const import (
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import setup_owproxy_mock_devices
|
||||
from .const import MOCK_OWPROXY_DEVICES
|
||||
@ -49,7 +45,7 @@ async def test_user_options_clear(
|
||||
result["flow_id"],
|
||||
user_input={INPUT_ENTRY_CLEAR_OPTIONS: True},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == {}
|
||||
|
||||
|
||||
@ -78,7 +74,7 @@ async def test_user_options_empty_selection(
|
||||
result["flow_id"],
|
||||
user_input={INPUT_ENTRY_DEVICE_SELECTION: []},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "device_selection"
|
||||
assert result["errors"] == {"base": "device_not_selected"}
|
||||
|
||||
@ -111,7 +107,7 @@ async def test_user_options_set_single(
|
||||
result["flow_id"],
|
||||
user_input={INPUT_ENTRY_DEVICE_SELECTION: ["28.111111111111"]},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == 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
|
||||
@ -119,7 +115,7 @@ async def test_user_options_set_single(
|
||||
result["flow_id"],
|
||||
user_input={},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert (
|
||||
result["data"]["device_options"]["28.111111111111"]["precision"]
|
||||
== "temperature"
|
||||
@ -167,7 +163,7 @@ async def test_user_options_set_multiple(
|
||||
]
|
||||
},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert (
|
||||
result["description_placeholders"]["sensor_id"]
|
||||
== "Given Name (28.222222222222)"
|
||||
@ -178,7 +174,7 @@ async def test_user_options_set_multiple(
|
||||
result["flow_id"],
|
||||
user_input={"precision": "temperature"},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert (
|
||||
result["description_placeholders"]["sensor_id"]
|
||||
== "Given Name (28.111111111111)"
|
||||
@ -189,7 +185,7 @@ async def test_user_options_set_multiple(
|
||||
result["flow_id"],
|
||||
user_input={"precision": "temperature9"},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert (
|
||||
result["data"]["device_options"]["28.222222222222"]["precision"]
|
||||
== "temperature"
|
||||
@ -213,5 +209,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"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "No configurable devices found."
|
||||
|
@ -7,7 +7,7 @@ from homeassistant.components.zone import ENTITY_ID_HOME
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.const import CONF_ZONE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_CREATE_ENTRY, RESULT_TYPE_FORM
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
|
||||
async def test_full_user_flow(
|
||||
@ -19,7 +19,7 @@ async def test_full_user_flow(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -28,6 +28,6 @@ async def test_full_user_flow(
|
||||
user_input={CONF_ZONE: ENTITY_ID_HOME},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result2.get("title") == "test home"
|
||||
assert result2.get("data") == {CONF_ZONE: ENTITY_ID_HOME}
|
||||
|
@ -6,11 +6,7 @@ import aiohttp
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.opengarage.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -21,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"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
with patch(
|
||||
@ -37,7 +33,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "Name of the device"
|
||||
assert result2["data"] == {
|
||||
"host": "http://1.1.1.1",
|
||||
@ -63,7 +59,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None:
|
||||
{"host": "http://1.1.1.1", "device_key": "AfsasdnfkjDD"},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
|
||||
@ -82,7 +78,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None:
|
||||
{"host": "http://1.1.1.1", "device_key": "AfsasdnfkjDD"},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -101,7 +97,7 @@ async def test_form_unknown_error(hass: HomeAssistant) -> None:
|
||||
{"host": "http://1.1.1.1", "device_key": "AfsasdnfkjDD"},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "unknown"}
|
||||
|
||||
|
||||
@ -132,5 +128,5 @@ async def test_flow_entry_already_exists(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
@ -7,7 +7,7 @@ from homeassistant.components.p1_monitor.const import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_CREATE_ENTRY, RESULT_TYPE_FORM
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
|
||||
async def test_full_user_flow(hass: HomeAssistant) -> None:
|
||||
@ -16,7 +16,7 @@ async def test_full_user_flow(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -33,7 +33,7 @@ async def test_full_user_flow(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result2.get("title") == "Name"
|
||||
assert result2.get("data") == {
|
||||
CONF_HOST: "example.com",
|
||||
@ -58,5 +58,5 @@ async def test_api_error(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("errors") == {"base": "cannot_connect"}
|
||||
|
@ -7,7 +7,7 @@ from voluptuous.error import MultipleInvalid
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.peco.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_CREATE_ENTRY, RESULT_TYPE_FORM
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
|
||||
async def test_form(hass: HomeAssistant) -> None:
|
||||
@ -15,7 +15,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
with patch(
|
||||
@ -30,7 +30,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "Philadelphia Outage Count"
|
||||
assert result2["data"] == {
|
||||
"county": "PHILADELPHIA",
|
||||
@ -42,7 +42,7 @@ async def test_invalid_county(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
with raises(MultipleInvalid):
|
||||
@ -57,7 +57,7 @@ async def test_invalid_county(hass: HomeAssistant) -> None:
|
||||
second_result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert second_result["type"] == RESULT_TYPE_FORM
|
||||
assert second_result["type"] == FlowResultType.FORM
|
||||
assert second_result["errors"] is None
|
||||
|
||||
with patch(
|
||||
@ -72,7 +72,7 @@ async def test_invalid_county(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert second_result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert second_result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert second_result2["title"] == "Philadelphia Outage Count"
|
||||
assert second_result2["data"] == {
|
||||
"county": "PHILADELPHIA",
|
||||
|
@ -5,11 +5,7 @@ from unittest.mock import patch
|
||||
from homeassistant.components.pi_hole.const import CONF_STATISTICS_ONLY, DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_USER
|
||||
from homeassistant.const import CONF_API_KEY
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import (
|
||||
CONF_CONFIG_ENTRY,
|
||||
@ -44,7 +40,7 @@ async def test_flow_import(hass, caplog):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_IMPORT}, data=CONF_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == NAME
|
||||
assert result["data"] == CONF_CONFIG_ENTRY
|
||||
|
||||
@ -52,7 +48,7 @@ async def test_flow_import(hass, caplog):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_IMPORT}, data=CONF_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -63,7 +59,7 @@ async def test_flow_import_invalid(hass, caplog):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_IMPORT}, data=CONF_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "cannot_connect"
|
||||
assert len([x for x in caplog.records if x.levelno == logging.ERROR]) == 1
|
||||
|
||||
@ -76,7 +72,7 @@ async def test_flow_user(hass):
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_USER},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {}
|
||||
_flow_next(hass, result["flow_id"])
|
||||
@ -85,7 +81,7 @@ async def test_flow_user(hass):
|
||||
result["flow_id"],
|
||||
user_input=CONF_CONFIG_FLOW_USER,
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "api_key"
|
||||
assert result["errors"] is None
|
||||
_flow_next(hass, result["flow_id"])
|
||||
@ -94,7 +90,7 @@ async def test_flow_user(hass):
|
||||
result["flow_id"],
|
||||
user_input=CONF_CONFIG_FLOW_API_KEY,
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == NAME
|
||||
assert result["data"] == CONF_CONFIG_ENTRY
|
||||
|
||||
@ -104,7 +100,7 @@ async def test_flow_user(hass):
|
||||
context={"source": SOURCE_USER},
|
||||
data=CONF_CONFIG_FLOW_USER,
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -116,7 +112,7 @@ async def test_flow_statistics_only(hass):
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_USER},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {}
|
||||
_flow_next(hass, result["flow_id"])
|
||||
@ -130,7 +126,7 @@ async def test_flow_statistics_only(hass):
|
||||
result["flow_id"],
|
||||
user_input=user_input,
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == NAME
|
||||
assert result["data"] == config_entry_data
|
||||
|
||||
@ -142,6 +138,6 @@ async def test_flow_user_invalid(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=CONF_CONFIG_FLOW_USER
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
@ -12,11 +12,7 @@ from homeassistant.components.plaato.const import (
|
||||
DOMAIN,
|
||||
)
|
||||
from homeassistant.const import CONF_SCAN_INTERVAL, CONF_TOKEN, CONF_WEBHOOK_ID
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
@ -59,7 +55,7 @@ async def test_show_config_form_device_type_airlock(hass):
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "api_method"
|
||||
assert result["data_schema"].schema.get(CONF_TOKEN) == str
|
||||
assert result["data_schema"].schema.get(CONF_USE_WEBHOOK) == bool
|
||||
@ -73,7 +69,7 @@ async def test_show_config_form_device_type_keg(hass):
|
||||
data={CONF_DEVICE_TYPE: PlaatoDeviceType.Keg, CONF_DEVICE_NAME: "device_name"},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "api_method"
|
||||
assert result["data_schema"].schema.get(CONF_TOKEN) == str
|
||||
assert result["data_schema"].schema.get(CONF_USE_WEBHOOK) is None
|
||||
@ -86,7 +82,7 @@ async def test_show_config_form_validate_webhook(hass, webhook_id):
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -97,7 +93,7 @@ async def test_show_config_form_validate_webhook(hass, webhook_id):
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "api_method"
|
||||
|
||||
assert await async_setup_component(hass, "cloud", {})
|
||||
@ -119,7 +115,7 @@ async def test_show_config_form_validate_webhook(hass, webhook_id):
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "webhook"
|
||||
|
||||
|
||||
@ -130,7 +126,7 @@ async def test_show_config_form_validate_webhook_not_connected(hass, webhook_id)
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -141,7 +137,7 @@ async def test_show_config_form_validate_webhook_not_connected(hass, webhook_id)
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "api_method"
|
||||
|
||||
assert await async_setup_component(hass, "cloud", {})
|
||||
@ -163,7 +159,7 @@ async def test_show_config_form_validate_webhook_not_connected(hass, webhook_id)
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "cloud_not_connected"
|
||||
|
||||
|
||||
@ -182,7 +178,7 @@ async def test_show_config_form_validate_token(hass):
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "api_method"
|
||||
|
||||
with patch("homeassistant.components.plaato.async_setup_entry", return_value=True):
|
||||
@ -190,7 +186,7 @@ async def test_show_config_form_validate_token(hass):
|
||||
result["flow_id"], user_input={CONF_TOKEN: "valid_token"}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == PlaatoDeviceType.Keg.name
|
||||
assert result["data"] == {
|
||||
CONF_USE_WEBHOOK: False,
|
||||
@ -215,7 +211,7 @@ async def test_show_config_form_no_cloud_webhook(hass, webhook_id):
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "api_method"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -226,7 +222,7 @@ async def test_show_config_form_no_cloud_webhook(hass, webhook_id):
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "webhook"
|
||||
assert result["errors"] is None
|
||||
|
||||
@ -247,14 +243,14 @@ async def test_show_config_form_api_method_no_auth_token(hass, webhook_id):
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "api_method"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={CONF_TOKEN: ""}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "api_method"
|
||||
assert len(result["errors"]) == 1
|
||||
assert result["errors"]["base"] == "no_auth_token"
|
||||
@ -272,14 +268,14 @@ async def test_show_config_form_api_method_no_auth_token(hass, webhook_id):
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "api_method"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={CONF_TOKEN: ""}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "api_method"
|
||||
assert len(result["errors"]) == 1
|
||||
assert result["errors"]["base"] == "no_api_method"
|
||||
|
@ -12,7 +12,7 @@ from homeassistant import config_entries
|
||||
from homeassistant.components import dhcp
|
||||
from homeassistant.components.powerwall.const import DOMAIN
|
||||
from homeassistant.const import CONF_IP_ADDRESS, CONF_PASSWORD
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_ABORT
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from .mocks import (
|
||||
MOCK_GATEWAY_DIN,
|
||||
@ -299,7 +299,7 @@ async def test_dhcp_discovery_cannot_connect(hass):
|
||||
hostname="00GGX",
|
||||
),
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "cannot_connect"
|
||||
|
||||
|
||||
@ -370,7 +370,7 @@ async def test_dhcp_discovery_update_ip_address(hass):
|
||||
),
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
assert entry.data[CONF_IP_ADDRESS] == "1.1.1.1"
|
||||
|
||||
@ -402,7 +402,7 @@ async def test_dhcp_discovery_updates_unique_id(hass):
|
||||
),
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
assert entry.data[CONF_IP_ADDRESS] == "1.2.3.4"
|
||||
assert entry.unique_id == MOCK_GATEWAY_DIN
|
||||
|
@ -4,11 +4,7 @@ from unittest.mock import patch
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.progettihwsw.const import DOMAIN
|
||||
from homeassistant.const import CONF_HOST, CONF_PORT
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -26,7 +22,7 @@ async def test_form(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {}
|
||||
|
||||
@ -43,7 +39,7 @@ async def test_form(hass):
|
||||
{CONF_HOST: "", CONF_PORT: 80},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["step_id"] == "relay_modes"
|
||||
assert result2["errors"] == {}
|
||||
|
||||
@ -56,7 +52,7 @@ async def test_form(hass):
|
||||
mock_value_step_rm,
|
||||
)
|
||||
|
||||
assert result3["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result3["data"]
|
||||
assert result3["data"]["title"] == "1R & 1IN Board"
|
||||
assert result3["data"]["is_old"] is False
|
||||
@ -80,7 +76,7 @@ async def test_form_cannot_connect(hass):
|
||||
{CONF_HOST: "", CONF_PORT: 80},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["step_id"] == "user"
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
@ -107,7 +103,7 @@ async def test_form_existing_entry_exception(hass):
|
||||
{CONF_HOST: "", CONF_PORT: 80},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_ABORT
|
||||
assert result2["type"] == FlowResultType.ABORT
|
||||
assert result2["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -128,6 +124,6 @@ async def test_form_user_exception(hass):
|
||||
{CONF_HOST: "", CONF_PORT: 80},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["step_id"] == "user"
|
||||
assert result2["errors"] == {"base": "unknown"}
|
||||
|
@ -6,7 +6,7 @@ from pytest import mark
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.prosegur.config_flow import CannotConnect, InvalidAuth
|
||||
from homeassistant.components.prosegur.const import DOMAIN
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_ABORT, RESULT_TYPE_FORM
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -145,7 +145,7 @@ async def test_reauth_flow(hass):
|
||||
data=entry.data,
|
||||
)
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
install = MagicMock()
|
||||
@ -167,7 +167,7 @@ async def test_reauth_flow(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_ABORT
|
||||
assert result2["type"] == FlowResultType.ABORT
|
||||
assert result2["reason"] == "reauth_successful"
|
||||
assert entry.data == {
|
||||
"country": "PT",
|
||||
@ -223,5 +223,5 @@ async def test_reauth_flow_error(hass, exception, base_error):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"]["base"] == base_error
|
||||
|
@ -8,11 +8,7 @@ from homeassistant.components.pure_energie.const import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_USER, SOURCE_ZEROCONF
|
||||
from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
|
||||
async def test_full_user_flow_implementation(
|
||||
@ -27,7 +23,7 @@ async def test_full_user_flow_implementation(
|
||||
)
|
||||
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert "flow_id" in result
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -35,7 +31,7 @@ async def test_full_user_flow_implementation(
|
||||
)
|
||||
|
||||
assert result.get("title") == "Pure Energie Meter"
|
||||
assert result.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert "data" in result
|
||||
assert result["data"][CONF_HOST] == "192.168.1.123"
|
||||
assert "result" in result
|
||||
@ -67,7 +63,7 @@ async def test_full_zeroconf_flow_implementationn(
|
||||
CONF_NAME: "Pure Energie Meter",
|
||||
}
|
||||
assert result.get("step_id") == "zeroconf_confirm"
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert "flow_id" in result
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -75,7 +71,7 @@ async def test_full_zeroconf_flow_implementationn(
|
||||
)
|
||||
|
||||
assert result2.get("title") == "Pure Energie Meter"
|
||||
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
||||
|
||||
assert "data" in result2
|
||||
assert result2["data"][CONF_HOST] == "192.168.1.123"
|
||||
@ -94,7 +90,7 @@ async def test_connection_error(
|
||||
data={CONF_HOST: "example.com"},
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == "user"
|
||||
assert result.get("errors") == {"base": "cannot_connect"}
|
||||
|
||||
@ -119,5 +115,5 @@ async def test_zeroconf_connection_error(
|
||||
),
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_ABORT
|
||||
assert result.get("type") == FlowResultType.ABORT
|
||||
assert result.get("reason") == "cannot_connect"
|
||||
|
@ -8,11 +8,7 @@ from homeassistant.components.pvoutput.const import CONF_SYSTEM_ID, DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_REAUTH, SOURCE_USER
|
||||
from homeassistant.const import CONF_API_KEY
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -27,7 +23,7 @@ async def test_full_user_flow(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -39,7 +35,7 @@ async def test_full_user_flow(
|
||||
},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result2.get("title") == "12345"
|
||||
assert result2.get("data") == {
|
||||
CONF_SYSTEM_ID: 12345,
|
||||
@ -64,7 +60,7 @@ async def test_full_flow_with_authentication_error(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -77,7 +73,7 @@ async def test_full_flow_with_authentication_error(
|
||||
},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_FORM
|
||||
assert result2.get("type") == FlowResultType.FORM
|
||||
assert result2.get("step_id") == SOURCE_USER
|
||||
assert result2.get("errors") == {"base": "invalid_auth"}
|
||||
assert "flow_id" in result2
|
||||
@ -94,7 +90,7 @@ async def test_full_flow_with_authentication_error(
|
||||
},
|
||||
)
|
||||
|
||||
assert result3.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result3.get("title") == "12345"
|
||||
assert result3.get("data") == {
|
||||
CONF_SYSTEM_ID: 12345,
|
||||
@ -120,7 +116,7 @@ async def test_connection_error(
|
||||
},
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("errors") == {"base": "cannot_connect"}
|
||||
|
||||
assert len(mock_pvoutput_config_flow.system.mock_calls) == 1
|
||||
@ -147,7 +143,7 @@ async def test_already_configured(
|
||||
},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_ABORT
|
||||
assert result2.get("type") == FlowResultType.ABORT
|
||||
assert result2.get("reason") == "already_configured"
|
||||
|
||||
|
||||
@ -169,7 +165,7 @@ async def test_reauth_flow(
|
||||
},
|
||||
data=mock_config_entry.data,
|
||||
)
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == "reauth_confirm"
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -179,7 +175,7 @@ async def test_reauth_flow(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_ABORT
|
||||
assert result2.get("type") == FlowResultType.ABORT
|
||||
assert result2.get("reason") == "reauth_successful"
|
||||
assert mock_config_entry.data == {
|
||||
CONF_SYSTEM_ID: 12345,
|
||||
@ -212,7 +208,7 @@ async def test_reauth_with_authentication_error(
|
||||
},
|
||||
data=mock_config_entry.data,
|
||||
)
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == "reauth_confirm"
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -223,7 +219,7 @@ async def test_reauth_with_authentication_error(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_FORM
|
||||
assert result2.get("type") == FlowResultType.FORM
|
||||
assert result2.get("step_id") == "reauth_confirm"
|
||||
assert result2.get("errors") == {"base": "invalid_auth"}
|
||||
assert "flow_id" in result2
|
||||
@ -238,7 +234,7 @@ async def test_reauth_with_authentication_error(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result3.get("type") == RESULT_TYPE_ABORT
|
||||
assert result3.get("type") == FlowResultType.ABORT
|
||||
assert result3.get("reason") == "reauth_successful"
|
||||
assert mock_config_entry.data == {
|
||||
CONF_SYSTEM_ID: 12345,
|
||||
@ -266,7 +262,7 @@ async def test_reauth_api_error(
|
||||
},
|
||||
data=mock_config_entry.data,
|
||||
)
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == "reauth_confirm"
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -277,6 +273,6 @@ async def test_reauth_api_error(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_FORM
|
||||
assert result2.get("type") == FlowResultType.FORM
|
||||
assert result2.get("step_id") == "reauth_confirm"
|
||||
assert result2.get("errors") == {"base": "cannot_connect"}
|
||||
|
@ -4,11 +4,7 @@ from unittest.mock import AsyncMock
|
||||
from homeassistant.components.radio_browser.const import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -18,7 +14,7 @@ async def test_full_user_flow(hass: HomeAssistant, mock_setup_entry: AsyncMock)
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("errors") is None
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -27,7 +23,7 @@ async def test_full_user_flow(hass: HomeAssistant, mock_setup_entry: AsyncMock)
|
||||
user_input={},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result2.get("title") == "Radio Browser"
|
||||
assert result2.get("data") == {}
|
||||
|
||||
@ -46,7 +42,7 @@ async def test_already_configured(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_ABORT
|
||||
assert result.get("type") == FlowResultType.ABORT
|
||||
assert result.get("reason") == "single_instance_allowed"
|
||||
|
||||
|
||||
@ -58,7 +54,7 @@ async def test_onboarding_flow(
|
||||
DOMAIN, context={"source": "onboarding"}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result.get("title") == "Radio Browser"
|
||||
assert result.get("data") == {}
|
||||
|
||||
|
@ -12,7 +12,7 @@ from homeassistant.components.rainforest_eagle.const import (
|
||||
from homeassistant.components.rainforest_eagle.data import CannotConnect, InvalidAuth
|
||||
from homeassistant.const import CONF_HOST, CONF_TYPE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_CREATE_ENTRY, RESULT_TYPE_FORM
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
|
||||
async def test_form(hass: HomeAssistant) -> None:
|
||||
@ -21,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"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
|
||||
with patch(
|
||||
@ -41,7 +41,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "abcdef"
|
||||
assert result2["data"] == {
|
||||
CONF_TYPE: TYPE_EAGLE_200,
|
||||
@ -72,7 +72,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
|
||||
@ -95,5 +95,5 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
@ -3,7 +3,7 @@ from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.raspberry_pi.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_ABORT, RESULT_TYPE_CREATE_ENTRY
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry, MockModule, mock_integration
|
||||
|
||||
@ -20,7 +20,7 @@ async def test_config_flow(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": "system"}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "Raspberry Pi"
|
||||
assert result["data"] == {}
|
||||
assert result["options"] == {}
|
||||
@ -53,6 +53,6 @@ async def test_config_flow_single_entry(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": "system"}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "single_instance_allowed"
|
||||
mock_setup_entry.assert_not_called()
|
||||
|
@ -7,7 +7,7 @@ from vehicle.exceptions import RDWConnectionError, RDWUnknownLicensePlateError
|
||||
from homeassistant.components.rdw.const import CONF_LICENSE_PLATE, DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_CREATE_ENTRY, RESULT_TYPE_FORM
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
|
||||
async def test_full_user_flow(
|
||||
@ -18,7 +18,7 @@ async def test_full_user_flow(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -29,7 +29,7 @@ async def test_full_user_flow(
|
||||
},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result2.get("title") == "11-ZKZ-3"
|
||||
assert result2.get("data") == {CONF_LICENSE_PLATE: "11ZKZ3"}
|
||||
|
||||
@ -46,7 +46,7 @@ async def test_full_flow_with_authentication_error(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -58,7 +58,7 @@ async def test_full_flow_with_authentication_error(
|
||||
},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_FORM
|
||||
assert result2.get("type") == FlowResultType.FORM
|
||||
assert result2.get("step_id") == SOURCE_USER
|
||||
assert result2.get("errors") == {"base": "unknown_license_plate"}
|
||||
assert "flow_id" in result2
|
||||
@ -71,7 +71,7 @@ async def test_full_flow_with_authentication_error(
|
||||
},
|
||||
)
|
||||
|
||||
assert result3.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result3.get("title") == "11-ZKZ-3"
|
||||
assert result3.get("data") == {CONF_LICENSE_PLATE: "11ZKZ3"}
|
||||
|
||||
@ -88,5 +88,5 @@ async def test_connection_error(
|
||||
data={CONF_LICENSE_PLATE: "0001TJ"},
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("errors") == {"base": "cannot_connect"}
|
||||
|
@ -8,11 +8,7 @@ from homeassistant import config_entries
|
||||
from homeassistant.components.ridwell.const import DOMAIN
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
|
||||
async def test_duplicate_error(hass: HomeAssistant, config, config_entry):
|
||||
@ -20,7 +16,7 @@ async def test_duplicate_error(hass: HomeAssistant, config, config_entry):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=config
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -39,7 +35,7 @@ async def test_errors(hass: HomeAssistant, config, error, exc) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=config
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"]["base"] == error
|
||||
|
||||
|
||||
@ -48,7 +44,7 @@ async def test_show_form_user(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] is None
|
||||
|
||||
@ -66,7 +62,7 @@ async def test_step_reauth(
|
||||
result["flow_id"],
|
||||
user_input={CONF_PASSWORD: "password"},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "reauth_successful"
|
||||
assert len(hass.config_entries.async_entries()) == 1
|
||||
|
||||
@ -76,4 +72,4 @@ async def test_step_user(hass: HomeAssistant, config, setup_ridwell) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=config
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
|
@ -9,11 +9,7 @@ from homeassistant.components.roku.const import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_HOMEKIT, SOURCE_SSDP, SOURCE_USER
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_SOURCE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.roku import (
|
||||
@ -39,7 +35,7 @@ async def test_duplicate_error(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data=user_input
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
user_input = {CONF_HOST: mock_config_entry.data[CONF_HOST]}
|
||||
@ -47,7 +43,7 @@ async def test_duplicate_error(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data=user_input
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
discovery_info = dataclasses.replace(MOCK_SSDP_DISCOVERY_INFO)
|
||||
@ -55,7 +51,7 @@ async def test_duplicate_error(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_SSDP}, data=discovery_info
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -68,7 +64,7 @@ async def test_form(
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
user_input = {CONF_HOST: HOST}
|
||||
@ -77,7 +73,7 @@ async def test_form(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "My Roku 3"
|
||||
|
||||
assert "data" in result
|
||||
@ -101,7 +97,7 @@ async def test_form_cannot_connect(
|
||||
flow_id=result["flow_id"], user_input={CONF_HOST: HOST}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -120,7 +116,7 @@ async def test_form_unknown_error(
|
||||
flow_id=result["flow_id"], user_input=user_input
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "unknown"
|
||||
|
||||
|
||||
@ -137,7 +133,7 @@ async def test_homekit_cannot_connect(
|
||||
data=discovery_info,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "cannot_connect"
|
||||
|
||||
|
||||
@ -154,7 +150,7 @@ async def test_homekit_unknown_error(
|
||||
data=discovery_info,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "unknown"
|
||||
|
||||
|
||||
@ -170,7 +166,7 @@ async def test_homekit_discovery(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_HOMEKIT}, data=discovery_info
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "discovery_confirm"
|
||||
assert result["description_placeholders"] == {CONF_NAME: NAME_ROKUTV}
|
||||
|
||||
@ -179,7 +175,7 @@ async def test_homekit_discovery(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == NAME_ROKUTV
|
||||
|
||||
assert "data" in result
|
||||
@ -192,7 +188,7 @@ async def test_homekit_discovery(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_HOMEKIT}, data=discovery_info
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -209,7 +205,7 @@ async def test_ssdp_cannot_connect(
|
||||
data=discovery_info,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "cannot_connect"
|
||||
|
||||
|
||||
@ -226,7 +222,7 @@ async def test_ssdp_unknown_error(
|
||||
data=discovery_info,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "unknown"
|
||||
|
||||
|
||||
@ -241,7 +237,7 @@ async def test_ssdp_discovery(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_SSDP}, data=discovery_info
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "discovery_confirm"
|
||||
assert result["description_placeholders"] == {CONF_NAME: UPNP_FRIENDLY_NAME}
|
||||
|
||||
@ -250,7 +246,7 @@ async def test_ssdp_discovery(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == UPNP_FRIENDLY_NAME
|
||||
|
||||
assert result["data"]
|
||||
|
@ -4,11 +4,7 @@ from unittest.mock import MagicMock
|
||||
from homeassistant.components.rpi_power.const import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import patch
|
||||
|
||||
@ -21,13 +17,13 @@ async def test_setup(hass: HomeAssistant) -> None:
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_USER},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
assert not result["errors"]
|
||||
|
||||
with patch(MODULE, return_value=MagicMock()):
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
|
||||
|
||||
async def test_not_supported(hass: HomeAssistant) -> None:
|
||||
@ -39,7 +35,7 @@ async def test_not_supported(hass: HomeAssistant) -> None:
|
||||
|
||||
with patch(MODULE, return_value=None):
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "no_devices_found"
|
||||
|
||||
|
||||
@ -50,7 +46,7 @@ async def test_onboarding(hass: HomeAssistant) -> None:
|
||||
DOMAIN,
|
||||
context={"source": "onboarding"},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
|
||||
|
||||
async def test_onboarding_not_supported(hass: HomeAssistant) -> None:
|
||||
@ -60,5 +56,5 @@ async def test_onboarding_not_supported(hass: HomeAssistant) -> None:
|
||||
DOMAIN,
|
||||
context={"source": "onboarding"},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "no_devices_found"
|
||||
|
@ -15,7 +15,7 @@ from homeassistant.const import (
|
||||
CONF_SSL,
|
||||
CONF_URL,
|
||||
)
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_FORM
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
VALID_CONFIG = {
|
||||
CONF_NAME: "Sabnzbd",
|
||||
@ -39,7 +39,7 @@ async def test_create_entry(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
|
@ -57,11 +57,7 @@ from homeassistant.const import (
|
||||
CONF_TOKEN,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from . import setup_samsungtv_entry
|
||||
@ -363,7 +359,7 @@ async def test_user_legacy_missing_auth(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=MOCK_USER_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "pairing"
|
||||
assert result["errors"] == {"base": "auth_missing"}
|
||||
|
||||
@ -375,7 +371,7 @@ async def test_user_legacy_missing_auth(hass: HomeAssistant) -> None:
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={}
|
||||
)
|
||||
assert result2["type"] == RESULT_TYPE_ABORT
|
||||
assert result2["type"] == FlowResultType.ABORT
|
||||
assert result2["reason"] == RESULT_CANNOT_CONNECT
|
||||
|
||||
|
||||
@ -447,7 +443,7 @@ async def test_user_websocket_auth_retry(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=MOCK_USER_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "pairing"
|
||||
assert result["errors"] == {"base": "auth_missing"}
|
||||
with patch(
|
||||
@ -459,7 +455,7 @@ async def test_user_websocket_auth_retry(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "Living Room (82GXARRS)"
|
||||
assert result["data"][CONF_HOST] == "fake_host"
|
||||
assert result["data"][CONF_NAME] == "Living Room"
|
||||
@ -536,7 +532,7 @@ async def test_ssdp_legacy_not_remote_control_receiver_udn(
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_SSDP}, data=data
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == RESULT_NOT_SUPPORTED
|
||||
|
||||
|
||||
@ -582,7 +578,7 @@ async def test_ssdp_legacy_missing_auth(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "pairing"
|
||||
assert result["errors"] == {"base": "auth_missing"}
|
||||
|
||||
@ -591,7 +587,7 @@ async def test_ssdp_legacy_missing_auth(hass: HomeAssistant) -> None:
|
||||
result["flow_id"], user_input={}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "fake_model"
|
||||
assert result["data"][CONF_HOST] == "fake_host"
|
||||
assert result["data"][CONF_NAME] == "fake_model"
|
||||
@ -611,7 +607,7 @@ async def test_ssdp_legacy_not_supported(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_SSDP}, data=MOCK_SSDP_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == RESULT_NOT_SUPPORTED
|
||||
|
||||
|
||||
@ -743,7 +739,7 @@ async def test_ssdp_encrypted_websocket_not_supported(
|
||||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=MOCK_SSDP_DATA_RENDERING_CONTROL_ST,
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == RESULT_NOT_SUPPORTED
|
||||
|
||||
|
||||
@ -1261,7 +1257,7 @@ async def test_autodetect_auth_missing(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=MOCK_USER_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "pairing"
|
||||
assert result["errors"] == {"base": "auth_missing"}
|
||||
|
||||
@ -1276,7 +1272,7 @@ async def test_autodetect_auth_missing(hass: HomeAssistant) -> None:
|
||||
{},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result2["type"] == RESULT_TYPE_ABORT
|
||||
assert result2["type"] == FlowResultType.ABORT
|
||||
assert result2["reason"] == RESULT_CANNOT_CONNECT
|
||||
|
||||
|
||||
|
@ -11,11 +11,7 @@ from homeassistant.components.season.const import (
|
||||
from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_USER
|
||||
from homeassistant.const import CONF_NAME, CONF_TYPE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -29,7 +25,7 @@ async def test_full_user_flow(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -38,7 +34,7 @@ async def test_full_user_flow(
|
||||
user_input={CONF_TYPE: TYPE_ASTRONOMICAL},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result2.get("title") == "Season"
|
||||
assert result2.get("data") == {CONF_TYPE: TYPE_ASTRONOMICAL}
|
||||
|
||||
@ -56,7 +52,7 @@ async def test_single_instance_allowed(
|
||||
DOMAIN, context={"source": source}, data={CONF_TYPE: TYPE_ASTRONOMICAL}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_ABORT
|
||||
assert result.get("type") == FlowResultType.ABORT
|
||||
assert result.get("reason") == "already_configured"
|
||||
|
||||
|
||||
@ -71,6 +67,6 @@ async def test_import_flow(
|
||||
data={CONF_NAME: "My Seasons", CONF_TYPE: TYPE_METEOROLOGICAL},
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result.get("title") == "My Seasons"
|
||||
assert result.get("data") == {CONF_TYPE: TYPE_METEOROLOGICAL}
|
||||
|
@ -6,11 +6,7 @@ from homeassistant.components import dhcp
|
||||
from homeassistant.components.senseme.const import DOMAIN
|
||||
from homeassistant.const import CONF_HOST, CONF_ID
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import (
|
||||
MOCK_ADDRESS,
|
||||
@ -42,7 +38,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"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert not result["errors"]
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -53,7 +49,7 @@ async def test_form_user(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "Haiku Fan"
|
||||
assert result2["data"] == {
|
||||
"info": MOCK_DEVICE.get_device_info,
|
||||
@ -68,7 +64,7 @@ async def test_form_user_manual_entry(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert not result["errors"]
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -79,7 +75,7 @@ async def test_form_user_manual_entry(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["step_id"] == "manual"
|
||||
|
||||
with patch(
|
||||
@ -97,7 +93,7 @@ async def test_form_user_manual_entry(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result3["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result3["title"] == "Haiku Fan"
|
||||
assert result3["data"] == {
|
||||
"info": MOCK_DEVICE.get_device_info,
|
||||
@ -118,7 +114,7 @@ async def test_form_user_no_discovery(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert not result["errors"]
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -129,7 +125,7 @@ async def test_form_user_no_discovery(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["step_id"] == "manual"
|
||||
assert result2["errors"] == {CONF_HOST: "invalid_host"}
|
||||
|
||||
@ -141,7 +137,7 @@ async def test_form_user_no_discovery(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result3["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result3["title"] == "Haiku Fan"
|
||||
assert result3["data"] == {
|
||||
"info": MOCK_DEVICE.get_device_info,
|
||||
@ -156,7 +152,7 @@ async def test_form_user_manual_entry_cannot_connect(hass: HomeAssistant) -> Non
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert not result["errors"]
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -167,7 +163,7 @@ async def test_form_user_manual_entry_cannot_connect(hass: HomeAssistant) -> Non
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["step_id"] == "manual"
|
||||
|
||||
with patch(
|
||||
@ -182,7 +178,7 @@ async def test_form_user_manual_entry_cannot_connect(hass: HomeAssistant) -> Non
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result3["type"] == RESULT_TYPE_FORM
|
||||
assert result3["type"] == FlowResultType.FORM
|
||||
assert result3["step_id"] == "manual"
|
||||
assert result3["errors"] == {CONF_HOST: "cannot_connect"}
|
||||
|
||||
@ -214,7 +210,7 @@ async def test_discovery(hass: HomeAssistant) -> None:
|
||||
context={"source": config_entries.SOURCE_INTEGRATION_DISCOVERY},
|
||||
data={CONF_ID: MOCK_UUID},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert not result["errors"]
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -225,7 +221,7 @@ async def test_discovery(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "Haiku Fan"
|
||||
assert result2["data"] == {
|
||||
"info": MOCK_DEVICE.get_device_info,
|
||||
@ -257,7 +253,7 @@ async def test_discovery_existing_device_no_ip_change(hass: HomeAssistant) -> No
|
||||
context={"source": config_entries.SOURCE_INTEGRATION_DISCOVERY},
|
||||
data={CONF_ID: MOCK_UUID},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -286,7 +282,7 @@ async def test_discovery_existing_device_ip_change(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
assert entry.data["info"]["address"] == "127.0.0.8"
|
||||
|
||||
@ -304,7 +300,7 @@ async def test_dhcp_discovery_existing_config_entry(hass: HomeAssistant) -> None
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_DHCP}, data=DHCP_DISCOVERY
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -320,7 +316,7 @@ async def test_dhcp_discovery(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_DHCP}, data=DHCP_DISCOVERY
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert not result["errors"]
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@ -331,7 +327,7 @@ async def test_dhcp_discovery(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "Haiku Fan"
|
||||
assert result2["data"] == {
|
||||
"info": MOCK_DEVICE.get_device_info,
|
||||
@ -348,7 +344,7 @@ async def test_dhcp_discovery_cannot_connect(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_DHCP}, data=DHCP_DISCOVERY
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "cannot_connect"
|
||||
|
||||
|
||||
@ -361,5 +357,5 @@ async def test_dhcp_discovery_cannot_connect_no_uuid(hass: HomeAssistant) -> Non
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_DHCP}, data=DHCP_DISCOVERY
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "cannot_connect"
|
||||
|
@ -12,11 +12,7 @@ import pytest
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.const import CONF_API_KEY
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -30,7 +26,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["step_id"] == "user"
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
@ -51,7 +47,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["version"] == 2
|
||||
assert result2["data"] == {
|
||||
"api_key": "1234567890",
|
||||
@ -78,7 +74,7 @@ async def test_flow_fails(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == config_entries.SOURCE_USER
|
||||
|
||||
with patch(
|
||||
@ -111,7 +107,7 @@ async def test_flow_fails(
|
||||
},
|
||||
)
|
||||
|
||||
assert result3["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result3["title"] == "Sensibo"
|
||||
assert result3["data"] == {
|
||||
"api_key": "1234567891",
|
||||
@ -125,7 +121,7 @@ async def test_flow_get_no_devices(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == config_entries.SOURCE_USER
|
||||
|
||||
with patch(
|
||||
@ -152,7 +148,7 @@ async def test_flow_get_no_username(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == config_entries.SOURCE_USER
|
||||
|
||||
with patch(
|
||||
@ -192,7 +188,7 @@ async def test_reauth_flow(hass: HomeAssistant) -> None:
|
||||
data=entry.data,
|
||||
)
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
@ -211,7 +207,7 @@ async def test_reauth_flow(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_ABORT
|
||||
assert result2["type"] == FlowResultType.ABORT
|
||||
assert result2["reason"] == "reauth_successful"
|
||||
assert entry.data == {"api_key": "1234567891"}
|
||||
|
||||
@ -261,7 +257,7 @@ async def test_reauth_flow_error(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["step_id"] == "reauth_confirm"
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": p_error}
|
||||
|
||||
with patch(
|
||||
@ -280,7 +276,7 @@ async def test_reauth_flow_error(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_ABORT
|
||||
assert result2["type"] == FlowResultType.ABORT
|
||||
assert result2["reason"] == "reauth_successful"
|
||||
assert entry.data == {"api_key": "1234567891"}
|
||||
|
||||
@ -330,7 +326,7 @@ async def test_flow_reauth_no_username_or_device(
|
||||
data=entry.data,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
|
||||
with patch(
|
||||
@ -349,5 +345,5 @@ async def test_flow_reauth_no_username_or_device(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["step_id"] == "reauth_confirm"
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": p_error}
|
||||
|
@ -17,11 +17,7 @@ from homeassistant.components.sentry.const import (
|
||||
)
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -32,7 +28,7 @@ async def test_full_user_flow_implementation(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("errors") == {}
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -62,7 +58,7 @@ async def test_integration_already_exists(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result.get("type") == RESULT_TYPE_ABORT
|
||||
assert result.get("type") == FlowResultType.ABORT
|
||||
assert result.get("reason") == "single_instance_allowed"
|
||||
|
||||
|
||||
@ -82,7 +78,7 @@ async def test_user_flow_bad_dsn(hass: HomeAssistant) -> None:
|
||||
{"dsn": "foo"},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_FORM
|
||||
assert result2.get("type") == FlowResultType.FORM
|
||||
assert result2.get("errors") == {"base": "bad_dsn"}
|
||||
|
||||
|
||||
@ -102,7 +98,7 @@ async def test_user_flow_unknown_exception(hass: HomeAssistant) -> None:
|
||||
{"dsn": "foo"},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_FORM
|
||||
assert result2.get("type") == FlowResultType.FORM
|
||||
assert result2.get("errors") == {"base": "unknown"}
|
||||
|
||||
|
||||
@ -120,7 +116,7 @@ async def test_options_flow(hass: HomeAssistant) -> None:
|
||||
|
||||
result = await hass.config_entries.options.async_init(entry.entry_id)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == "init"
|
||||
assert "flow_id" in result
|
||||
|
||||
@ -138,7 +134,7 @@ async def test_options_flow(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result.get("data") == {
|
||||
CONF_ENVIRONMENT: "Test",
|
||||
CONF_EVENT_CUSTOM_COMPONENTS: True,
|
||||
|
@ -6,11 +6,7 @@ from aioskybell import exceptions
|
||||
from homeassistant.components.skybell.const import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_USER
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import CONF_CONFIG_FLOW, _patch_skybell, _patch_skybell_devices
|
||||
|
||||
@ -38,7 +34,7 @@ async def test_flow_user(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -46,7 +42,7 @@ async def test_flow_user(hass: HomeAssistant) -> None:
|
||||
user_input=CONF_CONFIG_FLOW,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "user"
|
||||
assert result["data"] == CONF_CONFIG_FLOW
|
||||
|
||||
@ -64,7 +60,7 @@ async def test_flow_user_already_configured(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=CONF_CONFIG_FLOW
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -75,7 +71,7 @@ async def test_flow_user_cannot_connect(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=CONF_CONFIG_FLOW
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
@ -88,7 +84,7 @@ async def test_invalid_credentials(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=CONF_CONFIG_FLOW
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
@ -100,7 +96,7 @@ async def test_flow_user_unknown_error(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=CONF_CONFIG_FLOW
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "unknown"}
|
||||
|
||||
@ -115,7 +111,7 @@ async def test_flow_import(hass: HomeAssistant) -> None:
|
||||
result["flow_id"],
|
||||
user_input=CONF_CONFIG_FLOW,
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "user"
|
||||
assert result["data"] == CONF_CONFIG_FLOW
|
||||
|
||||
@ -133,5 +129,5 @@ async def test_flow_import_already_configured(hass: HomeAssistant) -> None:
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_IMPORT},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
@ -4,7 +4,7 @@ from unittest.mock import AsyncMock
|
||||
from homeassistant.components.slimproto.const import DEFAULT_NAME, DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import RESULT_TYPE_ABORT, RESULT_TYPE_CREATE_ENTRY
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -15,7 +15,7 @@ async def test_full_user_flow(hass: HomeAssistant, mock_setup_entry: AsyncMock)
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result.get("title") == DEFAULT_NAME
|
||||
assert result.get("data") == {}
|
||||
|
||||
@ -34,5 +34,5 @@ async def test_already_configured(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_ABORT
|
||||
assert result.get("type") == FlowResultType.ABORT
|
||||
assert result.get("reason") == "single_instance_allowed"
|
||||
|
@ -9,11 +9,7 @@ from pysma.exceptions import (
|
||||
|
||||
from homeassistant.components.sma.const import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import MOCK_DEVICE, MOCK_USER_INPUT, _patch_async_setup_entry
|
||||
|
||||
@ -24,7 +20,7 @@ async def test_form(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch("pysma.SMA.new_session", return_value=True), patch(
|
||||
@ -36,7 +32,7 @@ async def test_form(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == MOCK_USER_INPUT["host"]
|
||||
assert result["data"] == MOCK_USER_INPUT
|
||||
|
||||
@ -57,7 +53,7 @@ async def test_form_cannot_connect(hass):
|
||||
MOCK_USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
assert len(mock_setup_entry.mock_calls) == 0
|
||||
|
||||
@ -76,7 +72,7 @@ async def test_form_invalid_auth(hass):
|
||||
MOCK_USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "invalid_auth"}
|
||||
assert len(mock_setup_entry.mock_calls) == 0
|
||||
|
||||
@ -95,7 +91,7 @@ async def test_form_cannot_retrieve_device_info(hass):
|
||||
MOCK_USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "cannot_retrieve_device_info"}
|
||||
assert len(mock_setup_entry.mock_calls) == 0
|
||||
|
||||
@ -114,7 +110,7 @@ async def test_form_unexpected_exception(hass):
|
||||
MOCK_USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "unknown"}
|
||||
assert len(mock_setup_entry.mock_calls) == 0
|
||||
|
||||
@ -138,6 +134,6 @@ async def test_form_already_configured(hass, mock_config_entry):
|
||||
MOCK_USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
assert len(mock_setup_entry.mock_calls) == 0
|
||||
|
@ -13,11 +13,7 @@ from homeassistant.components.sonarr.const import (
|
||||
from homeassistant.config_entries import SOURCE_REAUTH, SOURCE_USER
|
||||
from homeassistant.const import CONF_API_KEY, CONF_SOURCE, CONF_URL, CONF_VERIFY_SSL
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.sonarr import MOCK_REAUTH_INPUT, MOCK_USER_INPUT
|
||||
@ -31,7 +27,7 @@ async def test_show_user_form(hass: HomeAssistant) -> None:
|
||||
)
|
||||
|
||||
assert result["step_id"] == "user"
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
|
||||
|
||||
async def test_cannot_connect(
|
||||
@ -47,7 +43,7 @@ async def test_cannot_connect(
|
||||
data=user_input,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
@ -67,7 +63,7 @@ async def test_invalid_auth(
|
||||
data=user_input,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
@ -85,7 +81,7 @@ async def test_unknown_error(
|
||||
data=user_input,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "unknown"
|
||||
|
||||
|
||||
@ -108,14 +104,14 @@ async def test_full_reauth_flow_implementation(
|
||||
data=entry.data,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
user_input = MOCK_REAUTH_INPUT.copy()
|
||||
@ -124,7 +120,7 @@ async def test_full_reauth_flow_implementation(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "reauth_successful"
|
||||
|
||||
assert entry.data[CONF_API_KEY] == "test-api-key-reauth"
|
||||
@ -141,7 +137,7 @@ async def test_full_user_flow_implementation(
|
||||
context={CONF_SOURCE: SOURCE_USER},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
user_input = MOCK_USER_INPUT.copy()
|
||||
@ -151,7 +147,7 @@ async def test_full_user_flow_implementation(
|
||||
user_input=user_input,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "192.168.1.189"
|
||||
|
||||
assert result["data"]
|
||||
@ -168,7 +164,7 @@ async def test_full_user_flow_advanced_options(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_USER, "show_advanced_options": True}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
user_input = {
|
||||
@ -181,7 +177,7 @@ async def test_full_user_flow_advanced_options(
|
||||
user_input=user_input,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "192.168.1.189"
|
||||
|
||||
assert result["data"]
|
||||
@ -203,7 +199,7 @@ async def test_options_flow(
|
||||
|
||||
result = await hass.config_entries.options.async_init(entry.entry_id)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
@ -212,6 +208,6 @@ async def test_options_flow(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"][CONF_UPCOMING_DAYS] == 2
|
||||
assert result["data"][CONF_WANTED_MAX_ITEMS] == 100
|
||||
|
@ -7,11 +7,7 @@ from homeassistant.components import ssdp
|
||||
from homeassistant.components.songpal.const import CONF_ENDPOINT, DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_SSDP, SOURCE_USER
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import (
|
||||
CONF_DATA,
|
||||
@ -79,7 +75,7 @@ async def test_flow_ssdp(hass):
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == FRIENDLY_NAME
|
||||
assert result["data"] == CONF_DATA
|
||||
|
||||
@ -93,7 +89,7 @@ async def test_flow_user(hass):
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_USER},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] is None
|
||||
_flow_next(hass, result["flow_id"])
|
||||
@ -102,7 +98,7 @@ async def test_flow_user(hass):
|
||||
result["flow_id"],
|
||||
user_input={CONF_ENDPOINT: ENDPOINT},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == MODEL
|
||||
assert result["data"] == {
|
||||
CONF_NAME: MODEL,
|
||||
@ -121,7 +117,7 @@ async def test_flow_import(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_IMPORT}, data=CONF_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == FRIENDLY_NAME
|
||||
assert result["data"] == CONF_DATA
|
||||
|
||||
@ -137,7 +133,7 @@ async def test_flow_import_without_name(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_IMPORT}, data={CONF_ENDPOINT: ENDPOINT}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == MODEL
|
||||
assert result["data"] == {CONF_NAME: MODEL, CONF_ENDPOINT: ENDPOINT}
|
||||
|
||||
@ -165,7 +161,7 @@ async def test_ssdp_bravia(hass):
|
||||
context={"source": SOURCE_SSDP},
|
||||
data=ssdp_data,
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "not_songpal_device"
|
||||
|
||||
|
||||
@ -177,7 +173,7 @@ async def test_sddp_exist(hass):
|
||||
context={"source": SOURCE_SSDP},
|
||||
data=SSDP_DATA,
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -190,7 +186,7 @@ async def test_user_exist(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=CONF_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
mocked_device.get_supported_methods.assert_called_once()
|
||||
@ -206,7 +202,7 @@ async def test_import_exist(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_IMPORT}, data=CONF_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
mocked_device.get_supported_methods.assert_called_once()
|
||||
@ -222,7 +218,7 @@ async def test_user_invalid(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=CONF_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
@ -239,7 +235,7 @@ async def test_import_invalid(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_IMPORT}, data=CONF_DATA
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "cannot_connect"
|
||||
|
||||
mocked_device.get_supported_methods.assert_called_once()
|
||||
|
@ -8,11 +8,7 @@ from sqlalchemy.exc import SQLAlchemyError
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.sql.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import (
|
||||
ENTRY_CONFIG,
|
||||
@ -30,7 +26,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
@ -43,7 +39,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "Get Value"
|
||||
assert result2["options"] == {
|
||||
"db_url": "sqlite://",
|
||||
@ -70,7 +66,7 @@ async def test_import_flow_success(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "Get Value"
|
||||
assert result2["options"] == {
|
||||
"db_url": "sqlite://",
|
||||
@ -102,7 +98,7 @@ async def test_import_flow_already_exist(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result3["type"] == RESULT_TYPE_ABORT
|
||||
assert result3["type"] == FlowResultType.ABORT
|
||||
assert result3["reason"] == "already_configured"
|
||||
|
||||
|
||||
@ -112,7 +108,7 @@ async def test_flow_fails_db_url(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result4["type"] == RESULT_TYPE_FORM
|
||||
assert result4["type"] == FlowResultType.FORM
|
||||
assert result4["step_id"] == config_entries.SOURCE_USER
|
||||
|
||||
with patch(
|
||||
@ -133,7 +129,7 @@ async def test_flow_fails_invalid_query(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result4["type"] == RESULT_TYPE_FORM
|
||||
assert result4["type"] == FlowResultType.FORM
|
||||
assert result4["step_id"] == config_entries.SOURCE_USER
|
||||
|
||||
result5 = await hass.config_entries.flow.async_configure(
|
||||
@ -141,7 +137,7 @@ async def test_flow_fails_invalid_query(hass: HomeAssistant) -> None:
|
||||
user_input=ENTRY_CONFIG_INVALID_QUERY,
|
||||
)
|
||||
|
||||
assert result5["type"] == RESULT_TYPE_FORM
|
||||
assert result5["type"] == FlowResultType.FORM
|
||||
assert result5["errors"] == {
|
||||
"query": "query_invalid",
|
||||
}
|
||||
@ -151,7 +147,7 @@ async def test_flow_fails_invalid_query(hass: HomeAssistant) -> None:
|
||||
user_input=ENTRY_CONFIG_NO_RESULTS,
|
||||
)
|
||||
|
||||
assert result5["type"] == RESULT_TYPE_FORM
|
||||
assert result5["type"] == FlowResultType.FORM
|
||||
assert result5["errors"] == {
|
||||
"query": "query_invalid",
|
||||
}
|
||||
@ -161,7 +157,7 @@ async def test_flow_fails_invalid_query(hass: HomeAssistant) -> None:
|
||||
user_input=ENTRY_CONFIG,
|
||||
)
|
||||
|
||||
assert result5["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result5["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result5["title"] == "Get Value"
|
||||
assert result5["options"] == {
|
||||
"db_url": "sqlite://",
|
||||
@ -198,7 +194,7 @@ async def test_options_flow(hass: HomeAssistant) -> None:
|
||||
|
||||
result = await hass.config_entries.options.async_init(entry.entry_id)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
@ -211,7 +207,7 @@ async def test_options_flow(hass: HomeAssistant) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == {
|
||||
"name": "Get Value",
|
||||
"db_url": "sqlite://",
|
||||
@ -243,7 +239,7 @@ async def test_options_flow_name_previously_removed(hass: HomeAssistant) -> None
|
||||
|
||||
result = await hass.config_entries.options.async_init(entry.entry_id)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
with patch(
|
||||
@ -262,7 +258,7 @@ async def test_options_flow_name_previously_removed(hass: HomeAssistant) -> None
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == {
|
||||
"name": "Get Value Title",
|
||||
"db_url": "sqlite://",
|
||||
@ -347,7 +343,7 @@ async def test_options_flow_fails_invalid_query(
|
||||
user_input=ENTRY_CONFIG_INVALID_QUERY_OPT,
|
||||
)
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {
|
||||
"query": "query_invalid",
|
||||
}
|
||||
@ -362,7 +358,7 @@ async def test_options_flow_fails_invalid_query(
|
||||
},
|
||||
)
|
||||
|
||||
assert result4["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result4["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result4["data"] == {
|
||||
"name": "Get Value",
|
||||
"value_template": None,
|
||||
|
@ -9,11 +9,7 @@ from homeassistant import config_entries
|
||||
from homeassistant.components import dhcp
|
||||
from homeassistant.components.squeezebox.const import DOMAIN
|
||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -50,7 +46,7 @@ async def test_user_form(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "edit"
|
||||
assert CONF_HOST in result["data_schema"].schema
|
||||
for key in result["data_schema"].schema:
|
||||
@ -62,7 +58,7 @@ async def test_user_form(hass):
|
||||
result["flow_id"],
|
||||
{CONF_HOST: HOST, CONF_PORT: PORT, CONF_USERNAME: "", CONF_PASSWORD: ""},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == HOST
|
||||
assert result["data"] == {
|
||||
CONF_HOST: HOST,
|
||||
@ -84,14 +80,14 @@ async def test_user_form_timeout(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "no_server_found"}
|
||||
|
||||
# simulate manual input of host
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_HOST: HOST2}
|
||||
)
|
||||
assert result2["type"] == RESULT_TYPE_FORM
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["step_id"] == "edit"
|
||||
assert CONF_HOST in result2["data_schema"].schema
|
||||
for key in result2["data_schema"].schema:
|
||||
@ -113,7 +109,7 @@ async def test_user_form_duplicate(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "no_server_found"}
|
||||
|
||||
|
||||
@ -138,7 +134,7 @@ async def test_form_invalid_auth(hass):
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
|
||||
@ -162,7 +158,7 @@ async def test_form_cannot_connect(hass):
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@ -177,7 +173,7 @@ async def test_discovery(hass):
|
||||
context={"source": config_entries.SOURCE_INTEGRATION_DISCOVERY},
|
||||
data={CONF_HOST: HOST, CONF_PORT: PORT, "uuid": UUID},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "edit"
|
||||
|
||||
|
||||
@ -189,7 +185,7 @@ async def test_discovery_no_uuid(hass):
|
||||
context={"source": config_entries.SOURCE_INTEGRATION_DISCOVERY},
|
||||
data={CONF_HOST: HOST, CONF_PORT: PORT},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "edit"
|
||||
|
||||
|
||||
@ -207,7 +203,7 @@ async def test_dhcp_discovery(hass):
|
||||
hostname="any",
|
||||
),
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "edit"
|
||||
|
||||
|
||||
@ -226,7 +222,7 @@ async def test_dhcp_discovery_no_server_found(hass):
|
||||
hostname="any",
|
||||
),
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
@ -245,4 +241,4 @@ async def test_dhcp_discovery_existing_player(hass):
|
||||
hostname="any",
|
||||
),
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user