Use is in enum comparison in config flow tests P-T (#114675)
This commit is contained in:
parent
5d500cb74b
commit
ee66f6ec8c
164 changed files with 1919 additions and 1890 deletions
|
@ -8,7 +8,7 @@ from aiohttp import ClientResponseError
|
|||
from pysmartthings import APIResponseError
|
||||
from pysmartthings.installedapp import format_install_url
|
||||
|
||||
from homeassistant import config_entries, data_entry_flow
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.smartthings import smartapp
|
||||
from homeassistant.components.smartthings.const import (
|
||||
CONF_APP_ID,
|
||||
|
@ -19,6 +19,7 @@ from homeassistant.components.smartthings.const import (
|
|||
from homeassistant.config import async_process_ha_core_config
|
||||
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_CLIENT_ID, CONF_CLIENT_SECRET
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
@ -29,7 +30,7 @@ async def test_import_shows_user_step(hass: HomeAssistant) -> None:
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_IMPORT}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["description_placeholders"][
|
||||
"webhook_url"
|
||||
|
@ -56,7 +57,7 @@ async def test_entry_created(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["description_placeholders"][
|
||||
"webhook_url"
|
||||
|
@ -64,7 +65,7 @@ async def test_entry_created(
|
|||
|
||||
# Advance to PAT screen
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "pat"
|
||||
assert "token_url" in result["description_placeholders"]
|
||||
assert "component_url" in result["description_placeholders"]
|
||||
|
@ -73,14 +74,14 @@ async def test_entry_created(
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_ACCESS_TOKEN: token}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "select_location"
|
||||
|
||||
# Select location and advance to external auth
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_LOCATION_ID: location.location_id}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP
|
||||
assert result["type"] is FlowResultType.EXTERNAL_STEP
|
||||
assert result["step_id"] == "authorize"
|
||||
assert result["url"] == format_install_url(app.app_id, location.location_id)
|
||||
|
||||
|
@ -89,7 +90,7 @@ async def test_entry_created(
|
|||
|
||||
# Finish
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"])
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert result["data"]["app_id"] == app.app_id
|
||||
assert result["data"]["installed_app_id"] == installed_app_id
|
||||
assert result["data"]["location_id"] == location.location_id
|
||||
|
@ -127,7 +128,7 @@ async def test_entry_created_from_update_event(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["description_placeholders"][
|
||||
"webhook_url"
|
||||
|
@ -135,7 +136,7 @@ async def test_entry_created_from_update_event(
|
|||
|
||||
# Advance to PAT screen
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "pat"
|
||||
assert "token_url" in result["description_placeholders"]
|
||||
assert "component_url" in result["description_placeholders"]
|
||||
|
@ -144,14 +145,14 @@ async def test_entry_created_from_update_event(
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_ACCESS_TOKEN: token}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "select_location"
|
||||
|
||||
# Select location and advance to external auth
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_LOCATION_ID: location.location_id}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP
|
||||
assert result["type"] is FlowResultType.EXTERNAL_STEP
|
||||
assert result["step_id"] == "authorize"
|
||||
assert result["url"] == format_install_url(app.app_id, location.location_id)
|
||||
|
||||
|
@ -160,7 +161,7 @@ async def test_entry_created_from_update_event(
|
|||
|
||||
# Finish
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"])
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert result["data"]["app_id"] == app.app_id
|
||||
assert result["data"]["installed_app_id"] == installed_app_id
|
||||
assert result["data"]["location_id"] == location.location_id
|
||||
|
@ -199,7 +200,7 @@ async def test_entry_created_existing_app_new_oauth_client(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["description_placeholders"][
|
||||
"webhook_url"
|
||||
|
@ -207,7 +208,7 @@ async def test_entry_created_existing_app_new_oauth_client(
|
|||
|
||||
# Advance to PAT screen
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "pat"
|
||||
assert "token_url" in result["description_placeholders"]
|
||||
assert "component_url" in result["description_placeholders"]
|
||||
|
@ -216,14 +217,14 @@ async def test_entry_created_existing_app_new_oauth_client(
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_ACCESS_TOKEN: token}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "select_location"
|
||||
|
||||
# Select location and advance to external auth
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_LOCATION_ID: location.location_id}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP
|
||||
assert result["type"] is FlowResultType.EXTERNAL_STEP
|
||||
assert result["step_id"] == "authorize"
|
||||
assert result["url"] == format_install_url(app.app_id, location.location_id)
|
||||
|
||||
|
@ -232,7 +233,7 @@ async def test_entry_created_existing_app_new_oauth_client(
|
|||
|
||||
# Finish
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"])
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert result["data"]["app_id"] == app.app_id
|
||||
assert result["data"]["installed_app_id"] == installed_app_id
|
||||
assert result["data"]["location_id"] == location.location_id
|
||||
|
@ -283,7 +284,7 @@ async def test_entry_created_existing_app_copies_oauth_client(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["description_placeholders"][
|
||||
"webhook_url"
|
||||
|
@ -291,7 +292,7 @@ async def test_entry_created_existing_app_copies_oauth_client(
|
|||
|
||||
# Advance to PAT screen
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "pat"
|
||||
assert "token_url" in result["description_placeholders"]
|
||||
assert "component_url" in result["description_placeholders"]
|
||||
|
@ -302,14 +303,14 @@ async def test_entry_created_existing_app_copies_oauth_client(
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_ACCESS_TOKEN: token}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "select_location"
|
||||
|
||||
# Select location and advance to external auth
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_LOCATION_ID: location.location_id}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP
|
||||
assert result["type"] is FlowResultType.EXTERNAL_STEP
|
||||
assert result["step_id"] == "authorize"
|
||||
assert result["url"] == format_install_url(app.app_id, location.location_id)
|
||||
|
||||
|
@ -318,7 +319,7 @@ async def test_entry_created_existing_app_copies_oauth_client(
|
|||
|
||||
# Finish
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"])
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert result["data"]["app_id"] == app.app_id
|
||||
assert result["data"]["installed_app_id"] == installed_app_id
|
||||
assert result["data"]["location_id"] == location.location_id
|
||||
|
@ -377,7 +378,7 @@ async def test_entry_created_with_cloudhook(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["description_placeholders"][
|
||||
"webhook_url"
|
||||
|
@ -387,7 +388,7 @@ async def test_entry_created_with_cloudhook(
|
|||
|
||||
# Advance to PAT screen
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "pat"
|
||||
assert "token_url" in result["description_placeholders"]
|
||||
assert "component_url" in result["description_placeholders"]
|
||||
|
@ -396,14 +397,14 @@ async def test_entry_created_with_cloudhook(
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_ACCESS_TOKEN: token}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "select_location"
|
||||
|
||||
# Select location and advance to external auth
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_LOCATION_ID: location.location_id}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP
|
||||
assert result["type"] is FlowResultType.EXTERNAL_STEP
|
||||
assert result["step_id"] == "authorize"
|
||||
assert result["url"] == format_install_url(app.app_id, location.location_id)
|
||||
|
||||
|
@ -412,7 +413,7 @@ async def test_entry_created_with_cloudhook(
|
|||
|
||||
# Finish
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"])
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert result["data"]["app_id"] == app.app_id
|
||||
assert result["data"]["installed_app_id"] == installed_app_id
|
||||
assert result["data"]["location_id"] == location.location_id
|
||||
|
@ -440,7 +441,7 @@ async def test_invalid_webhook_aborts(hass: HomeAssistant) -> None:
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
assert result["reason"] == "invalid_webhook_url"
|
||||
assert result["description_placeholders"][
|
||||
"webhook_url"
|
||||
|
@ -456,7 +457,7 @@ async def test_invalid_token_shows_error(hass: HomeAssistant) -> None:
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["description_placeholders"][
|
||||
"webhook_url"
|
||||
|
@ -464,7 +465,7 @@ async def test_invalid_token_shows_error(hass: HomeAssistant) -> None:
|
|||
|
||||
# Advance to PAT screen
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "pat"
|
||||
assert "token_url" in result["description_placeholders"]
|
||||
assert "component_url" in result["description_placeholders"]
|
||||
|
@ -473,7 +474,7 @@ async def test_invalid_token_shows_error(hass: HomeAssistant) -> None:
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_ACCESS_TOKEN: token}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "pat"
|
||||
assert result["data_schema"]({}) == {CONF_ACCESS_TOKEN: token}
|
||||
assert result["errors"] == {CONF_ACCESS_TOKEN: "token_invalid_format"}
|
||||
|
@ -495,7 +496,7 @@ async def test_unauthorized_token_shows_error(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["description_placeholders"][
|
||||
"webhook_url"
|
||||
|
@ -503,7 +504,7 @@ async def test_unauthorized_token_shows_error(
|
|||
|
||||
# Advance to PAT screen
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "pat"
|
||||
assert "token_url" in result["description_placeholders"]
|
||||
assert "component_url" in result["description_placeholders"]
|
||||
|
@ -512,7 +513,7 @@ async def test_unauthorized_token_shows_error(
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_ACCESS_TOKEN: token}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "pat"
|
||||
assert result["data_schema"]({}) == {CONF_ACCESS_TOKEN: token}
|
||||
assert result["errors"] == {CONF_ACCESS_TOKEN: "token_unauthorized"}
|
||||
|
@ -534,7 +535,7 @@ async def test_forbidden_token_shows_error(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["description_placeholders"][
|
||||
"webhook_url"
|
||||
|
@ -542,7 +543,7 @@ async def test_forbidden_token_shows_error(
|
|||
|
||||
# Advance to PAT screen
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "pat"
|
||||
assert "token_url" in result["description_placeholders"]
|
||||
assert "component_url" in result["description_placeholders"]
|
||||
|
@ -551,7 +552,7 @@ async def test_forbidden_token_shows_error(
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_ACCESS_TOKEN: token}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "pat"
|
||||
assert result["data_schema"]({}) == {CONF_ACCESS_TOKEN: token}
|
||||
assert result["errors"] == {CONF_ACCESS_TOKEN: "token_forbidden"}
|
||||
|
@ -579,7 +580,7 @@ async def test_webhook_problem_shows_error(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["description_placeholders"][
|
||||
"webhook_url"
|
||||
|
@ -587,7 +588,7 @@ async def test_webhook_problem_shows_error(
|
|||
|
||||
# Advance to PAT screen
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "pat"
|
||||
assert "token_url" in result["description_placeholders"]
|
||||
assert "component_url" in result["description_placeholders"]
|
||||
|
@ -596,7 +597,7 @@ async def test_webhook_problem_shows_error(
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_ACCESS_TOKEN: token}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "pat"
|
||||
assert result["data_schema"]({}) == {CONF_ACCESS_TOKEN: token}
|
||||
assert result["errors"] == {"base": "webhook_error"}
|
||||
|
@ -621,7 +622,7 @@ async def test_api_error_shows_error(hass: HomeAssistant, smartthings_mock) -> N
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["description_placeholders"][
|
||||
"webhook_url"
|
||||
|
@ -629,7 +630,7 @@ async def test_api_error_shows_error(hass: HomeAssistant, smartthings_mock) -> N
|
|||
|
||||
# Advance to PAT screen
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "pat"
|
||||
assert "token_url" in result["description_placeholders"]
|
||||
assert "component_url" in result["description_placeholders"]
|
||||
|
@ -638,7 +639,7 @@ async def test_api_error_shows_error(hass: HomeAssistant, smartthings_mock) -> N
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_ACCESS_TOKEN: token}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "pat"
|
||||
assert result["data_schema"]({}) == {CONF_ACCESS_TOKEN: token}
|
||||
assert result["errors"] == {"base": "app_setup_error"}
|
||||
|
@ -661,7 +662,7 @@ async def test_unknown_response_error_shows_error(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["description_placeholders"][
|
||||
"webhook_url"
|
||||
|
@ -669,7 +670,7 @@ async def test_unknown_response_error_shows_error(
|
|||
|
||||
# Advance to PAT screen
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "pat"
|
||||
assert "token_url" in result["description_placeholders"]
|
||||
assert "component_url" in result["description_placeholders"]
|
||||
|
@ -678,7 +679,7 @@ async def test_unknown_response_error_shows_error(
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_ACCESS_TOKEN: token}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "pat"
|
||||
assert result["data_schema"]({}) == {CONF_ACCESS_TOKEN: token}
|
||||
assert result["errors"] == {"base": "app_setup_error"}
|
||||
|
@ -695,7 +696,7 @@ async def test_unknown_error_shows_error(hass: HomeAssistant, smartthings_mock)
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["description_placeholders"][
|
||||
"webhook_url"
|
||||
|
@ -703,7 +704,7 @@ async def test_unknown_error_shows_error(hass: HomeAssistant, smartthings_mock)
|
|||
|
||||
# Advance to PAT screen
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "pat"
|
||||
assert "token_url" in result["description_placeholders"]
|
||||
assert "component_url" in result["description_placeholders"]
|
||||
|
@ -712,7 +713,7 @@ async def test_unknown_error_shows_error(hass: HomeAssistant, smartthings_mock)
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_ACCESS_TOKEN: token}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "pat"
|
||||
assert result["data_schema"]({}) == {CONF_ACCESS_TOKEN: token}
|
||||
assert result["errors"] == {"base": "app_setup_error"}
|
||||
|
@ -737,7 +738,7 @@ async def test_no_available_locations_aborts(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["description_placeholders"][
|
||||
"webhook_url"
|
||||
|
@ -745,7 +746,7 @@ async def test_no_available_locations_aborts(
|
|||
|
||||
# Advance to PAT screen
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "pat"
|
||||
assert "token_url" in result["description_placeholders"]
|
||||
assert "component_url" in result["description_placeholders"]
|
||||
|
@ -754,5 +755,5 @@ async def test_no_available_locations_aborts(
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_ACCESS_TOKEN: token}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
assert result["reason"] == "no_available_locations"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue