Search/replace RESULT_TYPE_* by FlowResultType enum (#74642)
This commit is contained in:
parent
68ccb96089
commit
7cd68381f1
237 changed files with 2284 additions and 2280 deletions
|
@ -100,37 +100,37 @@ async def test_login(hass):
|
|||
|
||||
provider = hass.auth.auth_providers[0]
|
||||
result = await hass.auth.login_flow.async_init((provider.type, provider.id))
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
result = await hass.auth.login_flow.async_configure(
|
||||
result["flow_id"], {"username": "incorrect-user", "password": "test-pass"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"]["base"] == "invalid_auth"
|
||||
|
||||
result = await hass.auth.login_flow.async_configure(
|
||||
result["flow_id"], {"username": "test-user", "password": "incorrect-pass"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"]["base"] == "invalid_auth"
|
||||
|
||||
result = await hass.auth.login_flow.async_configure(
|
||||
result["flow_id"], {"username": "test-user", "password": "test-pass"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "mfa"
|
||||
assert result["data_schema"].schema.get("pin") == str
|
||||
|
||||
result = await hass.auth.login_flow.async_configure(
|
||||
result["flow_id"], {"pin": "invalid-code"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"]["base"] == "invalid_code"
|
||||
|
||||
result = await hass.auth.login_flow.async_configure(
|
||||
result["flow_id"], {"pin": "123456"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"].id == "mock-id"
|
||||
|
||||
|
||||
|
@ -147,9 +147,9 @@ async def test_setup_flow(hass):
|
|||
flow = await auth_module.async_setup_flow("new-user")
|
||||
|
||||
result = await flow.async_step_init()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
result = await flow.async_step_init({"pin": "abcdefg"})
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert auth_module._data[1]["user_id"] == "new-user"
|
||||
assert auth_module._data[1]["pin"] == "abcdefg"
|
||||
|
|
|
@ -133,25 +133,25 @@ async def test_login_flow_validates_mfa(hass):
|
|||
provider = hass.auth.auth_providers[0]
|
||||
|
||||
result = await hass.auth.login_flow.async_init((provider.type, provider.id))
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
result = await hass.auth.login_flow.async_configure(
|
||||
result["flow_id"], {"username": "incorrect-user", "password": "test-pass"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"]["base"] == "invalid_auth"
|
||||
|
||||
result = await hass.auth.login_flow.async_configure(
|
||||
result["flow_id"], {"username": "test-user", "password": "incorrect-pass"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"]["base"] == "invalid_auth"
|
||||
|
||||
with patch("pyotp.HOTP.at", return_value=MOCK_CODE):
|
||||
result = await hass.auth.login_flow.async_configure(
|
||||
result["flow_id"], {"username": "test-user", "password": "test-pass"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "mfa"
|
||||
assert result["data_schema"].schema.get("code") == str
|
||||
|
||||
|
@ -170,7 +170,7 @@ async def test_login_flow_validates_mfa(hass):
|
|||
result = await hass.auth.login_flow.async_configure(
|
||||
result["flow_id"], {"code": "invalid-code"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "mfa"
|
||||
assert result["errors"]["base"] == "invalid_code"
|
||||
|
||||
|
@ -187,7 +187,7 @@ async def test_login_flow_validates_mfa(hass):
|
|||
result = await hass.auth.login_flow.async_configure(
|
||||
result["flow_id"], {"code": "invalid-code"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "mfa"
|
||||
assert result["errors"]["base"] == "invalid_code"
|
||||
|
||||
|
@ -195,7 +195,7 @@ async def test_login_flow_validates_mfa(hass):
|
|||
result = await hass.auth.login_flow.async_configure(
|
||||
result["flow_id"], {"code": "invalid-code"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "too_many_retry"
|
||||
|
||||
# wait service call finished
|
||||
|
@ -203,13 +203,13 @@ async def test_login_flow_validates_mfa(hass):
|
|||
|
||||
# restart login
|
||||
result = await hass.auth.login_flow.async_init((provider.type, provider.id))
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
with patch("pyotp.HOTP.at", return_value=MOCK_CODE):
|
||||
result = await hass.auth.login_flow.async_configure(
|
||||
result["flow_id"], {"username": "test-user", "password": "test-pass"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "mfa"
|
||||
assert result["data_schema"].schema.get("code") == str
|
||||
|
||||
|
@ -228,7 +228,7 @@ async def test_login_flow_validates_mfa(hass):
|
|||
result = await hass.auth.login_flow.async_configure(
|
||||
result["flow_id"], {"code": MOCK_CODE}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"].id == "mock-id"
|
||||
|
||||
|
||||
|
@ -243,14 +243,14 @@ async def test_setup_user_notify_service(hass):
|
|||
|
||||
flow = await notify_auth_module.async_setup_flow("test-user")
|
||||
step = await flow.async_step_init()
|
||||
assert step["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert step["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert step["step_id"] == "init"
|
||||
schema = step["data_schema"]
|
||||
schema({"notify_service": "test2"})
|
||||
|
||||
with patch("pyotp.HOTP.at", return_value=MOCK_CODE):
|
||||
step = await flow.async_step_init({"notify_service": "test1"})
|
||||
assert step["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert step["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert step["step_id"] == "setup"
|
||||
|
||||
# wait service call finished
|
||||
|
@ -266,7 +266,7 @@ async def test_setup_user_notify_service(hass):
|
|||
|
||||
with patch("pyotp.HOTP.at", return_value=MOCK_CODE_2):
|
||||
step = await flow.async_step_setup({"code": "invalid"})
|
||||
assert step["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert step["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert step["step_id"] == "setup"
|
||||
assert step["errors"]["base"] == "invalid_code"
|
||||
|
||||
|
@ -283,7 +283,7 @@ async def test_setup_user_notify_service(hass):
|
|||
|
||||
with patch("pyotp.HOTP.verify", return_value=True):
|
||||
step = await flow.async_step_setup({"code": MOCK_CODE_2})
|
||||
assert step["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert step["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
|
||||
async def test_include_exclude_config(hass):
|
||||
|
@ -332,7 +332,7 @@ async def test_setup_user_no_notify_service(hass):
|
|||
|
||||
flow = await notify_auth_module.async_setup_flow("test-user")
|
||||
step = await flow.async_step_init()
|
||||
assert step["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert step["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert step["reason"] == "no_available_service"
|
||||
|
||||
|
||||
|
@ -369,13 +369,13 @@ async def test_not_raise_exception_when_service_not_exist(hass):
|
|||
provider = hass.auth.auth_providers[0]
|
||||
|
||||
result = await hass.auth.login_flow.async_init((provider.type, provider.id))
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
with patch("pyotp.HOTP.at", return_value=MOCK_CODE):
|
||||
result = await hass.auth.login_flow.async_configure(
|
||||
result["flow_id"], {"username": "test-user", "password": "test-pass"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "unknown_error"
|
||||
|
||||
# wait service call finished
|
||||
|
|
|
@ -93,24 +93,24 @@ async def test_login_flow_validates_mfa(hass):
|
|||
provider = hass.auth.auth_providers[0]
|
||||
|
||||
result = await hass.auth.login_flow.async_init((provider.type, provider.id))
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
result = await hass.auth.login_flow.async_configure(
|
||||
result["flow_id"], {"username": "incorrect-user", "password": "test-pass"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"]["base"] == "invalid_auth"
|
||||
|
||||
result = await hass.auth.login_flow.async_configure(
|
||||
result["flow_id"], {"username": "test-user", "password": "incorrect-pass"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"]["base"] == "invalid_auth"
|
||||
|
||||
result = await hass.auth.login_flow.async_configure(
|
||||
result["flow_id"], {"username": "test-user", "password": "test-pass"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "mfa"
|
||||
assert result["data_schema"].schema.get("code") == str
|
||||
|
||||
|
@ -118,7 +118,7 @@ async def test_login_flow_validates_mfa(hass):
|
|||
result = await hass.auth.login_flow.async_configure(
|
||||
result["flow_id"], {"code": "invalid-code"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "mfa"
|
||||
assert result["errors"]["base"] == "invalid_code"
|
||||
|
||||
|
@ -126,7 +126,7 @@ async def test_login_flow_validates_mfa(hass):
|
|||
result = await hass.auth.login_flow.async_configure(
|
||||
result["flow_id"], {"code": MOCK_CODE}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"].id == "mock-id"
|
||||
|
||||
|
||||
|
|
|
@ -114,18 +114,18 @@ async def test_login_flow_validates(provider):
|
|||
"""Test login flow."""
|
||||
flow = await provider.async_login_flow({})
|
||||
result = await flow.async_step_init()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
result = await flow.async_step_init(
|
||||
{"username": "bad-user", "password": "bad-pass"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"]["base"] == "invalid_auth"
|
||||
|
||||
result = await flow.async_step_init(
|
||||
{"username": "good-user", "password": "good-pass"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"]["username"] == "good-user"
|
||||
|
||||
|
||||
|
@ -135,5 +135,5 @@ async def test_strip_username(provider):
|
|||
result = await flow.async_step_init(
|
||||
{"username": "\t\ngood-user ", "password": "good-pass"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"]["username"] == "good-user"
|
||||
|
|
|
@ -115,24 +115,24 @@ async def test_login_flow_validates(data, hass):
|
|||
)
|
||||
flow = await provider.async_login_flow({})
|
||||
result = await flow.async_step_init()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
result = await flow.async_step_init(
|
||||
{"username": "incorrect-user", "password": "test-pass"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"]["base"] == "invalid_auth"
|
||||
|
||||
result = await flow.async_step_init(
|
||||
{"username": "TEST-user ", "password": "incorrect-pass"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"]["base"] == "invalid_auth"
|
||||
|
||||
result = await flow.async_step_init(
|
||||
{"username": "test-USER", "password": "test-pass"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"]["username"] == "test-USER"
|
||||
|
||||
|
||||
|
@ -216,24 +216,24 @@ async def test_legacy_login_flow_validates(legacy_data, hass):
|
|||
)
|
||||
flow = await provider.async_login_flow({})
|
||||
result = await flow.async_step_init()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
result = await flow.async_step_init(
|
||||
{"username": "incorrect-user", "password": "test-pass"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"]["base"] == "invalid_auth"
|
||||
|
||||
result = await flow.async_step_init(
|
||||
{"username": "test-user", "password": "incorrect-pass"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"]["base"] == "invalid_auth"
|
||||
|
||||
result = await flow.async_step_init(
|
||||
{"username": "test-user", "password": "test-pass"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"]["username"] == "test-user"
|
||||
|
||||
|
||||
|
|
|
@ -55,15 +55,15 @@ async def test_verify_login(hass, provider):
|
|||
async def test_login_flow_works(hass, manager):
|
||||
"""Test wrong config."""
|
||||
result = await manager.login_flow.async_init(handler=("legacy_api_password", None))
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
result = await manager.login_flow.async_configure(
|
||||
flow_id=result["flow_id"], user_input={"password": "not-hello"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"]["base"] == "invalid_auth"
|
||||
|
||||
result = await manager.login_flow.async_configure(
|
||||
flow_id=result["flow_id"], user_input={"password": "test-password"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
|
|
@ -168,12 +168,12 @@ async def test_create_new_user(hass):
|
|||
)
|
||||
|
||||
step = await manager.login_flow.async_init(("insecure_example", None))
|
||||
assert step["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert step["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
step = await manager.login_flow.async_configure(
|
||||
step["flow_id"], {"username": "test-user", "password": "test-pass"}
|
||||
)
|
||||
assert step["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert step["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
credential = step["result"]
|
||||
assert credential is not None
|
||||
|
||||
|
@ -237,12 +237,12 @@ async def test_login_as_existing_user(mock_hass):
|
|||
)
|
||||
|
||||
step = await manager.login_flow.async_init(("insecure_example", None))
|
||||
assert step["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert step["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
step = await manager.login_flow.async_configure(
|
||||
step["flow_id"], {"username": "test-user", "password": "test-pass"}
|
||||
)
|
||||
assert step["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert step["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
credential = step["result"]
|
||||
user = await manager.async_get_user_by_credentials(credential)
|
||||
|
@ -728,14 +728,14 @@ async def test_login_with_auth_module(mock_hass):
|
|||
)
|
||||
|
||||
step = await manager.login_flow.async_init(("insecure_example", None))
|
||||
assert step["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert step["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
step = await manager.login_flow.async_configure(
|
||||
step["flow_id"], {"username": "test-user", "password": "test-pass"}
|
||||
)
|
||||
|
||||
# After auth_provider validated, request auth module input form
|
||||
assert step["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert step["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert step["step_id"] == "mfa"
|
||||
|
||||
step = await manager.login_flow.async_configure(
|
||||
|
@ -743,7 +743,7 @@ async def test_login_with_auth_module(mock_hass):
|
|||
)
|
||||
|
||||
# Invalid code error
|
||||
assert step["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert step["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert step["step_id"] == "mfa"
|
||||
assert step["errors"] == {"base": "invalid_code"}
|
||||
|
||||
|
@ -752,7 +752,7 @@ async def test_login_with_auth_module(mock_hass):
|
|||
)
|
||||
|
||||
# Finally passed, get credential
|
||||
assert step["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert step["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert step["result"]
|
||||
assert step["result"].id == "mock-id"
|
||||
|
||||
|
@ -803,21 +803,21 @@ async def test_login_with_multi_auth_module(mock_hass):
|
|||
)
|
||||
|
||||
step = await manager.login_flow.async_init(("insecure_example", None))
|
||||
assert step["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert step["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
step = await manager.login_flow.async_configure(
|
||||
step["flow_id"], {"username": "test-user", "password": "test-pass"}
|
||||
)
|
||||
|
||||
# After auth_provider validated, request select auth module
|
||||
assert step["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert step["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert step["step_id"] == "select_mfa_module"
|
||||
|
||||
step = await manager.login_flow.async_configure(
|
||||
step["flow_id"], {"multi_factor_auth_module": "module2"}
|
||||
)
|
||||
|
||||
assert step["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert step["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert step["step_id"] == "mfa"
|
||||
|
||||
step = await manager.login_flow.async_configure(
|
||||
|
@ -825,7 +825,7 @@ async def test_login_with_multi_auth_module(mock_hass):
|
|||
)
|
||||
|
||||
# Finally passed, get credential
|
||||
assert step["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert step["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert step["result"]
|
||||
assert step["result"].id == "mock-id"
|
||||
|
||||
|
@ -871,13 +871,13 @@ async def test_auth_module_expired_session(mock_hass):
|
|||
)
|
||||
|
||||
step = await manager.login_flow.async_init(("insecure_example", None))
|
||||
assert step["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert step["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
step = await manager.login_flow.async_configure(
|
||||
step["flow_id"], {"username": "test-user", "password": "test-pass"}
|
||||
)
|
||||
|
||||
assert step["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert step["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert step["step_id"] == "mfa"
|
||||
|
||||
with patch(
|
||||
|
@ -888,7 +888,7 @@ async def test_auth_module_expired_session(mock_hass):
|
|||
step["flow_id"], {"pin": "test-pin"}
|
||||
)
|
||||
# login flow abort due session timeout
|
||||
assert step["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert step["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert step["reason"] == "login_expired"
|
||||
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ async def test_show_form(hass: HomeAssistant) -> None:
|
|||
|
||||
result = await flow.async_step_user(user_input=None)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
|
@ -39,7 +39,7 @@ async def test_one_config_allowed(hass: HomeAssistant) -> None:
|
|||
|
||||
step_user_result = await flow.async_step_user()
|
||||
|
||||
assert step_user_result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert step_user_result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert step_user_result["reason"] == "single_instance_allowed"
|
||||
|
||||
|
||||
|
@ -104,7 +104,7 @@ async def test_step_user(hass: HomeAssistant) -> None:
|
|||
DOMAIN, context={"source": SOURCE_USER}, data=conf
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "user@email.com"
|
||||
assert result["data"] == {
|
||||
CONF_USERNAME: "user@email.com",
|
||||
|
@ -125,7 +125,7 @@ async def test_step_mfa(hass: HomeAssistant) -> None:
|
|||
DOMAIN, context={"source": SOURCE_USER}, data=conf
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "mfa"
|
||||
|
||||
with patch(
|
||||
|
@ -147,7 +147,7 @@ async def test_step_mfa(hass: HomeAssistant) -> None:
|
|||
result["flow_id"], user_input={"mfa_code": "123456"}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "user@email.com"
|
||||
assert result["data"] == {
|
||||
CONF_USERNAME: "user@email.com",
|
||||
|
@ -175,7 +175,7 @@ async def test_step_reauth(hass: HomeAssistant) -> None:
|
|||
data=conf,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
|
||||
with patch("homeassistant.config_entries.ConfigEntries.async_reload"):
|
||||
|
@ -184,7 +184,7 @@ async def test_step_reauth(hass: HomeAssistant) -> None:
|
|||
user_input=conf,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "reauth_successful"
|
||||
|
||||
assert len(hass.config_entries.async_entries()) == 1
|
||||
|
|
|
@ -75,7 +75,7 @@ async def test_invalid_credentials(hass: HomeAssistant) -> None:
|
|||
),
|
||||
), patch(
|
||||
"homeassistant.components.abode.config_flow.AbodeFlowHandler.async_step_reauth",
|
||||
return_value={"type": data_entry_flow.RESULT_TYPE_FORM},
|
||||
return_value={"type": data_entry_flow.FlowResultType.FORM},
|
||||
) as mock_async_step_reauth:
|
||||
await setup_platform(hass, ALARM_DOMAIN)
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ async def test_show_form(hass):
|
|||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == SOURCE_USER
|
||||
|
||||
|
||||
|
@ -134,7 +134,7 @@ async def test_create_entry(hass):
|
|||
data=VALID_CONFIG,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "abcd"
|
||||
assert result["data"][CONF_NAME] == "abcd"
|
||||
assert result["data"][CONF_LATITUDE] == 55.55
|
||||
|
@ -171,14 +171,14 @@ async def test_options_flow(hass):
|
|||
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"], user_input={CONF_FORECAST: True}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {CONF_FORECAST: True}
|
||||
|
||||
await hass.async_block_till_done()
|
||||
|
|
|
@ -47,7 +47,7 @@ async def test_show_form_no_hubs(hass, mock_hub_discover):
|
|||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "no_devices_found"
|
||||
|
||||
# Check we performed the discovery
|
||||
|
@ -66,7 +66,7 @@ async def test_show_form_one_hub(hass, mock_hub_discover, mock_hub_run):
|
|||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == dummy_hub_1.id
|
||||
assert result["result"].data == {
|
||||
CONF_HOST: DUMMY_HOST1,
|
||||
|
@ -91,7 +91,7 @@ async def test_show_form_two_hubs(hass, mock_hub_discover):
|
|||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
# Check we performed the discovery
|
||||
|
@ -117,7 +117,7 @@ async def test_create_second_entry(hass, mock_hub_run, mock_hub_discover):
|
|||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == dummy_hub_2.id
|
||||
assert result["result"].data == {
|
||||
CONF_HOST: DUMMY_HOST2,
|
||||
|
|
|
@ -35,7 +35,7 @@ async def test_show_authenticate_form(hass: HomeAssistant) -> None:
|
|||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
|
@ -55,7 +55,7 @@ async def test_connection_error(
|
|||
)
|
||||
|
||||
assert result
|
||||
assert result.get("type") == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result.get("type") == data_entry_flow.FlowResultType.FORM
|
||||
assert result.get("step_id") == "user"
|
||||
assert result.get("errors") == {"base": "cannot_connect"}
|
||||
|
||||
|
@ -78,14 +78,14 @@ async def test_full_flow_implementation(
|
|||
|
||||
assert result
|
||||
assert result.get("flow_id")
|
||||
assert result.get("type") == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result.get("type") == data_entry_flow.FlowResultType.FORM
|
||||
assert result.get("step_id") == "user"
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input=FIXTURE_USER_INPUT
|
||||
)
|
||||
assert result2
|
||||
assert result2.get("type") == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result2.get("title") == FIXTURE_USER_INPUT[CONF_HOST]
|
||||
|
||||
data = result2.get("data")
|
||||
|
@ -132,7 +132,7 @@ async def test_hassio_already_configured(hass: HomeAssistant) -> None:
|
|||
context={"source": config_entries.SOURCE_HASSIO},
|
||||
)
|
||||
assert result
|
||||
assert result.get("type") == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result.get("type") == data_entry_flow.FlowResultType.ABORT
|
||||
assert result.get("reason") == "already_configured"
|
||||
|
||||
|
||||
|
@ -154,7 +154,7 @@ async def test_hassio_ignored(hass: HomeAssistant) -> None:
|
|||
context={"source": config_entries.SOURCE_HASSIO},
|
||||
)
|
||||
assert result
|
||||
assert result.get("type") == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result.get("type") == data_entry_flow.FlowResultType.ABORT
|
||||
assert result.get("reason") == "already_configured"
|
||||
|
||||
|
||||
|
@ -176,14 +176,14 @@ async def test_hassio_confirm(
|
|||
context={"source": config_entries.SOURCE_HASSIO},
|
||||
)
|
||||
assert result
|
||||
assert result.get("type") == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result.get("type") == data_entry_flow.FlowResultType.FORM
|
||||
assert result.get("step_id") == "hassio_confirm"
|
||||
assert result.get("description_placeholders") == {"addon": "AdGuard Home Addon"}
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
|
||||
assert result2
|
||||
assert result2.get("type") == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result2.get("title") == "AdGuard Home Addon"
|
||||
|
||||
data = result2.get("data")
|
||||
|
@ -215,6 +215,6 @@ async def test_hassio_connection_error(
|
|||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
|
||||
assert result
|
||||
assert result.get("type") == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result.get("type") == data_entry_flow.FlowResultType.FORM
|
||||
assert result.get("step_id") == "hassio_confirm"
|
||||
assert result.get("errors") == {"base": "cannot_connect"}
|
||||
|
|
|
@ -19,7 +19,7 @@ async def test_form(hass, aioclient_mock):
|
|||
result1 = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result1["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result1["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result1["step_id"] == "user"
|
||||
assert result1["errors"] == {}
|
||||
|
||||
|
@ -33,7 +33,7 @@ async def test_form(hass, aioclient_mock):
|
|||
)
|
||||
|
||||
assert len(aioclient_mock.mock_calls) == 1
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "testname"
|
||||
assert result2["data"] == USER_INPUT
|
||||
await hass.async_block_till_done()
|
||||
|
@ -47,7 +47,7 @@ async def test_form(hass, aioclient_mock):
|
|||
result3["flow_id"],
|
||||
USER_INPUT,
|
||||
)
|
||||
assert result4["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result4["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
|
||||
|
||||
async def test_form_cannot_connect(hass, aioclient_mock):
|
||||
|
@ -66,7 +66,7 @@ async def test_form_cannot_connect(hass, aioclient_mock):
|
|||
USER_INPUT,
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "user"
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
assert len(aioclient_mock.mock_calls) == 1
|
||||
|
|
|
@ -35,7 +35,7 @@ async def test_form(hass):
|
|||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == SOURCE_USER
|
||||
assert result["errors"] == {}
|
||||
|
||||
|
@ -49,7 +49,7 @@ async def test_form(hass):
|
|||
entry = conf_entries[0]
|
||||
assert entry.state is ConfigEntryState.LOADED
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == CONFIG[CONF_NAME]
|
||||
assert result["data"][CONF_LATITUDE] == CONFIG[CONF_LATITUDE]
|
||||
assert result["data"][CONF_LONGITUDE] == CONFIG[CONF_LONGITUDE]
|
||||
|
@ -79,14 +79,14 @@ async def test_form_options(hass):
|
|||
|
||||
result = await hass.config_entries.options.async_init(entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"], user_input={CONF_STATION_UPDATES: False}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert entry.options == {
|
||||
CONF_STATION_UPDATES: False,
|
||||
}
|
||||
|
@ -97,14 +97,14 @@ async def test_form_options(hass):
|
|||
|
||||
result = await hass.config_entries.options.async_init(entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"], user_input={CONF_STATION_UPDATES: True}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert entry.options == {
|
||||
CONF_STATION_UPDATES: True,
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ async def test_show_user_form(hass: HomeAssistant) -> None:
|
|||
)
|
||||
|
||||
assert result["step_id"] == "user"
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
|
||||
async def test_user_device_exists_abort(
|
||||
|
@ -35,7 +35,7 @@ async def test_user_device_exists_abort(
|
|||
data={CONF_HOST: "example.local", CONF_PORT: 8090},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
|
||||
|
||||
async def test_connection_error(
|
||||
|
@ -53,7 +53,7 @@ async def test_connection_error(
|
|||
|
||||
assert result["errors"]["base"] == "cannot_connect"
|
||||
assert result["step_id"] == "user"
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
|
||||
async def test_full_user_flow_implementation(
|
||||
|
@ -78,7 +78,7 @@ async def test_full_user_flow_implementation(
|
|||
)
|
||||
|
||||
assert result["step_id"] == "user"
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={CONF_HOST: "example.local", CONF_PORT: 8090}
|
||||
|
@ -88,7 +88,7 @@ async def test_full_user_flow_implementation(
|
|||
assert result["data"][CONF_PORT] == 8090
|
||||
assert result["data"][SERVER_URL] == "http://example.local:8090/"
|
||||
assert result["title"] == "DESKTOP"
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
entries = hass.config_entries.async_entries(config_flow.DOMAIN)
|
||||
assert entries[0].unique_id == "c0715bba-c2d0-48ef-9e3e-bc81c9ea4447"
|
||||
|
|
|
@ -26,7 +26,7 @@ async def test_show_form(hass):
|
|||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == SOURCE_USER
|
||||
|
||||
|
||||
|
@ -84,7 +84,7 @@ async def test_create_entry(hass, aioclient_mock):
|
|||
DOMAIN, context={"source": SOURCE_USER}, data=CONFIG
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == CONFIG[CONF_NAME]
|
||||
assert result["data"][CONF_LATITUDE] == CONFIG[CONF_LATITUDE]
|
||||
assert result["data"][CONF_LONGITUDE] == CONFIG[CONF_LONGITUDE]
|
||||
|
@ -106,7 +106,7 @@ async def test_create_entry_with_nearest_method(hass, aioclient_mock):
|
|||
DOMAIN, context={"source": SOURCE_USER}, data=CONFIG
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == CONFIG[CONF_NAME]
|
||||
assert result["data"][CONF_LATITUDE] == CONFIG[CONF_LATITUDE]
|
||||
assert result["data"][CONF_LONGITUDE] == CONFIG[CONF_LONGITUDE]
|
||||
|
|
|
@ -72,7 +72,7 @@ async def test_form(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch("pyairnow.WebServiceAPI._get", return_value=MOCK_RESPONSE), patch(
|
||||
|
@ -86,7 +86,7 @@ async def test_form(hass):
|
|||
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result2["data"] == CONFIG
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ async def test_duplicate_error(hass, config, config_entry, data):
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input=config
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -126,7 +126,7 @@ async def test_errors(hass, data, exc, errors, integration_type):
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input=data
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == errors
|
||||
|
||||
|
||||
|
@ -183,14 +183,14 @@ async def test_options_flow(hass, config_entry):
|
|||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"], user_input={CONF_SHOW_ON_MAP: False}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {CONF_SHOW_ON_MAP: False}
|
||||
|
||||
|
||||
|
@ -205,7 +205,7 @@ async def test_step_geography_by_coords(hass, config, setup_airvisual):
|
|||
result["flow_id"], user_input=config
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "Cloud API (51.528308, -0.3817765)"
|
||||
assert result["data"] == {
|
||||
CONF_API_KEY: "abcde12345",
|
||||
|
@ -237,7 +237,7 @@ async def test_step_geography_by_name(hass, config, setup_airvisual):
|
|||
result["flow_id"], user_input=config
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "Cloud API (Beijing, Beijing, China)"
|
||||
assert result["data"] == {
|
||||
CONF_API_KEY: "abcde12345",
|
||||
|
@ -265,7 +265,7 @@ async def test_step_node_pro(hass, config, setup_airvisual):
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input=config
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "Node/Pro (192.168.1.100)"
|
||||
assert result["data"] == {
|
||||
CONF_IP_ADDRESS: "192.168.1.100",
|
||||
|
@ -282,7 +282,7 @@ async def test_step_reauth(hass, config_entry, setup_airvisual):
|
|||
assert result["step_id"] == "reauth_confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"])
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
|
||||
new_api_key = "defgh67890"
|
||||
|
@ -293,7 +293,7 @@ async def test_step_reauth(hass, config_entry, setup_airvisual):
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={CONF_API_KEY: new_api_key}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "reauth_successful"
|
||||
|
||||
assert len(hass.config_entries.async_entries()) == 1
|
||||
|
@ -306,7 +306,7 @@ async def test_step_user(hass):
|
|||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
|
@ -315,7 +315,7 @@ async def test_step_user(hass):
|
|||
data={"type": INTEGRATION_TYPE_GEOGRAPHY_COORDS},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "geography_by_coords"
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
|
@ -324,7 +324,7 @@ async def test_step_user(hass):
|
|||
data={"type": INTEGRATION_TYPE_GEOGRAPHY_NAME},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "geography_by_name"
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
|
@ -333,5 +333,5 @@ async def test_step_user(hass):
|
|||
data={"type": INTEGRATION_TYPE_NODE_PRO},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "node_pro"
|
||||
|
|
|
@ -41,7 +41,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
|||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == SOURCE_USER
|
||||
assert result["errors"] == {}
|
||||
|
||||
|
@ -55,7 +55,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
|||
entry = conf_entries[0]
|
||||
assert entry.state is ConfigEntryState.LOADED
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == f"Airzone {CONFIG[CONF_HOST]}:{CONFIG[CONF_PORT]}"
|
||||
assert result["data"][CONF_HOST] == CONFIG[CONF_HOST]
|
||||
assert result["data"][CONF_PORT] == CONFIG[CONF_PORT]
|
||||
|
@ -84,7 +84,7 @@ async def test_form_invalid_system_id(hass: HomeAssistant) -> None:
|
|||
DOMAIN, context={"source": SOURCE_USER}, data=CONFIG
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == SOURCE_USER
|
||||
assert result["errors"] == {CONF_ID: "invalid_system_id"}
|
||||
|
||||
|
@ -95,7 +95,7 @@ async def test_form_invalid_system_id(hass: HomeAssistant) -> None:
|
|||
result["flow_id"], CONFIG_ID1
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
@ -103,7 +103,7 @@ async def test_form_invalid_system_id(hass: HomeAssistant) -> None:
|
|||
entry = conf_entries[0]
|
||||
assert entry.state is ConfigEntryState.LOADED
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert (
|
||||
result["title"]
|
||||
== f"Airzone {CONFIG_ID1[CONF_HOST]}:{CONFIG_ID1[CONF_PORT]}"
|
||||
|
|
|
@ -62,7 +62,7 @@ async def test_setups(hass: HomeAssistant, protocol, connection, title):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
|
@ -70,7 +70,7 @@ async def test_setups(hass: HomeAssistant, protocol, connection, title):
|
|||
{CONF_PROTOCOL: protocol},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "protocol"
|
||||
|
||||
with patch("homeassistant.components.alarmdecoder.config_flow.AdExt.open"), patch(
|
||||
|
@ -82,7 +82,7 @@ async def test_setups(hass: HomeAssistant, protocol, connection, title):
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], connection
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == title
|
||||
assert result["data"] == {
|
||||
**connection,
|
||||
|
@ -105,7 +105,7 @@ async def test_setup_connection_error(hass: HomeAssistant):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
|
@ -113,7 +113,7 @@ async def test_setup_connection_error(hass: HomeAssistant):
|
|||
{CONF_PROTOCOL: protocol},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "protocol"
|
||||
|
||||
with patch(
|
||||
|
@ -123,7 +123,7 @@ async def test_setup_connection_error(hass: HomeAssistant):
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], connection_settings
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
with patch(
|
||||
|
@ -133,7 +133,7 @@ async def test_setup_connection_error(hass: HomeAssistant):
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], connection_settings
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "unknown"}
|
||||
|
||||
|
||||
|
@ -152,7 +152,7 @@ async def test_options_arm_flow(hass: HomeAssistant):
|
|||
|
||||
result = await hass.config_entries.options.async_init(entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -160,7 +160,7 @@ async def test_options_arm_flow(hass: HomeAssistant):
|
|||
user_input={"edit_selection": "Arming Settings"},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "arm_settings"
|
||||
|
||||
with patch(
|
||||
|
@ -171,7 +171,7 @@ async def test_options_arm_flow(hass: HomeAssistant):
|
|||
user_input=user_input,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert entry.options == {
|
||||
OPTIONS_ARM: user_input,
|
||||
OPTIONS_ZONES: DEFAULT_ZONE_OPTIONS,
|
||||
|
@ -190,7 +190,7 @@ async def test_options_zone_flow(hass: HomeAssistant):
|
|||
|
||||
result = await hass.config_entries.options.async_init(entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -198,7 +198,7 @@ async def test_options_zone_flow(hass: HomeAssistant):
|
|||
user_input={"edit_selection": "Zones"},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "zone_select"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -214,7 +214,7 @@ async def test_options_zone_flow(hass: HomeAssistant):
|
|||
user_input=zone_settings,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert entry.options == {
|
||||
OPTIONS_ARM: DEFAULT_ARM_OPTIONS,
|
||||
OPTIONS_ZONES: {zone_number: zone_settings},
|
||||
|
@ -223,7 +223,7 @@ async def test_options_zone_flow(hass: HomeAssistant):
|
|||
# Make sure zone can be removed...
|
||||
result = await hass.config_entries.options.async_init(entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -231,7 +231,7 @@ async def test_options_zone_flow(hass: HomeAssistant):
|
|||
user_input={"edit_selection": "Zones"},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "zone_select"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -247,7 +247,7 @@ async def test_options_zone_flow(hass: HomeAssistant):
|
|||
user_input={},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert entry.options == {
|
||||
OPTIONS_ARM: DEFAULT_ARM_OPTIONS,
|
||||
OPTIONS_ZONES: {},
|
||||
|
@ -266,7 +266,7 @@ async def test_options_zone_flow_validation(hass: HomeAssistant):
|
|||
|
||||
result = await hass.config_entries.options.async_init(entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -274,7 +274,7 @@ async def test_options_zone_flow_validation(hass: HomeAssistant):
|
|||
user_input={"edit_selection": "Zones"},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "zone_select"
|
||||
|
||||
# Zone Number must be int
|
||||
|
@ -283,7 +283,7 @@ async def test_options_zone_flow_validation(hass: HomeAssistant):
|
|||
user_input={CONF_ZONE_NUMBER: "asd"},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "zone_select"
|
||||
assert result["errors"] == {CONF_ZONE_NUMBER: "int"}
|
||||
|
||||
|
@ -292,7 +292,7 @@ async def test_options_zone_flow_validation(hass: HomeAssistant):
|
|||
user_input={CONF_ZONE_NUMBER: zone_number},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "zone_details"
|
||||
|
||||
# CONF_RELAY_ADDR & CONF_RELAY_CHAN are inclusive
|
||||
|
@ -301,7 +301,7 @@ async def test_options_zone_flow_validation(hass: HomeAssistant):
|
|||
user_input={**zone_settings, CONF_RELAY_ADDR: "1"},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "zone_details"
|
||||
assert result["errors"] == {"base": "relay_inclusive"}
|
||||
|
||||
|
@ -310,7 +310,7 @@ async def test_options_zone_flow_validation(hass: HomeAssistant):
|
|||
user_input={**zone_settings, CONF_RELAY_CHAN: "1"},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "zone_details"
|
||||
assert result["errors"] == {"base": "relay_inclusive"}
|
||||
|
||||
|
@ -320,7 +320,7 @@ async def test_options_zone_flow_validation(hass: HomeAssistant):
|
|||
user_input={**zone_settings, CONF_RELAY_ADDR: "abc", CONF_RELAY_CHAN: "abc"},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "zone_details"
|
||||
assert result["errors"] == {
|
||||
CONF_RELAY_ADDR: "int",
|
||||
|
@ -333,7 +333,7 @@ async def test_options_zone_flow_validation(hass: HomeAssistant):
|
|||
user_input={**zone_settings, CONF_ZONE_LOOP: "1"},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "zone_details"
|
||||
assert result["errors"] == {CONF_ZONE_LOOP: "loop_rfid"}
|
||||
|
||||
|
@ -343,7 +343,7 @@ async def test_options_zone_flow_validation(hass: HomeAssistant):
|
|||
user_input={**zone_settings, CONF_ZONE_RFID: "rfid123", CONF_ZONE_LOOP: "ab"},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "zone_details"
|
||||
assert result["errors"] == {CONF_ZONE_LOOP: "int"}
|
||||
|
||||
|
@ -353,7 +353,7 @@ async def test_options_zone_flow_validation(hass: HomeAssistant):
|
|||
user_input={**zone_settings, CONF_ZONE_RFID: "rfid123", CONF_ZONE_LOOP: "5"},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "zone_details"
|
||||
assert result["errors"] == {CONF_ZONE_LOOP: "loop_range"}
|
||||
|
||||
|
@ -372,7 +372,7 @@ async def test_options_zone_flow_validation(hass: HomeAssistant):
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert entry.options == {
|
||||
OPTIONS_ARM: DEFAULT_ARM_OPTIONS,
|
||||
OPTIONS_ZONES: {
|
||||
|
@ -420,7 +420,7 @@ async def test_one_device_allowed(hass, protocol, connection):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
|
@ -428,11 +428,11 @@ async def test_one_device_allowed(hass, protocol, connection):
|
|||
{CONF_PROTOCOL: protocol},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "protocol"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], connection
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
|
|
@ -57,7 +57,7 @@ async def test_hassio(hass):
|
|||
),
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "hassio_confirm"
|
||||
|
||||
with patch(
|
||||
|
@ -67,7 +67,7 @@ async def test_hassio(hass):
|
|||
|
||||
assert len(mock_setup.mock_calls) == 1
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
assert len(hass.config_entries.async_entries(DOMAIN)) == 1
|
||||
entry = hass.config_entries.async_entries(DOMAIN)[0]
|
||||
|
@ -83,15 +83,15 @@ async def test_abort_if_existing_entry(hass):
|
|||
flow.hass = hass
|
||||
|
||||
result = await flow.async_step_user()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "single_instance_allowed"
|
||||
|
||||
result = await flow.async_step_import({})
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "single_instance_allowed"
|
||||
|
||||
result = await flow.async_step_hassio(HassioServiceInfo(config={}))
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "single_instance_allowed"
|
||||
|
||||
|
||||
|
@ -123,7 +123,7 @@ async def test_full_flow(
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_EXTERNAL_STEP
|
||||
assert result["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP
|
||||
assert result["url"] == (
|
||||
"https://almond.stanford.edu/me/api/oauth2/authorize"
|
||||
f"?response_type=code&client_id={CLIENT_ID_VALUE}"
|
||||
|
|
|
@ -67,7 +67,7 @@ async def test_single_site(hass: HomeAssistant, single_site_api: Mock) -> None:
|
|||
initial_result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert initial_result.get("type") == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert initial_result.get("type") == data_entry_flow.FlowResultType.FORM
|
||||
assert initial_result.get("step_id") == "user"
|
||||
|
||||
# Test filling in API key
|
||||
|
@ -76,7 +76,7 @@ async def test_single_site(hass: HomeAssistant, single_site_api: Mock) -> None:
|
|||
context={"source": SOURCE_USER},
|
||||
data={CONF_API_TOKEN: API_KEY},
|
||||
)
|
||||
assert enter_api_key_result.get("type") == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert enter_api_key_result.get("type") == data_entry_flow.FlowResultType.FORM
|
||||
assert enter_api_key_result.get("step_id") == "site"
|
||||
|
||||
select_site_result = await hass.config_entries.flow.async_configure(
|
||||
|
@ -85,7 +85,7 @@ async def test_single_site(hass: HomeAssistant, single_site_api: Mock) -> None:
|
|||
)
|
||||
|
||||
# Show available sites
|
||||
assert select_site_result.get("type") == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert select_site_result.get("type") == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert select_site_result.get("title") == "Home"
|
||||
data = select_site_result.get("data")
|
||||
assert data
|
||||
|
@ -102,7 +102,7 @@ async def test_no_site(hass: HomeAssistant, no_site_api: Mock) -> None:
|
|||
data={CONF_API_TOKEN: "psk_123456789"},
|
||||
)
|
||||
|
||||
assert result.get("type") == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result.get("type") == data_entry_flow.FlowResultType.FORM
|
||||
# Goes back to the user step
|
||||
assert result.get("step_id") == "user"
|
||||
assert result.get("errors") == {"api_token": "no_site"}
|
||||
|
@ -113,7 +113,7 @@ async def test_invalid_key(hass: HomeAssistant, invalid_key_api: Mock) -> None:
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result.get("type") == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result.get("type") == data_entry_flow.FlowResultType.FORM
|
||||
assert result.get("step_id") == "user"
|
||||
|
||||
# Test filling in API key
|
||||
|
@ -122,7 +122,7 @@ async def test_invalid_key(hass: HomeAssistant, invalid_key_api: Mock) -> None:
|
|||
context={"source": SOURCE_USER},
|
||||
data={CONF_API_TOKEN: "psk_123456789"},
|
||||
)
|
||||
assert result.get("type") == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result.get("type") == data_entry_flow.FlowResultType.FORM
|
||||
# Goes back to the user step
|
||||
assert result.get("step_id") == "user"
|
||||
assert result.get("errors") == {"api_token": "invalid_api_token"}
|
||||
|
@ -133,7 +133,7 @@ async def test_unknown_error(hass: HomeAssistant, api_error: Mock) -> None:
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result.get("type") == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result.get("type") == data_entry_flow.FlowResultType.FORM
|
||||
assert result.get("step_id") == "user"
|
||||
|
||||
# Test filling in API key
|
||||
|
@ -142,7 +142,7 @@ async def test_unknown_error(hass: HomeAssistant, api_error: Mock) -> None:
|
|||
context={"source": SOURCE_USER},
|
||||
data={CONF_API_TOKEN: "psk_123456789"},
|
||||
)
|
||||
assert result.get("type") == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result.get("type") == data_entry_flow.FlowResultType.FORM
|
||||
# Goes back to the user step
|
||||
assert result.get("step_id") == "user"
|
||||
assert result.get("errors") == {"api_token": "unknown_error"}
|
||||
|
|
|
@ -35,7 +35,7 @@ async def test_abort_if_no_implementation_registered(hass):
|
|||
flow.hass = hass
|
||||
|
||||
result = await flow.async_step_user()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "missing_configuration"
|
||||
|
||||
|
||||
|
@ -48,12 +48,12 @@ async def test_abort_if_already_setup(hass):
|
|||
config_flow.DOMAIN,
|
||||
context={"source": config_entries.SOURCE_USER},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
with pytest.raises(data_entry_flow.AbortFlow):
|
||||
result = await flow.async_step_code()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -63,7 +63,7 @@ async def test_full_flow_implementation(hass):
|
|||
flow = await init_config_flow(hass)
|
||||
|
||||
result = await flow.async_step_user()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "auth"
|
||||
assert (
|
||||
result["description_placeholders"]["cb_url"]
|
||||
|
@ -78,7 +78,7 @@ async def test_full_flow_implementation(hass):
|
|||
|
||||
with patch("ambiclimate.AmbiclimateOAuth.get_access_token", return_value="test"):
|
||||
result = await flow.async_step_code("123ABC")
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "Ambiclimate"
|
||||
assert result["data"]["callback_url"] == "https://example.com/api/ambiclimate"
|
||||
assert result["data"][CONF_CLIENT_SECRET] == "secret"
|
||||
|
@ -86,14 +86,14 @@ async def test_full_flow_implementation(hass):
|
|||
|
||||
with patch("ambiclimate.AmbiclimateOAuth.get_access_token", return_value=None):
|
||||
result = await flow.async_step_code("123ABC")
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
|
||||
with patch(
|
||||
"ambiclimate.AmbiclimateOAuth.get_access_token",
|
||||
side_effect=ambiclimate.AmbiclimateOauthError(),
|
||||
):
|
||||
result = await flow.async_step_code("123ABC")
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
|
||||
|
||||
async def test_abort_invalid_code(hass):
|
||||
|
@ -103,7 +103,7 @@ async def test_abort_invalid_code(hass):
|
|||
|
||||
with patch("ambiclimate.AmbiclimateOAuth.get_access_token", return_value=None):
|
||||
result = await flow.async_step_code("invalid")
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "access_token"
|
||||
|
||||
|
||||
|
@ -115,7 +115,7 @@ async def test_already_setup(hass):
|
|||
context={"source": config_entries.SOURCE_USER},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ async def test_duplicate_error(hass, config, config_entry, setup_ambient_station
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=config
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -31,7 +31,7 @@ async def test_errors(hass, config, devices, error, setup_ambient_station):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=config
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": error}
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ async def test_show_form(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
|
@ -49,7 +49,7 @@ async def test_step_user(hass, config, setup_ambient_station):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=config
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "67890fghij67"
|
||||
assert result["data"] == {
|
||||
CONF_API_KEY: "12345abcde12345abcde",
|
||||
|
|
|
@ -97,7 +97,7 @@ async def test_user(hass, config, eth_mac, wifi_mac):
|
|||
flow_result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER, "show_advanced_options": True}
|
||||
)
|
||||
assert flow_result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert flow_result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert flow_result["step_id"] == "user"
|
||||
|
||||
# test with all provided
|
||||
|
@ -110,7 +110,7 @@ async def test_user(hass, config, eth_mac, wifi_mac):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == HOST
|
||||
assert result["data"] == config
|
||||
|
||||
|
@ -134,7 +134,7 @@ async def test_user_adbkey(hass):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == HOST
|
||||
assert result["data"] == config_data
|
||||
|
||||
|
@ -152,7 +152,7 @@ async def test_error_both_key_server(hass):
|
|||
data=config_data,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "key_and_server"}
|
||||
|
||||
with patch(
|
||||
|
@ -164,7 +164,7 @@ async def test_error_both_key_server(hass):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == HOST
|
||||
assert result2["data"] == CONFIG_ADB_SERVER
|
||||
|
||||
|
@ -179,7 +179,7 @@ async def test_error_invalid_key(hass):
|
|||
data=config_data,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "adbkey_not_file"}
|
||||
|
||||
with patch(
|
||||
|
@ -191,7 +191,7 @@ async def test_error_invalid_key(hass):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == HOST
|
||||
assert result2["data"] == CONFIG_ADB_SERVER
|
||||
|
||||
|
@ -219,7 +219,7 @@ async def test_invalid_mac(hass, config, eth_mac, wifi_mac):
|
|||
data=config,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "invalid_unique_id"
|
||||
|
||||
|
||||
|
@ -237,7 +237,7 @@ async def test_abort_if_host_exist(hass):
|
|||
data=config_data,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -260,7 +260,7 @@ async def test_abort_if_unique_exist(hass):
|
|||
data=CONFIG_ADB_SERVER,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -275,7 +275,7 @@ async def test_on_connect_failed(hass):
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
flow_result["flow_id"], user_input=CONFIG_ADB_SERVER
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
with patch(
|
||||
|
@ -285,7 +285,7 @@ async def test_on_connect_failed(hass):
|
|||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input=CONFIG_ADB_SERVER
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "unknown"}
|
||||
|
||||
with patch(
|
||||
|
@ -297,7 +297,7 @@ async def test_on_connect_failed(hass):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result3["title"] == HOST
|
||||
assert result3["data"] == CONFIG_ADB_SERVER
|
||||
|
||||
|
@ -320,7 +320,7 @@ async def test_options_flow(hass):
|
|||
await hass.async_block_till_done()
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
# test app form with existing app
|
||||
|
@ -330,7 +330,7 @@ async def test_options_flow(hass):
|
|||
CONF_APPS: "app1",
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "apps"
|
||||
|
||||
# test change value in apps form
|
||||
|
@ -340,7 +340,7 @@ async def test_options_flow(hass):
|
|||
CONF_APP_NAME: "Appl1",
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
# test app form with new app
|
||||
|
@ -350,7 +350,7 @@ async def test_options_flow(hass):
|
|||
CONF_APPS: APPS_NEW_ID,
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "apps"
|
||||
|
||||
# test save value for new app
|
||||
|
@ -361,7 +361,7 @@ async def test_options_flow(hass):
|
|||
CONF_APP_NAME: "Appl2",
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
# test app form for delete
|
||||
|
@ -371,7 +371,7 @@ async def test_options_flow(hass):
|
|||
CONF_APPS: "app1",
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "apps"
|
||||
|
||||
# test delete app1
|
||||
|
@ -382,7 +382,7 @@ async def test_options_flow(hass):
|
|||
CONF_APP_DELETE: True,
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
# test rules form with existing rule
|
||||
|
@ -392,7 +392,7 @@ async def test_options_flow(hass):
|
|||
CONF_STATE_DETECTION_RULES: "com.plexapp.android",
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "rules"
|
||||
|
||||
# test change value in rule form with invalid json rule
|
||||
|
@ -402,7 +402,7 @@ async def test_options_flow(hass):
|
|||
CONF_RULE_VALUES: "a",
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "rules"
|
||||
assert result["errors"] == {"base": "invalid_det_rules"}
|
||||
|
||||
|
@ -413,7 +413,7 @@ async def test_options_flow(hass):
|
|||
CONF_RULE_VALUES: json.dumps({"a": "b"}),
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "rules"
|
||||
assert result["errors"] == {"base": "invalid_det_rules"}
|
||||
|
||||
|
@ -424,7 +424,7 @@ async def test_options_flow(hass):
|
|||
CONF_RULE_VALUES: json.dumps(["standby"]),
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
# test rule form with new rule
|
||||
|
@ -434,7 +434,7 @@ async def test_options_flow(hass):
|
|||
CONF_STATE_DETECTION_RULES: RULES_NEW_ID,
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "rules"
|
||||
|
||||
# test save value for new rule
|
||||
|
@ -445,7 +445,7 @@ async def test_options_flow(hass):
|
|||
CONF_RULE_VALUES: json.dumps(VALID_DETECT_RULE),
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
# test rules form with delete existing rule
|
||||
|
@ -455,7 +455,7 @@ async def test_options_flow(hass):
|
|||
CONF_STATE_DETECTION_RULES: "com.plexapp.android",
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "rules"
|
||||
|
||||
# test delete rule
|
||||
|
@ -465,7 +465,7 @@ async def test_options_flow(hass):
|
|||
CONF_RULE_DELETE: True,
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -479,7 +479,7 @@ async def test_options_flow(hass):
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
apps_options = config_entry.options[CONF_APPS]
|
||||
assert apps_options.get("app1") is None
|
||||
|
|
|
@ -71,7 +71,7 @@ async def test_user_input_device_not_found(hass, mrp_device):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
|
@ -79,7 +79,7 @@ async def test_user_input_device_not_found(hass, mrp_device):
|
|||
{"device_input": "none"},
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "no_devices_found"}
|
||||
|
||||
|
||||
|
@ -95,7 +95,7 @@ async def test_user_input_unexpected_error(hass, mock_scan):
|
|||
{"device_input": "dummy"},
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "unknown"}
|
||||
|
||||
|
||||
|
@ -104,31 +104,31 @@ async def test_user_adds_full_device(hass, full_device, pairing):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
{"device_input": "MRP Device"},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["description_placeholders"] == {
|
||||
"name": "MRP Device",
|
||||
"type": "Unknown",
|
||||
}
|
||||
|
||||
result3 = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result3["description_placeholders"] == {"protocol": "MRP"}
|
||||
|
||||
result4 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {"pin": 1111}
|
||||
)
|
||||
assert result4["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result4["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result4["description_placeholders"] == {"protocol": "DMAP", "pin": 1111}
|
||||
|
||||
result5 = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result5["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result5["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result5["description_placeholders"] == {"protocol": "AirPlay"}
|
||||
|
||||
result6 = await hass.config_entries.flow.async_configure(
|
||||
|
@ -157,14 +157,14 @@ async def test_user_adds_dmap_device(hass, dmap_device, dmap_pin, pairing):
|
|||
result["flow_id"],
|
||||
{"device_input": "DMAP Device"},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["description_placeholders"] == {
|
||||
"name": "DMAP Device",
|
||||
"type": "Unknown",
|
||||
}
|
||||
|
||||
result3 = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result3["description_placeholders"] == {"pin": 1111, "protocol": "DMAP"}
|
||||
|
||||
result6 = await hass.config_entries.flow.async_configure(
|
||||
|
@ -195,7 +195,7 @@ async def test_user_adds_dmap_device_failed(hass, dmap_device, dmap_pin, pairing
|
|||
await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result2["reason"] == "device_did_not_pair"
|
||||
|
||||
|
||||
|
@ -211,7 +211,7 @@ async def test_user_adds_device_with_ip_filter(
|
|||
result["flow_id"],
|
||||
{"device_input": "127.0.0.1"},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["description_placeholders"] == {
|
||||
"name": "DMAP Device",
|
||||
"type": "Unknown",
|
||||
|
@ -268,7 +268,7 @@ async def test_user_adds_existing_device(hass, mrp_device):
|
|||
result["flow_id"],
|
||||
{"device_input": "127.0.0.1"},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "already_configured"}
|
||||
|
||||
|
||||
|
@ -294,7 +294,7 @@ async def test_user_connection_failed(hass, mrp_device, pairing_mock):
|
|||
result["flow_id"],
|
||||
{},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result2["reason"] == "setup_failed"
|
||||
|
||||
|
||||
|
@ -315,7 +315,7 @@ async def test_user_start_pair_error_failed(hass, mrp_device, pairing_mock):
|
|||
result["flow_id"],
|
||||
{},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result2["reason"] == "invalid_auth"
|
||||
|
||||
|
||||
|
@ -336,14 +336,14 @@ async def test_user_pair_service_with_password(
|
|||
result["flow_id"],
|
||||
{},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "password"
|
||||
|
||||
result3 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
{},
|
||||
)
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result3["reason"] == "setup_failed"
|
||||
|
||||
|
||||
|
@ -363,14 +363,14 @@ async def test_user_pair_disabled_service(hass, dmap_with_requirement, pairing_m
|
|||
result["flow_id"],
|
||||
{},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "protocol_disabled"
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
{},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result2["reason"] == "setup_failed"
|
||||
|
||||
|
||||
|
@ -390,7 +390,7 @@ async def test_user_pair_ignore_unsupported(hass, dmap_with_requirement, pairing
|
|||
result["flow_id"],
|
||||
{},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "setup_failed"
|
||||
|
||||
|
||||
|
@ -416,7 +416,7 @@ async def test_user_pair_invalid_pin(hass, mrp_device, pairing_mock):
|
|||
result["flow_id"],
|
||||
{"pin": 1111},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
|
||||
|
@ -442,7 +442,7 @@ async def test_user_pair_unexpected_error(hass, mrp_device, pairing_mock):
|
|||
result["flow_id"],
|
||||
{"pin": 1111},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "unknown"}
|
||||
|
||||
|
||||
|
@ -463,7 +463,7 @@ async def test_user_pair_backoff_error(hass, mrp_device, pairing_mock):
|
|||
result["flow_id"],
|
||||
{},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result2["reason"] == "backoff"
|
||||
|
||||
|
||||
|
@ -484,7 +484,7 @@ async def test_user_pair_begin_unexpected_error(hass, mrp_device, pairing_mock):
|
|||
result["flow_id"],
|
||||
{},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result2["reason"] == "unknown"
|
||||
|
||||
|
||||
|
@ -499,14 +499,14 @@ async def test_ignores_disabled_service(hass, airplay_with_disabled_mrp, pairing
|
|||
result["flow_id"],
|
||||
{"device_input": "mrpid"},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["description_placeholders"] == {
|
||||
"name": "AirPlay Device",
|
||||
"type": "Unknown",
|
||||
}
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["description_placeholders"] == {"protocol": "AirPlay"}
|
||||
|
||||
result3 = await hass.config_entries.flow.async_configure(
|
||||
|
@ -541,7 +541,7 @@ async def test_zeroconf_unsupported_service_aborts(hass):
|
|||
properties={},
|
||||
),
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "unknown"
|
||||
|
||||
|
||||
|
@ -560,7 +560,7 @@ async def test_zeroconf_add_mrp_device(hass, mrp_device, pairing):
|
|||
type="_mediaremotetv._tcp.local.",
|
||||
),
|
||||
)
|
||||
assert unrelated_result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert unrelated_result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
|
@ -575,7 +575,7 @@ async def test_zeroconf_add_mrp_device(hass, mrp_device, pairing):
|
|||
type="_mediaremotetv._tcp.local.",
|
||||
),
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["description_placeholders"] == {
|
||||
"name": "MRP Device",
|
||||
"type": "Unknown",
|
||||
|
@ -585,7 +585,7 @@ async def test_zeroconf_add_mrp_device(hass, mrp_device, pairing):
|
|||
result["flow_id"],
|
||||
{},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["description_placeholders"] == {"protocol": "MRP"}
|
||||
|
||||
result3 = await hass.config_entries.flow.async_configure(
|
||||
|
@ -605,7 +605,7 @@ async def test_zeroconf_add_dmap_device(hass, dmap_device, dmap_pin, pairing):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_ZEROCONF}, data=DMAP_SERVICE
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["description_placeholders"] == {
|
||||
"name": "DMAP Device",
|
||||
"type": "Unknown",
|
||||
|
@ -615,7 +615,7 @@ async def test_zeroconf_add_dmap_device(hass, dmap_device, dmap_pin, pairing):
|
|||
result["flow_id"],
|
||||
{},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["description_placeholders"] == {"protocol": "DMAP", "pin": 1111}
|
||||
|
||||
result3 = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
|
@ -654,7 +654,7 @@ async def test_zeroconf_ip_change(hass, mock_scan):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
assert len(mock_async_setup.mock_calls) == 2
|
||||
assert entry.data[CONF_ADDRESS] == "127.0.0.1"
|
||||
|
@ -693,7 +693,7 @@ async def test_zeroconf_ip_change_via_secondary_identifier(hass, mock_scan):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
assert len(mock_async_setup.mock_calls) == 2
|
||||
assert entry.data[CONF_ADDRESS] == "127.0.0.1"
|
||||
|
@ -709,7 +709,7 @@ async def test_zeroconf_add_existing_aborts(hass, dmap_device):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_ZEROCONF}, data=DMAP_SERVICE
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_in_progress"
|
||||
|
||||
|
||||
|
@ -718,7 +718,7 @@ async def test_zeroconf_add_but_device_not_found(hass, mock_scan):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_ZEROCONF}, data=DMAP_SERVICE
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "no_devices_found"
|
||||
|
||||
|
||||
|
@ -729,7 +729,7 @@ async def test_zeroconf_add_existing_device(hass, dmap_device):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_ZEROCONF}, data=DMAP_SERVICE
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -740,7 +740,7 @@ async def test_zeroconf_unexpected_error(hass, mock_scan):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_ZEROCONF}, data=DMAP_SERVICE
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "unknown"
|
||||
|
||||
|
||||
|
@ -764,7 +764,7 @@ async def test_zeroconf_abort_if_other_in_progress(hass, mock_scan):
|
|||
),
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
|
||||
mock_scan.result = [
|
||||
|
@ -786,7 +786,7 @@ async def test_zeroconf_abort_if_other_in_progress(hass, mock_scan):
|
|||
properties={"UniqueIdentifier": "mrpid", "Name": "Kitchen"},
|
||||
),
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result2["reason"] == "already_in_progress"
|
||||
|
||||
|
||||
|
@ -844,7 +844,7 @@ async def test_zeroconf_missing_device_during_protocol_resolve(
|
|||
result["flow_id"],
|
||||
{},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result2["reason"] == "device_not_found"
|
||||
|
||||
|
||||
|
@ -904,7 +904,7 @@ async def test_zeroconf_additional_protocol_resolve_failure(
|
|||
result["flow_id"],
|
||||
{},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result2["reason"] == "inconsistent_device"
|
||||
|
||||
|
||||
|
@ -930,7 +930,7 @@ async def test_zeroconf_pair_additionally_found_protocols(
|
|||
properties={"deviceid": "airplayid"},
|
||||
),
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
await hass.async_block_till_done()
|
||||
|
||||
mock_scan.result = [
|
||||
|
@ -981,7 +981,7 @@ async def test_zeroconf_pair_additionally_found_protocols(
|
|||
{},
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "pair_no_pin"
|
||||
assert result2["description_placeholders"] == {"pin": ANY, "protocol": "RAOP"}
|
||||
|
||||
|
@ -991,7 +991,7 @@ async def test_zeroconf_pair_additionally_found_protocols(
|
|||
{},
|
||||
)
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result3["step_id"] == "pair_with_pin"
|
||||
assert result3["description_placeholders"] == {"protocol": "MRP"}
|
||||
|
||||
|
@ -999,7 +999,7 @@ async def test_zeroconf_pair_additionally_found_protocols(
|
|||
result["flow_id"],
|
||||
{"pin": 1234},
|
||||
)
|
||||
assert result4["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result4["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result4["step_id"] == "pair_with_pin"
|
||||
assert result4["description_placeholders"] == {"protocol": "AirPlay"}
|
||||
|
||||
|
@ -1007,7 +1007,7 @@ async def test_zeroconf_pair_additionally_found_protocols(
|
|||
result["flow_id"],
|
||||
{"pin": 1234},
|
||||
)
|
||||
assert result5["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result5["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
|
||||
# Re-configuration
|
||||
|
@ -1030,13 +1030,13 @@ async def test_reconfigure_update_credentials(hass, mrp_device, pairing):
|
|||
result["flow_id"],
|
||||
{},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["description_placeholders"] == {"protocol": "MRP"}
|
||||
|
||||
result3 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {"pin": 1111}
|
||||
)
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result3["reason"] == "reauth_successful"
|
||||
|
||||
assert config_entry.data == {
|
||||
|
@ -1058,7 +1058,7 @@ async def test_option_start_off(hass):
|
|||
config_entry.add_to_hass(hass)
|
||||
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
result2 = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"], user_input={CONF_START_OFF: True}
|
||||
|
@ -1083,5 +1083,5 @@ async def test_zeroconf_rejects_ipv6(hass):
|
|||
properties={"CtlN": "Apple TV"},
|
||||
),
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "ipv6_not_supported"
|
||||
|
|
|
@ -160,7 +160,7 @@ class OAuthFixture:
|
|||
)
|
||||
|
||||
result = await self.hass.config_entries.flow.async_configure(result["flow_id"])
|
||||
assert result.get("type") == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result.get("type") == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result.get("title") == self.title
|
||||
assert "data" in result
|
||||
assert "token" in result["data"]
|
||||
|
@ -417,7 +417,7 @@ async def test_config_flow_no_credentials(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
TEST_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result.get("type") == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result.get("type") == data_entry_flow.FlowResultType.ABORT
|
||||
assert result.get("reason") == "missing_configuration"
|
||||
|
||||
|
||||
|
@ -444,7 +444,7 @@ async def test_config_flow_other_domain(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
TEST_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result.get("type") == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result.get("type") == data_entry_flow.FlowResultType.ABORT
|
||||
assert result.get("reason") == "missing_configuration"
|
||||
|
||||
|
||||
|
@ -467,7 +467,7 @@ async def test_config_flow(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
TEST_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result.get("type") == data_entry_flow.RESULT_TYPE_EXTERNAL_STEP
|
||||
assert result.get("type") == data_entry_flow.FlowResultType.EXTERNAL_STEP
|
||||
result = await oauth_fixture.complete_external_step(result)
|
||||
assert (
|
||||
result["data"].get("auth_implementation") == "fake_integration_some_client_id"
|
||||
|
@ -511,14 +511,14 @@ async def test_config_flow_multiple_entries(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
TEST_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result.get("type") == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result.get("type") == data_entry_flow.FlowResultType.FORM
|
||||
assert result.get("step_id") == "pick_implementation"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={"implementation": "fake_integration_some_client_id2"},
|
||||
)
|
||||
assert result.get("type") == data_entry_flow.RESULT_TYPE_EXTERNAL_STEP
|
||||
assert result.get("type") == data_entry_flow.FlowResultType.EXTERNAL_STEP
|
||||
oauth_fixture.client_id = CLIENT_ID + "2"
|
||||
oauth_fixture.title = CLIENT_ID + "2"
|
||||
result = await oauth_fixture.complete_external_step(result)
|
||||
|
@ -548,7 +548,7 @@ async def test_config_flow_create_delete_credential(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
TEST_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result.get("type") == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result.get("type") == data_entry_flow.FlowResultType.ABORT
|
||||
assert result.get("reason") == "missing_configuration"
|
||||
|
||||
|
||||
|
@ -565,7 +565,7 @@ async def test_config_flow_with_config_credential(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
TEST_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result.get("type") == data_entry_flow.RESULT_TYPE_EXTERNAL_STEP
|
||||
assert result.get("type") == data_entry_flow.FlowResultType.EXTERNAL_STEP
|
||||
oauth_fixture.title = DEFAULT_IMPORT_NAME
|
||||
result = await oauth_fixture.complete_external_step(result)
|
||||
# Uses the imported auth domain for compatibility
|
||||
|
@ -583,7 +583,7 @@ async def test_import_without_setup(hass, config_credential):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
TEST_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result.get("type") == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result.get("type") == data_entry_flow.FlowResultType.ABORT
|
||||
assert result.get("reason") == "missing_configuration"
|
||||
|
||||
|
||||
|
@ -612,7 +612,7 @@ async def test_websocket_without_platform(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
TEST_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result.get("type") == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result.get("type") == data_entry_flow.FlowResultType.ABORT
|
||||
assert result.get("reason") == "missing_configuration"
|
||||
|
||||
|
||||
|
@ -687,7 +687,7 @@ async def test_platform_with_auth_implementation(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
TEST_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result.get("type") == data_entry_flow.RESULT_TYPE_EXTERNAL_STEP
|
||||
assert result.get("type") == data_entry_flow.FlowResultType.EXTERNAL_STEP
|
||||
oauth_fixture.title = DEFAULT_IMPORT_NAME
|
||||
result = await oauth_fixture.complete_external_step(result)
|
||||
# Uses the imported auth domain for compatibility
|
||||
|
@ -745,7 +745,7 @@ async def test_name(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
TEST_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result.get("type") == data_entry_flow.RESULT_TYPE_EXTERNAL_STEP
|
||||
assert result.get("type") == data_entry_flow.FlowResultType.EXTERNAL_STEP
|
||||
oauth_fixture.title = NAME
|
||||
result = await oauth_fixture.complete_external_step(result)
|
||||
assert (
|
||||
|
|
|
@ -65,11 +65,11 @@ async def test_ssdp(hass, dummy_client):
|
|||
context={CONF_SOURCE: SOURCE_SSDP},
|
||||
data=MOCK_DISCOVER,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == f"Arcam FMJ ({MOCK_HOST})"
|
||||
assert result["data"] == MOCK_CONFIG_ENTRY
|
||||
|
||||
|
@ -86,7 +86,7 @@ async def test_ssdp_abort(hass):
|
|||
context={CONF_SOURCE: SOURCE_SSDP},
|
||||
data=MOCK_DISCOVER,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -99,11 +99,11 @@ async def test_ssdp_unable_to_connect(hass, dummy_client):
|
|||
context={CONF_SOURCE: SOURCE_SSDP},
|
||||
data=MOCK_DISCOVER,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "cannot_connect"
|
||||
|
||||
|
||||
|
@ -122,7 +122,7 @@ async def test_ssdp_update(hass):
|
|||
context={CONF_SOURCE: SOURCE_SSDP},
|
||||
data=MOCK_DISCOVER,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
assert entry.data[CONF_HOST] == MOCK_HOST
|
||||
|
@ -137,7 +137,7 @@ async def test_user(hass, aioclient_mock):
|
|||
data=None,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
user_input = {
|
||||
|
@ -149,7 +149,7 @@ async def test_user(hass, aioclient_mock):
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == f"Arcam FMJ ({MOCK_HOST})"
|
||||
assert result["data"] == MOCK_CONFIG_ENTRY
|
||||
assert result["result"].unique_id == MOCK_UUID
|
||||
|
@ -168,7 +168,7 @@ async def test_invalid_ssdp(hass, aioclient_mock):
|
|||
context={CONF_SOURCE: SOURCE_USER},
|
||||
data=user_input,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == f"Arcam FMJ ({MOCK_HOST})"
|
||||
assert result["data"] == MOCK_CONFIG_ENTRY
|
||||
assert result["result"].unique_id is None
|
||||
|
@ -187,7 +187,7 @@ async def test_user_wrong(hass, aioclient_mock):
|
|||
context={CONF_SOURCE: SOURCE_USER},
|
||||
data=user_input,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == f"Arcam FMJ ({MOCK_HOST})"
|
||||
assert result["result"].unique_id is None
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ async def test_user(hass, mock_unique_id, unique_id):
|
|||
flow_result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER, "show_advanced_options": True}
|
||||
)
|
||||
assert flow_result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert flow_result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert flow_result["step_id"] == "user"
|
||||
|
||||
# test with all provided
|
||||
|
@ -92,7 +92,7 @@ async def test_user(hass, mock_unique_id, unique_id):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == HOST
|
||||
assert result["data"] == CONFIG_DATA
|
||||
|
||||
|
@ -116,7 +116,7 @@ async def test_error_wrong_password_ssh(hass, config, error):
|
|||
data=config_data,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": error}
|
||||
|
||||
|
||||
|
@ -136,7 +136,7 @@ async def test_error_invalid_ssh(hass):
|
|||
data=config_data,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "ssh_not_file"}
|
||||
|
||||
|
||||
|
@ -152,7 +152,7 @@ async def test_error_invalid_host(hass):
|
|||
data=CONFIG_DATA,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "invalid_host"}
|
||||
|
||||
|
||||
|
@ -168,7 +168,7 @@ async def test_abort_if_not_unique_id_setup(hass):
|
|||
context={"source": SOURCE_USER},
|
||||
data=CONFIG_DATA,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "no_unique_id"
|
||||
|
||||
|
||||
|
@ -192,7 +192,7 @@ async def test_update_uniqueid_exist(hass, mock_unique_id):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == HOST
|
||||
assert result["data"] == CONFIG_DATA
|
||||
prev_entry = hass.config_entries.async_get_entry(existing_entry.entry_id)
|
||||
|
@ -214,7 +214,7 @@ async def test_abort_invalid_unique_id(hass):
|
|||
context={"source": SOURCE_USER},
|
||||
data=CONFIG_DATA,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "invalid_unique_id"
|
||||
|
||||
|
||||
|
@ -244,7 +244,7 @@ async def test_on_connect_failed(hass, side_effect, error):
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
flow_result["flow_id"], user_input=CONFIG_DATA
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": error}
|
||||
|
||||
|
||||
|
@ -262,7 +262,7 @@ async def test_options_flow(hass):
|
|||
await hass.async_block_till_done()
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -276,7 +276,7 @@ async def test_options_flow(hass):
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options[CONF_CONSIDER_HOME] == 20
|
||||
assert config_entry.options[CONF_TRACK_UNKNOWN] is True
|
||||
assert config_entry.options[CONF_INTERFACE] == "aaa"
|
||||
|
|
|
@ -17,7 +17,7 @@ async def test_show_form(hass: HomeAssistant, aioclient_mock: AiohttpClientMocke
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
|
@ -30,7 +30,7 @@ async def test_adding_second_device(
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=USER_INPUT
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
with patch(
|
||||
"pyatag.AtagOne.id",
|
||||
|
@ -39,7 +39,7 @@ async def test_adding_second_device(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=USER_INPUT
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
|
||||
async def test_connection_error(
|
||||
|
@ -53,7 +53,7 @@ async def test_connection_error(
|
|||
data=USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
@ -66,7 +66,7 @@ async def test_unauthorized(hass: HomeAssistant, aioclient_mock: AiohttpClientMo
|
|||
context={"source": config_entries.SOURCE_USER},
|
||||
data=USER_INPUT,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "unauthorized"}
|
||||
|
||||
|
@ -81,6 +81,6 @@ async def test_full_flow_implementation(
|
|||
context={"source": config_entries.SOURCE_USER},
|
||||
data=USER_INPUT,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == UID
|
||||
assert result["result"].unique_id == UID
|
||||
|
|
|
@ -101,7 +101,7 @@ async def test_option_flow(hass):
|
|||
data=None,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -109,6 +109,6 @@ async def test_option_flow(hass):
|
|||
user_input={"forecast_threshold": 65},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == ""
|
||||
assert result["data"]["forecast_threshold"] == 65
|
||||
|
|
|
@ -58,7 +58,7 @@ async def test_form(hass):
|
|||
{CONF_PORT: "/dev/ttyUSB7", CONF_ADDRESS: 7},
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
assert result2["data"] == {
|
||||
CONF_PORT: "/dev/ttyUSB7",
|
||||
|
|
|
@ -23,7 +23,7 @@ async def test_auth_failure(hass: HomeAssistant) -> None:
|
|||
"""Test init with an authentication failure."""
|
||||
with patch(
|
||||
"homeassistant.components.aussie_broadband.config_flow.ConfigFlow.async_step_reauth",
|
||||
return_value={"type": data_entry_flow.RESULT_TYPE_FORM},
|
||||
return_value={"type": data_entry_flow.FlowResultType.FORM},
|
||||
) as mock_async_step_reauth:
|
||||
await setup_platform(hass, side_effect=AuthenticationException())
|
||||
mock_async_step_reauth.assert_called_once()
|
||||
|
|
|
@ -64,7 +64,7 @@ async def test_ws_setup_depose_mfa(hass, hass_ws_client):
|
|||
assert result["success"]
|
||||
|
||||
flow = result["result"]
|
||||
assert flow["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert flow["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert flow["handler"] == "example_module"
|
||||
assert flow["step_id"] == "init"
|
||||
assert flow["data_schema"][0] == {"type": "string", "name": "pin", "required": True}
|
||||
|
@ -83,7 +83,7 @@ async def test_ws_setup_depose_mfa(hass, hass_ws_client):
|
|||
assert result["success"]
|
||||
|
||||
flow = result["result"]
|
||||
assert flow["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert flow["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert flow["handler"] == "example_module"
|
||||
assert flow["data"]["result"] is None
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ async def test_show_form(hass):
|
|||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == SOURCE_USER
|
||||
|
||||
|
||||
|
@ -95,7 +95,7 @@ async def test_reauth(hass: HomeAssistant) -> None:
|
|||
context={"source": SOURCE_REAUTH, "unique_id": UNIQUE_ID},
|
||||
data={**CONFIG, CONF_ACCESS_TOKEN: "blah"},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
assert result["errors"] == {}
|
||||
|
||||
|
@ -105,7 +105,7 @@ async def test_reauth(hass: HomeAssistant) -> None:
|
|||
user_input=CONFIG,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
assert result["errors"] == {CONF_ACCESS_TOKEN: "invalid_access_token"}
|
||||
|
||||
|
@ -117,7 +117,7 @@ async def test_reauth(hass: HomeAssistant) -> None:
|
|||
user_input=CONFIG,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "reauth_successful"
|
||||
|
||||
|
||||
|
@ -133,7 +133,7 @@ async def test_reauth_error(hass: HomeAssistant) -> None:
|
|||
context={"source": SOURCE_REAUTH, "unique_id": UNIQUE_ID},
|
||||
data={**CONFIG, CONF_ACCESS_TOKEN: "blah"},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
assert result["errors"] == {}
|
||||
|
||||
|
@ -143,7 +143,7 @@ async def test_reauth_error(hass: HomeAssistant) -> None:
|
|||
user_input=CONFIG,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "unknown"
|
||||
|
||||
|
||||
|
@ -160,7 +160,7 @@ async def test_create_entry(hass):
|
|||
DOMAIN, context={"source": SOURCE_USER}, data=CONFIG
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "foo@bar.com (32406)"
|
||||
assert result["data"][CONF_ACCESS_TOKEN] == CONFIG[CONF_ACCESS_TOKEN]
|
||||
assert result["result"].unique_id == UNIQUE_ID
|
||||
|
|
|
@ -27,7 +27,7 @@ async def test_show_user_form(hass: HomeAssistant) -> None:
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@ async def test_authorization_error(hass: HomeAssistant) -> None:
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
|
@ -50,7 +50,7 @@ async def test_authorization_error(hass: HomeAssistant) -> None:
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "user"
|
||||
assert result2["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
|
@ -67,7 +67,7 @@ async def test_reauth_authorization_error(hass: HomeAssistant) -> None:
|
|||
data=FIXTURE_USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth"
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
|
@ -76,7 +76,7 @@ async def test_reauth_authorization_error(hass: HomeAssistant) -> None:
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "reauth"
|
||||
assert result2["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
|
@ -91,7 +91,7 @@ async def test_connection_error(hass: HomeAssistant) -> None:
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
|
@ -100,7 +100,7 @@ async def test_connection_error(hass: HomeAssistant) -> None:
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "user"
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
@ -117,7 +117,7 @@ async def test_reauth_connection_error(hass: HomeAssistant) -> None:
|
|||
data=FIXTURE_USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth"
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
|
@ -126,7 +126,7 @@ async def test_reauth_connection_error(hass: HomeAssistant) -> None:
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "reauth"
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
@ -146,7 +146,7 @@ async def test_project_error(hass: HomeAssistant) -> None:
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
|
@ -155,7 +155,7 @@ async def test_project_error(hass: HomeAssistant) -> None:
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "user"
|
||||
assert result2["errors"] == {"base": "project_error"}
|
||||
|
||||
|
@ -177,7 +177,7 @@ async def test_reauth_project_error(hass: HomeAssistant) -> None:
|
|||
data=FIXTURE_USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth"
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
|
@ -186,7 +186,7 @@ async def test_reauth_project_error(hass: HomeAssistant) -> None:
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "reauth"
|
||||
assert result2["errors"] == {"base": "project_error"}
|
||||
|
||||
|
@ -208,7 +208,7 @@ async def test_reauth_flow(hass: HomeAssistant) -> None:
|
|||
data=FIXTURE_USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth"
|
||||
assert result["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
|
@ -229,7 +229,7 @@ async def test_reauth_flow(hass: HomeAssistant) -> None:
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result2["reason"] == "reauth_successful"
|
||||
|
||||
|
||||
|
@ -253,7 +253,7 @@ async def test_full_flow_implementation(hass: HomeAssistant) -> None:
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
|
@ -263,7 +263,7 @@ async def test_full_flow_implementation(hass: HomeAssistant) -> None:
|
|||
await hass.async_block_till_done()
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert (
|
||||
result2["title"]
|
||||
== f"{FIXTURE_USER_INPUT[CONF_ORG]}/{FIXTURE_USER_INPUT[CONF_PROJECT]}"
|
||||
|
|
|
@ -63,7 +63,7 @@ async def test_form(
|
|||
result2["flow_id"],
|
||||
step2_config.copy(),
|
||||
)
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result3["title"] == "test-instance"
|
||||
assert result3["data"] == data_config
|
||||
mock_setup_entry.assert_called_once()
|
||||
|
@ -79,7 +79,7 @@ async def test_import(hass, mock_setup_entry):
|
|||
data=IMPORT_CONFIG.copy(),
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "test-instance"
|
||||
options = {
|
||||
CONF_SEND_INTERVAL: import_config.pop(CONF_SEND_INTERVAL),
|
||||
|
@ -109,7 +109,7 @@ async def test_single_instance(hass, source):
|
|||
context={"source": source},
|
||||
data=BASE_CONFIG_CS.copy(),
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "single_instance_allowed"
|
||||
|
||||
|
||||
|
@ -138,7 +138,7 @@ async def test_connection_error_sas(
|
|||
result["flow_id"],
|
||||
SAS_CONFIG.copy(),
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": error_message}
|
||||
|
||||
|
||||
|
@ -168,7 +168,7 @@ async def test_connection_error_cs(
|
|||
result["flow_id"],
|
||||
CS_CONFIG.copy(),
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": error_message}
|
||||
|
||||
|
||||
|
@ -176,13 +176,13 @@ async def test_options_flow(hass, entry):
|
|||
"""Test options flow."""
|
||||
result = await hass.config_entries.options.async_init(entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
assert result["last_step"]
|
||||
|
||||
updated = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"], UPDATE_OPTIONS
|
||||
)
|
||||
assert updated["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert updated["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert updated["data"] == UPDATE_OPTIONS
|
||||
await hass.async_block_till_done()
|
||||
|
|
|
@ -124,7 +124,7 @@ async def test_options_flow(hass: HomeAssistant, client: MagicMock) -> None:
|
|||
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
with patch(
|
||||
|
@ -137,5 +137,5 @@ async def test_options_flow(hass: HomeAssistant, client: MagicMock) -> None:
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert dict(config_entry.options) == {CONF_SYNC_TIME: True}
|
||||
|
|
|
@ -159,7 +159,7 @@ async def test_already_configured(hass, valid_feature_mock):
|
|||
context={"source": config_entries.SOURCE_USER},
|
||||
data={config_flow.CONF_HOST: "172.2.3.4", config_flow.CONF_PORT: 80},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "address_already_configured"
|
||||
|
||||
|
||||
|
|
|
@ -250,7 +250,7 @@ async def test_reauth_shows_user_step(hass):
|
|||
context={"source": config_entries.SOURCE_REAUTH},
|
||||
data={"username": "blink@example.com", "password": "invalid_password"},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
|
@ -280,7 +280,7 @@ async def test_options_flow(hass):
|
|||
config_entry.entry_id, context={"show_advanced_options": False}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "simple_options"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -288,6 +288,6 @@ async def test_options_flow(hass):
|
|||
user_input={"scan_interval": 5},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == {"scan_interval": 5}
|
||||
assert mock_blink.refresh_rate == 5
|
||||
|
|
|
@ -35,7 +35,7 @@ async def test_show_form(hass):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
|
@ -55,7 +55,7 @@ async def test_connection_error(hass):
|
|||
data=FIXTURE_USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
@ -75,7 +75,7 @@ async def test_full_user_flow_implementation(hass):
|
|||
context={"source": config_entries.SOURCE_USER},
|
||||
data=FIXTURE_USER_INPUT,
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == FIXTURE_COMPLETE_ENTRY[CONF_USERNAME]
|
||||
assert result2["data"] == FIXTURE_COMPLETE_ENTRY
|
||||
|
||||
|
@ -98,7 +98,7 @@ async def test_options_flow_implementation(hass):
|
|||
await hass.async_block_till_done()
|
||||
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "account_options"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -107,7 +107,7 @@ async def test_options_flow_implementation(hass):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == {
|
||||
CONF_READ_ONLY: True,
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ async def test_show_form(hass):
|
|||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == SOURCE_USER
|
||||
|
||||
|
||||
|
@ -88,7 +88,7 @@ async def test_authorize_no_ip_control(hass):
|
|||
DOMAIN, context={"source": SOURCE_USER}, data={CONF_HOST: "bravia-host"}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "no_ip_control"
|
||||
|
||||
|
||||
|
@ -117,7 +117,7 @@ async def test_duplicate_error(hass):
|
|||
result["flow_id"], user_input={CONF_PIN: "1234"}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -135,14 +135,14 @@ async def test_create_entry(hass):
|
|||
DOMAIN, context={"source": SOURCE_USER}, data={CONF_HOST: "bravia-host"}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "authorize"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={CONF_PIN: "1234"}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["result"].unique_id == "very_unique_string"
|
||||
assert result["title"] == "TV-Model"
|
||||
assert result["data"] == {
|
||||
|
@ -168,14 +168,14 @@ async def test_create_entry_with_ipv6_address(hass):
|
|||
data={CONF_HOST: "2001:db8::1428:57ab"},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "authorize"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={CONF_PIN: "1234"}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["result"].unique_id == "very_unique_string"
|
||||
assert result["title"] == "TV-Model"
|
||||
assert result["data"] == {
|
||||
|
@ -214,7 +214,7 @@ async def test_options_flow(hass):
|
|||
):
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -222,5 +222,5 @@ async def test_options_flow(hass):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {CONF_IGNORED_SOURCES: ["HDMI 1", "HDMI 2"]}
|
||||
|
|
|
@ -21,7 +21,7 @@ async def test_show_form(hass):
|
|||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == SOURCE_USER
|
||||
|
||||
|
||||
|
@ -37,7 +37,7 @@ async def test_create_entry_with_hostname(hass):
|
|||
data={CONF_HOST: "example.local", CONF_TYPE: "laser"},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "HL-L2340DW 0123456789"
|
||||
assert result["data"][CONF_HOST] == "example.local"
|
||||
assert result["data"][CONF_TYPE] == "laser"
|
||||
|
@ -53,7 +53,7 @@ async def test_create_entry_with_ipv4_address(hass):
|
|||
DOMAIN, context={"source": SOURCE_USER}, data=CONFIG
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "HL-L2340DW 0123456789"
|
||||
assert result["data"][CONF_HOST] == "127.0.0.1"
|
||||
assert result["data"][CONF_TYPE] == "laser"
|
||||
|
@ -71,7 +71,7 @@ async def test_create_entry_with_ipv6_address(hass):
|
|||
data={CONF_HOST: "2001:db8::1428:57ab", CONF_TYPE: "laser"},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "HL-L2340DW 0123456789"
|
||||
assert result["data"][CONF_HOST] == "2001:db8::1428:57ab"
|
||||
assert result["data"][CONF_TYPE] == "laser"
|
||||
|
@ -116,7 +116,7 @@ async def test_unsupported_model_error(hass):
|
|||
DOMAIN, context={"source": SOURCE_USER}, data=CONFIG
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "unsupported_model"
|
||||
|
||||
|
||||
|
@ -133,7 +133,7 @@ async def test_device_exists_abort(hass):
|
|||
DOMAIN, context={"source": SOURCE_USER}, data=CONFIG
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -155,7 +155,7 @@ async def test_zeroconf_snmp_error(hass):
|
|||
),
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "cannot_connect"
|
||||
|
||||
|
||||
|
@ -176,7 +176,7 @@ async def test_zeroconf_unsupported_model(hass):
|
|||
),
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "unsupported_model"
|
||||
assert len(mock_get_data.mock_calls) == 0
|
||||
|
||||
|
@ -208,7 +208,7 @@ async def test_zeroconf_device_exists_abort(hass):
|
|||
),
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
# Test config entry got updated with latest IP
|
||||
|
@ -235,7 +235,7 @@ async def test_zeroconf_no_probe_existing_device(hass):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
assert len(mock_get_data.mock_calls) == 0
|
||||
|
||||
|
@ -264,13 +264,13 @@ async def test_zeroconf_confirm_create_entry(hass):
|
|||
assert result["step_id"] == "zeroconf_confirm"
|
||||
assert result["description_placeholders"]["model"] == "HL-L2340DW"
|
||||
assert result["description_placeholders"]["serial_number"] == "0123456789"
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={CONF_TYPE: "laser"}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "HL-L2340DW 0123456789"
|
||||
assert result["data"][CONF_HOST] == "127.0.0.1"
|
||||
assert result["data"][CONF_TYPE] == "laser"
|
||||
|
|
|
@ -35,7 +35,7 @@ async def test_form(hass):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "test-username"
|
||||
assert result2["data"] == CONFIG
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
@ -57,7 +57,7 @@ async def test_form_duplicate_login(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=CONFIG
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -80,17 +80,17 @@ async def test_form_error(hass, side_effect, error_message):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=CONFIG
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": error_message}
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"side_effect, result_type, password, step_id, reason",
|
||||
[
|
||||
(None, data_entry_flow.RESULT_TYPE_ABORT, "test", None, "reauth_successful"),
|
||||
(None, data_entry_flow.FlowResultType.ABORT, "test", None, "reauth_successful"),
|
||||
(
|
||||
Exception,
|
||||
data_entry_flow.RESULT_TYPE_FORM,
|
||||
data_entry_flow.FlowResultType.FORM,
|
||||
CONFIG[CONF_PASSWORD],
|
||||
"reauth_confirm",
|
||||
None,
|
||||
|
@ -115,7 +115,7 @@ async def test_reauth(hass, side_effect, result_type, password, step_id, reason)
|
|||
},
|
||||
data=None,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
with patch(
|
||||
"homeassistant.components.brunt.config_flow.BruntClientAsync.async_login",
|
||||
|
|
|
@ -28,7 +28,7 @@ async def test_show_user_form(hass: HomeAssistant) -> None:
|
|||
)
|
||||
|
||||
assert result["step_id"] == "user"
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
|
||||
async def test_connection_error(
|
||||
|
@ -54,7 +54,7 @@ async def test_connection_error(
|
|||
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
assert result["step_id"] == "user"
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
|
||||
async def test_user_device_exists_abort(
|
||||
|
@ -75,7 +75,7 @@ async def test_user_device_exists_abort(
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
|
||||
|
||||
async def test_full_user_flow_implementation(
|
||||
|
@ -94,7 +94,7 @@ async def test_full_user_flow_implementation(
|
|||
)
|
||||
|
||||
assert result["step_id"] == "user"
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
|
@ -114,7 +114,7 @@ async def test_full_user_flow_implementation(
|
|||
assert result["data"][CONF_PORT] == 80
|
||||
assert result["data"][CONF_DEVICE_IDENT] == "RVS21.831F/127"
|
||||
assert result["title"] == "RVS21.831F/127"
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
entries = hass.config_entries.async_entries(config_flow.DOMAIN)
|
||||
assert entries[0].unique_id == "RVS21.831F/127"
|
||||
|
@ -136,7 +136,7 @@ async def test_full_user_flow_implementation_without_auth(
|
|||
)
|
||||
|
||||
assert result["step_id"] == "user"
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
|
@ -153,7 +153,7 @@ async def test_full_user_flow_implementation_without_auth(
|
|||
assert result["data"][CONF_PORT] == 80
|
||||
assert result["data"][CONF_DEVICE_IDENT] == "RVS21.831F/127"
|
||||
assert result["title"] == "RVS21.831F/127"
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
entries = hass.config_entries.async_entries(config_flow.DOMAIN)
|
||||
assert entries[0].unique_id == "RVS21.831F/127"
|
||||
|
|
|
@ -96,7 +96,7 @@ async def test_options_flow(hass):
|
|||
), patch(
|
||||
"homeassistant.components.buienradar.async_unload_entry", return_value=True
|
||||
):
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
|
|
@ -24,10 +24,10 @@ async def test_creating_entry_sets_up_media_player(hass):
|
|||
)
|
||||
|
||||
# Confirmation form
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
@ -190,7 +190,7 @@ async def test_option_flow(hass, parameter_data):
|
|||
|
||||
# Test ignore_cec and uuid options are hidden if advanced options are disabled
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "basic_options"
|
||||
data_schema = result["data_schema"].schema
|
||||
assert set(data_schema) == {"known_hosts"}
|
||||
|
@ -201,7 +201,7 @@ async def test_option_flow(hass, parameter_data):
|
|||
result = await hass.config_entries.options.async_init(
|
||||
config_entry.entry_id, context=context
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "basic_options"
|
||||
data_schema = result["data_schema"].schema
|
||||
for other_param in basic_parameters:
|
||||
|
@ -218,7 +218,7 @@ async def test_option_flow(hass, parameter_data):
|
|||
result["flow_id"],
|
||||
user_input=user_input_dict,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "advanced_options"
|
||||
for other_param in basic_parameters:
|
||||
if other_param == parameter:
|
||||
|
@ -243,7 +243,7 @@ async def test_option_flow(hass, parameter_data):
|
|||
result["flow_id"],
|
||||
user_input=user_input_dict,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] is None
|
||||
for other_param in advanced_parameters:
|
||||
if other_param == parameter:
|
||||
|
@ -257,7 +257,7 @@ async def test_option_flow(hass, parameter_data):
|
|||
result["flow_id"],
|
||||
user_input={"known_hosts": ""},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] is None
|
||||
expected_data = {**orig_data, "known_hosts": []}
|
||||
if parameter in advanced_parameters:
|
||||
|
|
|
@ -18,7 +18,7 @@ async def test_user(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
with patch(
|
||||
|
@ -27,7 +27,7 @@ async def test_user(hass):
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={CONF_HOST: HOST, CONF_PORT: PORT}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == HOST
|
||||
assert result["data"][CONF_HOST] == HOST
|
||||
assert result["data"][CONF_PORT] == PORT
|
||||
|
@ -42,7 +42,7 @@ async def test_user_with_bad_cert(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
with patch(
|
||||
|
@ -53,7 +53,7 @@ async def test_user_with_bad_cert(hass):
|
|||
result["flow_id"], user_input={CONF_HOST: HOST, CONF_PORT: PORT}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == HOST
|
||||
assert result["data"][CONF_HOST] == HOST
|
||||
assert result["data"][CONF_PORT] == PORT
|
||||
|
@ -78,7 +78,7 @@ async def test_import_host_only(hass):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == HOST
|
||||
assert result["data"][CONF_HOST] == HOST
|
||||
assert result["data"][CONF_PORT] == DEFAULT_PORT
|
||||
|
@ -100,7 +100,7 @@ async def test_import_host_and_port(hass):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == HOST
|
||||
assert result["data"][CONF_HOST] == HOST
|
||||
assert result["data"][CONF_PORT] == PORT
|
||||
|
@ -122,7 +122,7 @@ async def test_import_non_default_port(hass):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == f"{HOST}:888"
|
||||
assert result["data"][CONF_HOST] == HOST
|
||||
assert result["data"][CONF_PORT] == 888
|
||||
|
@ -144,7 +144,7 @@ async def test_import_with_name(hass):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == HOST
|
||||
assert result["data"][CONF_HOST] == HOST
|
||||
assert result["data"][CONF_PORT] == PORT
|
||||
|
@ -163,7 +163,7 @@ async def test_bad_import(hass):
|
|||
data={CONF_HOST: HOST},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "import_failed"
|
||||
|
||||
|
||||
|
@ -180,7 +180,7 @@ async def test_abort_if_already_setup(hass):
|
|||
context={"source": config_entries.SOURCE_IMPORT},
|
||||
data={CONF_HOST: HOST, CONF_PORT: PORT},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
|
@ -188,7 +188,7 @@ async def test_abort_if_already_setup(hass):
|
|||
context={"source": config_entries.SOURCE_USER},
|
||||
data={CONF_HOST: HOST, CONF_PORT: PORT},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -205,7 +205,7 @@ async def test_abort_on_socket_failed(hass):
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={CONF_HOST: HOST}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {CONF_HOST: "resolve_failed"}
|
||||
|
||||
with patch(
|
||||
|
@ -215,7 +215,7 @@ async def test_abort_on_socket_failed(hass):
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={CONF_HOST: HOST}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {CONF_HOST: "connection_timeout"}
|
||||
|
||||
with patch(
|
||||
|
@ -225,5 +225,5 @@ async def test_abort_on_socket_failed(hass):
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={CONF_HOST: HOST}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {CONF_HOST: "connection_refused"}
|
||||
|
|
|
@ -33,14 +33,14 @@ async def test_options_flow(
|
|||
|
||||
result = await hass.config_entries.options.async_init(entry.entry_id, data=None)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"], user_input={CONF_TIMESTEP: 1}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == ""
|
||||
assert result["data"][CONF_TIMESTEP] == 1
|
||||
assert entry.options[CONF_TIMESTEP] == 1
|
||||
|
|
|
@ -132,7 +132,7 @@ async def test_implementation(hass, flow_handler, current_request_with_host):
|
|||
TEST_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_EXTERNAL_STEP
|
||||
assert result["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP
|
||||
assert result["url"] == "http://example.com/auth"
|
||||
|
||||
flow_finished.set_result(
|
||||
|
|
|
@ -1075,7 +1075,7 @@ async def test_ignore_flow(hass, hass_ws_client):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
"test", context={"source": core_ce.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
await ws_client.send_json(
|
||||
{
|
||||
|
|
|
@ -183,7 +183,7 @@ async def test_no_user_input(crownstone_setup: MockFixture, hass: HomeAssistant)
|
|||
DOMAIN, context={"source": "user"}
|
||||
)
|
||||
# show the login form
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert crownstone_setup.call_count == 0
|
||||
|
||||
|
@ -211,7 +211,7 @@ async def test_abort_if_configured(crownstone_setup: MockFixture, hass: HomeAssi
|
|||
result = await start_config_flow(hass, get_mocked_crownstone_cloud())
|
||||
|
||||
# test if we abort if we try to configure the same entry
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
assert crownstone_setup.call_count == 0
|
||||
|
||||
|
@ -228,7 +228,7 @@ async def test_authentication_errors(
|
|||
|
||||
result = await start_config_flow(hass, cloud)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
# side effect: auth error account not verified
|
||||
|
@ -238,7 +238,7 @@ async def test_authentication_errors(
|
|||
|
||||
result = await start_config_flow(hass, cloud)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "account_not_verified"}
|
||||
assert crownstone_setup.call_count == 0
|
||||
|
||||
|
@ -251,7 +251,7 @@ async def test_unknown_error(crownstone_setup: MockFixture, hass: HomeAssistant)
|
|||
|
||||
result = await start_config_flow(hass, cloud)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "unknown_error"}
|
||||
assert crownstone_setup.call_count == 0
|
||||
|
||||
|
@ -271,14 +271,14 @@ async def test_successful_login_no_usb(
|
|||
|
||||
result = await start_config_flow(hass, get_mocked_crownstone_cloud())
|
||||
# should show usb form
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "usb_config"
|
||||
|
||||
# don't setup USB dongle, create entry
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={CONF_USB_PATH: DONT_USE_USB}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == entry_data_without_usb
|
||||
assert result["options"] == entry_options_without_usb
|
||||
assert crownstone_setup.call_count == 1
|
||||
|
@ -304,7 +304,7 @@ async def test_successful_login_with_usb(
|
|||
hass, get_mocked_crownstone_cloud(create_mocked_spheres(2))
|
||||
)
|
||||
# should show usb form
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "usb_config"
|
||||
assert pyserial_comports_none_types.call_count == 1
|
||||
|
||||
|
@ -324,7 +324,7 @@ async def test_successful_login_with_usb(
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={CONF_USB_PATH: port_select}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "usb_sphere_config"
|
||||
assert pyserial_comports_none_types.call_count == 2
|
||||
assert usb_path.call_count == 1
|
||||
|
@ -333,7 +333,7 @@ async def test_successful_login_with_usb(
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={CONF_USB_SPHERE: "sphere_name_1"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == entry_data_with_usb
|
||||
assert result["options"] == entry_options_with_usb
|
||||
assert crownstone_setup.call_count == 1
|
||||
|
@ -356,7 +356,7 @@ async def test_successful_login_with_manual_usb_path(
|
|||
hass, get_mocked_crownstone_cloud(create_mocked_spheres(1))
|
||||
)
|
||||
# should show usb form
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "usb_config"
|
||||
assert pyserial_comports.call_count == 1
|
||||
|
||||
|
@ -365,7 +365,7 @@ async def test_successful_login_with_manual_usb_path(
|
|||
result["flow_id"], user_input={CONF_USB_PATH: MANUAL_PATH}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "usb_manual_config"
|
||||
assert pyserial_comports.call_count == 2
|
||||
|
||||
|
@ -377,7 +377,7 @@ async def test_successful_login_with_manual_usb_path(
|
|||
|
||||
# since we only have 1 sphere here, test that it's automatically selected and
|
||||
# creating entry without asking for user input
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == entry_data_with_manual_usb
|
||||
assert result["options"] == entry_options_with_manual_usb
|
||||
assert crownstone_setup.call_count == 1
|
||||
|
@ -413,7 +413,7 @@ async def test_options_flow_setup_usb(
|
|||
),
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
schema = result["data_schema"].schema
|
||||
|
@ -427,7 +427,7 @@ async def test_options_flow_setup_usb(
|
|||
result = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"], user_input={CONF_USE_USB_OPTION: True}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "usb_config"
|
||||
assert pyserial_comports.call_count == 1
|
||||
|
||||
|
@ -447,7 +447,7 @@ async def test_options_flow_setup_usb(
|
|||
result = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"], user_input={CONF_USB_PATH: port_select}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "usb_sphere_config"
|
||||
assert pyserial_comports.call_count == 2
|
||||
assert usb_path.call_count == 1
|
||||
|
@ -456,7 +456,7 @@ async def test_options_flow_setup_usb(
|
|||
result = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"], user_input={CONF_USB_SPHERE: "sphere_name_1"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == create_mocked_entry_options_conf(
|
||||
usb_path="/dev/serial/by-id/crownstone-usb", usb_sphere="sphere_id_1"
|
||||
)
|
||||
|
@ -490,7 +490,7 @@ async def test_options_flow_remove_usb(hass: HomeAssistant):
|
|||
),
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
schema = result["data_schema"].schema
|
||||
|
@ -507,7 +507,7 @@ async def test_options_flow_remove_usb(hass: HomeAssistant):
|
|||
CONF_USB_SPHERE_OPTION: "sphere_name_0",
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == create_mocked_entry_options_conf(
|
||||
usb_path=None, usb_sphere=None
|
||||
)
|
||||
|
@ -543,13 +543,13 @@ async def test_options_flow_manual_usb_path(
|
|||
),
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"], user_input={CONF_USE_USB_OPTION: True}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "usb_config"
|
||||
assert pyserial_comports.call_count == 1
|
||||
|
||||
|
@ -558,7 +558,7 @@ async def test_options_flow_manual_usb_path(
|
|||
result["flow_id"], user_input={CONF_USB_PATH: MANUAL_PATH}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "usb_manual_config"
|
||||
assert pyserial_comports.call_count == 2
|
||||
|
||||
|
@ -568,7 +568,7 @@ async def test_options_flow_manual_usb_path(
|
|||
result["flow_id"], user_input={CONF_USB_MANUAL_PATH: path}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == create_mocked_entry_options_conf(
|
||||
usb_path=path, usb_sphere="sphere_id_0"
|
||||
)
|
||||
|
@ -602,14 +602,14 @@ async def test_options_flow_change_usb_sphere(hass: HomeAssistant):
|
|||
),
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={CONF_USE_USB_OPTION: True, CONF_USB_SPHERE_OPTION: "sphere_name_2"},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == create_mocked_entry_options_conf(
|
||||
usb_path="/dev/serial/by-id/crownstone-usb", usb_sphere="sphere_id_2"
|
||||
)
|
||||
|
|
|
@ -425,7 +425,7 @@ async def test_options_flow(hass):
|
|||
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -433,7 +433,7 @@ async def test_options_flow(hass):
|
|||
user_input={CONF_SHOW_ALL_SOURCES: True, CONF_ZONE2: True, CONF_ZONE3: True},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
CONF_SHOW_ALL_SOURCES: True,
|
||||
CONF_ZONE2: True,
|
||||
|
|
|
@ -17,7 +17,7 @@ async def test_form(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
|
@ -33,7 +33,7 @@ async def test_form(hass):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == CONFIG[CONF_USERNAME]
|
||||
assert result2["data"] == CONFIG
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
@ -54,7 +54,7 @@ async def test_form_account_error(hass):
|
|||
CONFIG,
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
|
||||
|
@ -73,7 +73,7 @@ async def test_form_session_error(hass):
|
|||
CONFIG,
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
|
@ -92,7 +92,7 @@ async def test_form_unknown_error(hass):
|
|||
CONFIG,
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "unknown"}
|
||||
|
||||
|
||||
|
@ -107,14 +107,14 @@ async def test_option_flow_default(hass):
|
|||
|
||||
result = await hass.config_entries.options.async_init(entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result2 = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result2["data"] == {
|
||||
CONF_UNIT_OF_MEASUREMENT: MG_DL,
|
||||
}
|
||||
|
@ -131,14 +131,14 @@ async def test_option_flow(hass):
|
|||
|
||||
result = await hass.config_entries.options.async_init(entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={CONF_UNIT_OF_MEASUREMENT: MMOL_L},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == {
|
||||
CONF_UNIT_OF_MEASUREMENT: MMOL_L,
|
||||
}
|
||||
|
|
|
@ -87,10 +87,10 @@ async def fixture(hass, hass_client_no_auth):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
"dialogflow", context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM, result
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM, result
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
webhook_id = result["result"].data["webhook_id"]
|
||||
|
||||
return await hass_client_no_auth(), webhook_id
|
||||
|
|
|
@ -28,7 +28,7 @@ async def test_flow_user(hass: HomeAssistant) -> None:
|
|||
result["flow_id"],
|
||||
user_input=CONF_INPUT,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == NAME
|
||||
assert result["data"] == CONF_DATA
|
||||
|
||||
|
@ -45,7 +45,7 @@ async def test_flow_user_already_configured(hass: HomeAssistant) -> None:
|
|||
result["flow_id"],
|
||||
user_input=CONF_INPUT,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -58,7 +58,7 @@ async def test_flow_user_invalid_auth(hass: HomeAssistant) -> None:
|
|||
context={"source": config_entries.SOURCE_USER},
|
||||
data=CONF_DATA,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
|
@ -67,7 +67,7 @@ async def test_flow_user_invalid_auth(hass: HomeAssistant) -> None:
|
|||
result["flow_id"],
|
||||
user_input=CONF_INPUT,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == NAME
|
||||
assert result["data"] == CONF_DATA
|
||||
|
||||
|
@ -81,7 +81,7 @@ async def test_flow_user_cannot_connect(hass: HomeAssistant) -> None:
|
|||
context={"source": config_entries.SOURCE_USER},
|
||||
data=CONF_DATA,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
@ -90,7 +90,7 @@ async def test_flow_user_cannot_connect(hass: HomeAssistant) -> None:
|
|||
result["flow_id"],
|
||||
user_input=CONF_INPUT,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == NAME
|
||||
assert result["data"] == CONF_DATA
|
||||
|
||||
|
@ -104,7 +104,7 @@ async def test_flow_user_unknown_error(hass: HomeAssistant) -> None:
|
|||
context={"source": config_entries.SOURCE_USER},
|
||||
data=CONF_DATA,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "unknown"}
|
||||
|
||||
|
@ -113,7 +113,7 @@ async def test_flow_user_unknown_error(hass: HomeAssistant) -> None:
|
|||
result["flow_id"],
|
||||
user_input=CONF_INPUT,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == NAME
|
||||
assert result["data"] == CONF_DATA
|
||||
|
||||
|
@ -131,7 +131,7 @@ async def test_flow_reauth(hass: HomeAssistant) -> None:
|
|||
data=entry.data,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
|
||||
new_conf = {CONF_API_TOKEN: "1234567890123"}
|
||||
|
@ -141,7 +141,7 @@ async def test_flow_reauth(hass: HomeAssistant) -> None:
|
|||
result["flow_id"],
|
||||
user_input=new_conf,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
assert result["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
|
@ -150,6 +150,6 @@ async def test_flow_reauth(hass: HomeAssistant) -> None:
|
|||
result["flow_id"],
|
||||
user_input=new_conf,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "reauth_successful"
|
||||
assert entry.data == CONF_DATA | new_conf
|
||||
|
|
|
@ -84,7 +84,7 @@ async def test_user_flow_undiscovered_manual(hass: HomeAssistant) -> None:
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
assert result["step_id"] == "manual"
|
||||
|
||||
|
@ -92,7 +92,7 @@ async def test_user_flow_undiscovered_manual(hass: HomeAssistant) -> None:
|
|||
result["flow_id"], user_input={CONF_URL: MOCK_DEVICE_LOCATION}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == MOCK_DEVICE_NAME
|
||||
assert result["data"] == {
|
||||
CONF_URL: MOCK_DEVICE_LOCATION,
|
||||
|
@ -118,7 +118,7 @@ async def test_user_flow_discovered_manual(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
@ -126,7 +126,7 @@ async def test_user_flow_discovered_manual(
|
|||
result["flow_id"], user_input={}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
assert result["step_id"] == "manual"
|
||||
|
||||
|
@ -134,7 +134,7 @@ async def test_user_flow_discovered_manual(
|
|||
result["flow_id"], user_input={CONF_URL: MOCK_DEVICE_LOCATION}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == MOCK_DEVICE_NAME
|
||||
assert result["data"] == {
|
||||
CONF_URL: MOCK_DEVICE_LOCATION,
|
||||
|
@ -158,7 +158,7 @@ async def test_user_flow_selected(hass: HomeAssistant, ssdp_scanner_mock: Mock)
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
@ -166,7 +166,7 @@ async def test_user_flow_selected(hass: HomeAssistant, ssdp_scanner_mock: Mock)
|
|||
result["flow_id"], user_input={CONF_HOST: MOCK_DEVICE_NAME}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == MOCK_DEVICE_NAME
|
||||
assert result["data"] == {
|
||||
CONF_URL: MOCK_DEVICE_LOCATION,
|
||||
|
@ -188,7 +188,7 @@ async def test_user_flow_uncontactable(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
assert result["step_id"] == "manual"
|
||||
|
||||
|
@ -196,7 +196,7 @@ async def test_user_flow_uncontactable(
|
|||
result["flow_id"], user_input={CONF_URL: MOCK_DEVICE_LOCATION}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
assert result["step_id"] == "manual"
|
||||
|
||||
|
@ -221,7 +221,7 @@ async def test_user_flow_embedded_st(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
assert result["step_id"] == "manual"
|
||||
|
||||
|
@ -229,7 +229,7 @@ async def test_user_flow_embedded_st(
|
|||
result["flow_id"], user_input={CONF_URL: MOCK_DEVICE_LOCATION}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == MOCK_DEVICE_NAME
|
||||
assert result["data"] == {
|
||||
CONF_URL: MOCK_DEVICE_LOCATION,
|
||||
|
@ -251,7 +251,7 @@ async def test_user_flow_wrong_st(hass: HomeAssistant, domain_data_mock: Mock) -
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
assert result["step_id"] == "manual"
|
||||
|
||||
|
@ -259,7 +259,7 @@ async def test_user_flow_wrong_st(hass: HomeAssistant, domain_data_mock: Mock) -
|
|||
result["flow_id"], user_input={CONF_URL: MOCK_DEVICE_LOCATION}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "not_dmr"}
|
||||
assert result["step_id"] == "manual"
|
||||
|
||||
|
@ -271,7 +271,7 @@ async def test_ssdp_flow_success(hass: HomeAssistant) -> None:
|
|||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=MOCK_DISCOVERY,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
|
@ -279,7 +279,7 @@ async def test_ssdp_flow_success(hass: HomeAssistant) -> None:
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == MOCK_DEVICE_NAME
|
||||
assert result["data"] == {
|
||||
CONF_URL: MOCK_DEVICE_LOCATION,
|
||||
|
@ -302,7 +302,7 @@ async def test_ssdp_flow_unavailable(
|
|||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=MOCK_DISCOVERY,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
|
||||
domain_data_mock.upnp_factory.async_create_device.side_effect = UpnpError
|
||||
|
@ -312,7 +312,7 @@ async def test_ssdp_flow_unavailable(
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == MOCK_DEVICE_NAME
|
||||
assert result["data"] == {
|
||||
CONF_URL: MOCK_DEVICE_LOCATION,
|
||||
|
@ -342,7 +342,7 @@ async def test_ssdp_flow_existing(
|
|||
},
|
||||
),
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
assert config_entry_mock.data[CONF_URL] == NEW_DEVICE_LOCATION
|
||||
|
||||
|
@ -357,7 +357,7 @@ async def test_ssdp_flow_duplicate_location(
|
|||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=MOCK_DISCOVERY,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
assert config_entry_mock.data[CONF_URL] == MOCK_DEVICE_LOCATION
|
||||
|
||||
|
@ -382,7 +382,7 @@ async def test_ssdp_flow_upnp_udn(
|
|||
},
|
||||
),
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
assert config_entry_mock.data[CONF_URL] == NEW_DEVICE_LOCATION
|
||||
|
||||
|
@ -398,7 +398,7 @@ async def test_ssdp_missing_services(hass: HomeAssistant) -> None:
|
|||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=discovery,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "not_dmr"
|
||||
|
||||
# Service list does not contain services
|
||||
|
@ -410,7 +410,7 @@ async def test_ssdp_missing_services(hass: HomeAssistant) -> None:
|
|||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=discovery,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "not_dmr"
|
||||
|
||||
# AVTransport service is missing
|
||||
|
@ -426,7 +426,7 @@ async def test_ssdp_missing_services(hass: HomeAssistant) -> None:
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN, context={"source": config_entries.SOURCE_SSDP}, data=discovery
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "not_dmr"
|
||||
|
||||
|
||||
|
@ -448,7 +448,7 @@ async def test_ssdp_single_service(hass: HomeAssistant) -> None:
|
|||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=discovery,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "not_dmr"
|
||||
|
||||
|
||||
|
@ -462,7 +462,7 @@ async def test_ssdp_ignore_device(hass: HomeAssistant) -> None:
|
|||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=discovery,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "alternative_integration"
|
||||
|
||||
discovery = dataclasses.replace(MOCK_DISCOVERY)
|
||||
|
@ -475,7 +475,7 @@ async def test_ssdp_ignore_device(hass: HomeAssistant) -> None:
|
|||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=discovery,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "alternative_integration"
|
||||
|
||||
for manufacturer, model in [
|
||||
|
@ -493,7 +493,7 @@ async def test_ssdp_ignore_device(hass: HomeAssistant) -> None:
|
|||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=discovery,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "alternative_integration"
|
||||
|
||||
|
||||
|
@ -507,7 +507,7 @@ async def test_unignore_flow(hass: HomeAssistant, ssdp_scanner_mock: Mock) -> No
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == MOCK_DEVICE_NAME
|
||||
assert result["data"] == {}
|
||||
|
||||
|
@ -526,7 +526,7 @@ async def test_unignore_flow(hass: HomeAssistant, ssdp_scanner_mock: Mock) -> No
|
|||
context={"source": config_entries.SOURCE_UNIGNORE},
|
||||
data={"unique_id": MOCK_DEVICE_UDN},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
|
@ -534,7 +534,7 @@ async def test_unignore_flow(hass: HomeAssistant, ssdp_scanner_mock: Mock) -> No
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == MOCK_DEVICE_NAME
|
||||
assert result["data"] == {
|
||||
CONF_URL: MOCK_DEVICE_LOCATION,
|
||||
|
@ -559,7 +559,7 @@ async def test_unignore_flow_offline(
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == MOCK_DEVICE_NAME
|
||||
assert result["data"] == {}
|
||||
|
||||
|
@ -572,7 +572,7 @@ async def test_unignore_flow_offline(
|
|||
context={"source": config_entries.SOURCE_UNIGNORE},
|
||||
data={"unique_id": MOCK_DEVICE_UDN},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "discovery_error"
|
||||
|
||||
|
||||
|
@ -583,7 +583,7 @@ async def test_options_flow(
|
|||
config_entry_mock.add_to_hass(hass)
|
||||
result = await hass.config_entries.options.async_init(config_entry_mock.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
assert result["errors"] == {}
|
||||
|
||||
|
@ -597,7 +597,7 @@ async def test_options_flow(
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
assert result["errors"] == {"base": "invalid_url"}
|
||||
|
||||
|
@ -612,7 +612,7 @@ async def test_options_flow(
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == {
|
||||
CONF_LISTEN_PORT: 2222,
|
||||
CONF_CALLBACK_URL_OVERRIDE: "http://override/callback",
|
||||
|
|
|
@ -86,7 +86,7 @@ async def test_user_flow(hass: HomeAssistant, ssdp_scanner_mock: Mock) -> None:
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
@ -95,7 +95,7 @@ async def test_user_flow(hass: HomeAssistant, ssdp_scanner_mock: Mock) -> None:
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == MOCK_DEVICE_NAME
|
||||
assert result["data"] == {
|
||||
CONF_URL: MOCK_DEVICE_LOCATION,
|
||||
|
@ -119,7 +119,7 @@ async def test_user_flow_no_devices(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "no_devices_found"
|
||||
|
||||
|
||||
|
@ -130,7 +130,7 @@ async def test_ssdp_flow_success(hass: HomeAssistant) -> None:
|
|||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=MOCK_DISCOVERY,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
|
@ -138,7 +138,7 @@ async def test_ssdp_flow_success(hass: HomeAssistant) -> None:
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == MOCK_DEVICE_NAME
|
||||
assert result["data"] == {
|
||||
CONF_URL: MOCK_DEVICE_LOCATION,
|
||||
|
@ -161,7 +161,7 @@ async def test_ssdp_flow_unavailable(
|
|||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=MOCK_DISCOVERY,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
|
||||
upnp_factory_mock.async_create_device.side_effect = UpnpError
|
||||
|
@ -171,7 +171,7 @@ async def test_ssdp_flow_unavailable(
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == MOCK_DEVICE_NAME
|
||||
assert result["data"] == {
|
||||
CONF_URL: MOCK_DEVICE_LOCATION,
|
||||
|
@ -201,7 +201,7 @@ async def test_ssdp_flow_existing(
|
|||
},
|
||||
),
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
assert config_entry_mock.data[CONF_URL] == NEW_DEVICE_LOCATION
|
||||
|
||||
|
@ -216,7 +216,7 @@ async def test_ssdp_flow_duplicate_location(
|
|||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=MOCK_DISCOVERY,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
assert config_entry_mock.data[CONF_URL] == MOCK_DEVICE_LOCATION
|
||||
|
||||
|
@ -230,7 +230,7 @@ async def test_ssdp_flow_bad_data(hass: HomeAssistant) -> None:
|
|||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=discovery,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "bad_ssdp"
|
||||
|
||||
# Missing USN
|
||||
|
@ -240,7 +240,7 @@ async def test_ssdp_flow_bad_data(hass: HomeAssistant) -> None:
|
|||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=discovery,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "bad_ssdp"
|
||||
|
||||
|
||||
|
@ -280,7 +280,7 @@ async def test_duplicate_name(
|
|||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=discovery,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
|
@ -288,7 +288,7 @@ async def test_duplicate_name(
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == MOCK_DEVICE_NAME
|
||||
assert result["data"] == {
|
||||
CONF_URL: new_device_location,
|
||||
|
@ -318,7 +318,7 @@ async def test_ssdp_flow_upnp_udn(
|
|||
},
|
||||
),
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
assert config_entry_mock.data[CONF_URL] == NEW_DEVICE_LOCATION
|
||||
|
||||
|
@ -334,7 +334,7 @@ async def test_ssdp_missing_services(hass: HomeAssistant) -> None:
|
|||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=discovery,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "not_dms"
|
||||
|
||||
# Service list does not contain services
|
||||
|
@ -346,7 +346,7 @@ async def test_ssdp_missing_services(hass: HomeAssistant) -> None:
|
|||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=discovery,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "not_dms"
|
||||
|
||||
# ContentDirectory service is missing
|
||||
|
@ -362,7 +362,7 @@ async def test_ssdp_missing_services(hass: HomeAssistant) -> None:
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_SSDP}, data=discovery
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "not_dms"
|
||||
|
||||
|
||||
|
@ -384,5 +384,5 @@ async def test_ssdp_single_service(hass: HomeAssistant) -> None:
|
|||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=discovery,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "not_dms"
|
||||
|
|
|
@ -43,7 +43,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"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
doorbirdapi = _get_mock_doorbirdapi_return_values(
|
||||
|
@ -188,7 +188,7 @@ async def test_form_zeroconf_correct_oui(hass):
|
|||
),
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {}
|
||||
|
||||
|
@ -251,7 +251,7 @@ async def test_form_zeroconf_correct_oui_wrong_device(hass, doorbell_state_side_
|
|||
),
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "not_doorbird_device"
|
||||
|
||||
|
||||
|
@ -271,7 +271,7 @@ async def test_form_user_cannot_connect(hass):
|
|||
VALID_CONFIG,
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
|
@ -312,12 +312,12 @@ async def test_options_flow(hass):
|
|||
):
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"], user_input={CONF_EVENTS: "eventa, eventc, eventq"}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {CONF_EVENTS: ["eventa", "eventc", "eventq"]}
|
||||
|
|
|
@ -562,7 +562,7 @@ async def test_options_flow(hass):
|
|||
with patch(
|
||||
"homeassistant.components.dsmr.async_setup_entry", return_value=True
|
||||
), patch("homeassistant.components.dsmr.async_unload_entry", return_value=True):
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ async def test_create_entry(hass):
|
|||
DOMAIN, context={"source": SOURCE_USER}, data=CONFIG_HOSTNAME
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "dunehd-host"
|
||||
assert result["data"] == {CONF_HOST: "dunehd-host"}
|
||||
|
||||
|
@ -90,6 +90,6 @@ async def test_create_entry_with_ipv6_address(hass):
|
|||
data={CONF_HOST: "2001:db8::1428:57ab"},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "2001:db8::1428:57ab"
|
||||
assert result["data"] == {CONF_HOST: "2001:db8::1428:57ab"}
|
||||
|
|
|
@ -25,7 +25,7 @@ async def test_abort_if_already_setup(hass):
|
|||
|
||||
result = await flow.async_step_user()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "single_instance_allowed"
|
||||
|
||||
|
||||
|
@ -36,7 +36,7 @@ async def test_user_step_without_user_input(hass):
|
|||
flow.hass.data[DATA_ECOBEE_CONFIG] = {}
|
||||
|
||||
result = await flow.async_step_user()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
|
@ -53,7 +53,7 @@ async def test_pin_request_succeeds(hass):
|
|||
|
||||
result = await flow.async_step_user(user_input={CONF_API_KEY: "api-key"})
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "authorize"
|
||||
assert result["description_placeholders"] == {"pin": "test-pin"}
|
||||
|
||||
|
@ -70,7 +70,7 @@ async def test_pin_request_fails(hass):
|
|||
|
||||
result = await flow.async_step_user(user_input={CONF_API_KEY: "api-key"})
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"]["base"] == "pin_request_failed"
|
||||
|
||||
|
@ -92,7 +92,7 @@ async def test_token_request_succeeds(hass):
|
|||
|
||||
result = await flow.async_step_authorize(user_input={})
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == DOMAIN
|
||||
assert result["data"] == {
|
||||
CONF_API_KEY: "test-api-key",
|
||||
|
@ -116,7 +116,7 @@ async def test_token_request_fails(hass):
|
|||
|
||||
result = await flow.async_step_authorize(user_input={})
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "authorize"
|
||||
assert result["errors"]["base"] == "token_request_failed"
|
||||
assert result["description_placeholders"] == {"pin": "test-pin"}
|
||||
|
@ -131,7 +131,7 @@ async def test_import_flow_triggered_but_no_ecobee_conf(hass):
|
|||
|
||||
result = await flow.async_step_import(import_data=None)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
|
@ -155,7 +155,7 @@ async def test_import_flow_triggered_with_ecobee_conf_and_valid_data_and_valid_t
|
|||
|
||||
result = await flow.async_step_import(import_data=None)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == DOMAIN
|
||||
assert result["data"] == {
|
||||
CONF_API_KEY: "test-api-key",
|
||||
|
|
|
@ -31,7 +31,7 @@ async def test_show_form(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
|
@ -60,7 +60,7 @@ async def test_standard_setup(hass):
|
|||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
|
||||
async def test_one_config_allowed(hass):
|
||||
|
@ -94,7 +94,7 @@ async def test_one_config_allowed(hass):
|
|||
CONF_ELMAX_PANEL_PIN: MOCK_PANEL_PIN,
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -115,7 +115,7 @@ async def test_invalid_credentials(hass):
|
|||
},
|
||||
)
|
||||
assert login_result["step_id"] == "user"
|
||||
assert login_result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert login_result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert login_result["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
|
||||
|
@ -136,7 +136,7 @@ async def test_connection_error(hass):
|
|||
},
|
||||
)
|
||||
assert login_result["step_id"] == "user"
|
||||
assert login_result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert login_result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert login_result["errors"] == {"base": "network_error"}
|
||||
|
||||
|
||||
|
@ -164,7 +164,7 @@ async def test_unhandled_error(hass):
|
|||
},
|
||||
)
|
||||
assert result["step_id"] == "panels"
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "unknown"}
|
||||
|
||||
|
||||
|
@ -193,7 +193,7 @@ async def test_invalid_pin(hass):
|
|||
},
|
||||
)
|
||||
assert result["step_id"] == "panels"
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "invalid_pin"}
|
||||
|
||||
|
||||
|
@ -215,7 +215,7 @@ async def test_no_online_panel(hass):
|
|||
},
|
||||
)
|
||||
assert login_result["step_id"] == "user"
|
||||
assert login_result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert login_result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert login_result["errors"] == {"base": "no_panel_online"}
|
||||
|
||||
|
||||
|
@ -231,7 +231,7 @@ async def test_show_reauth(hass):
|
|||
CONF_ELMAX_PASSWORD: MOCK_PASSWORD,
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
|
||||
|
||||
|
@ -272,7 +272,7 @@ async def test_reauth_flow(hass):
|
|||
CONF_ELMAX_PASSWORD: MOCK_PASSWORD,
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
await hass.async_block_till_done()
|
||||
assert result["reason"] == "reauth_successful"
|
||||
|
||||
|
@ -316,7 +316,7 @@ async def test_reauth_panel_disappeared(hass):
|
|||
},
|
||||
)
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "reauth_panel_disappeared"}
|
||||
|
||||
|
||||
|
@ -358,7 +358,7 @@ async def test_reauth_invalid_pin(hass):
|
|||
},
|
||||
)
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "invalid_pin"}
|
||||
|
||||
|
||||
|
@ -400,5 +400,5 @@ async def test_reauth_bad_login(hass):
|
|||
},
|
||||
)
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "invalid_auth"}
|
||||
|
|
|
@ -24,7 +24,7 @@ async def test_user_flow_cannot_create_multiple_instances(hass):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "single_instance_allowed"
|
||||
|
||||
|
||||
|
@ -37,7 +37,7 @@ async def test_user_flow_with_detected_dongle(hass):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "detect"
|
||||
devices = result["data_schema"].schema.get("device").container
|
||||
assert FAKE_DONGLE_PATH in devices
|
||||
|
@ -51,7 +51,7 @@ async def test_user_flow_with_no_detected_dongle(hass):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "manual"
|
||||
|
||||
|
||||
|
@ -64,7 +64,7 @@ async def test_detection_flow_with_valid_path(hass):
|
|||
DOMAIN, context={"source": "detect"}, data={CONF_DEVICE: USER_PROVIDED_PATH}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"][CONF_DEVICE] == USER_PROVIDED_PATH
|
||||
|
||||
|
||||
|
@ -82,7 +82,7 @@ async def test_detection_flow_with_custom_path(hass):
|
|||
data={CONF_DEVICE: USER_PROVIDED_PATH},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "manual"
|
||||
|
||||
|
||||
|
@ -100,7 +100,7 @@ async def test_detection_flow_with_invalid_path(hass):
|
|||
data={CONF_DEVICE: USER_PROVIDED_PATH},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "detect"
|
||||
assert CONF_DEVICE in result["errors"]
|
||||
|
||||
|
@ -114,7 +114,7 @@ async def test_manual_flow_with_valid_path(hass):
|
|||
DOMAIN, context={"source": "manual"}, data={CONF_DEVICE: USER_PROVIDED_PATH}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"][CONF_DEVICE] == USER_PROVIDED_PATH
|
||||
|
||||
|
||||
|
@ -130,7 +130,7 @@ async def test_manual_flow_with_invalid_path(hass):
|
|||
DOMAIN, context={"source": "manual"}, data={CONF_DEVICE: USER_PROVIDED_PATH}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "manual"
|
||||
assert CONF_DEVICE in result["errors"]
|
||||
|
||||
|
@ -146,7 +146,7 @@ async def test_import_flow_with_valid_path(hass):
|
|||
data=DATA_TO_IMPORT,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"][CONF_DEVICE] == DATA_TO_IMPORT[CONF_DEVICE]
|
||||
|
||||
|
||||
|
@ -164,5 +164,5 @@ async def test_import_flow_with_invalid_path(hass):
|
|||
data=DATA_TO_IMPORT,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "invalid_dongle_path"
|
||||
|
|
|
@ -64,7 +64,7 @@ async def test_create_entry(hass):
|
|||
flow["flow_id"], FAKE_CONFIG
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == FAKE_CONFIG
|
||||
assert result["title"] == FAKE_TITLE
|
||||
|
||||
|
@ -89,7 +89,7 @@ async def test_create_same_entry_twice(hass):
|
|||
flow["flow_id"], FAKE_CONFIG
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -135,6 +135,6 @@ async def test_lat_lon_not_specified(hass):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=fake_config
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == FAKE_CONFIG
|
||||
assert result["title"] == FAKE_TITLE
|
||||
|
|
|
@ -56,7 +56,7 @@ async def test_duplicate_error(hass):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=conf
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ async def test_show_form(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
|
@ -55,7 +55,7 @@ async def test_abort_if_already_setup(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=MOCK_CONF
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -91,7 +91,7 @@ async def test_step_user(hass):
|
|||
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == MOCK_CONF[CONF_USERNAME]
|
||||
assert result["data"] == {
|
||||
"auth_implementation": "fireservicerota",
|
||||
|
@ -131,7 +131,7 @@ async def test_reauth(hass):
|
|||
)
|
||||
|
||||
await hass.async_block_till_done()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.fireservicerota.config_flow.FireServiceRota"
|
||||
|
@ -147,5 +147,5 @@ async def test_reauth(hass):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result2["reason"] == "reauth_successful"
|
||||
|
|
|
@ -43,7 +43,7 @@ async def test_form(hass):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "Flick Electric: test-username"
|
||||
assert result2["data"] == CONF
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
@ -65,7 +65,7 @@ async def test_form_duplicate_login(hass):
|
|||
):
|
||||
result = await _flow_submit(hass)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -77,7 +77,7 @@ async def test_form_invalid_auth(hass):
|
|||
):
|
||||
result = await _flow_submit(hass)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
|
||||
|
@ -89,7 +89,7 @@ async def test_form_cannot_connect(hass):
|
|||
):
|
||||
result = await _flow_submit(hass)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
|
@ -101,5 +101,5 @@ async def test_form_generic_exception(hass):
|
|||
):
|
||||
result = await _flow_submit(hass)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "unknown"}
|
||||
|
|
|
@ -25,7 +25,7 @@ async def test_show_form(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == config_entries.SOURCE_USER
|
||||
|
||||
|
||||
|
@ -67,7 +67,7 @@ async def test_nominal_case(hass, mock_setup):
|
|||
|
||||
assert len(mock_flipr_client.mock_calls) == 1
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "flipid"
|
||||
assert result["data"] == {
|
||||
CONF_EMAIL: "dummylogin",
|
||||
|
@ -91,7 +91,7 @@ async def test_multiple_flip_id(hass, mock_setup):
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "flipr_id"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
|
@ -101,7 +101,7 @@ async def test_multiple_flip_id(hass, mock_setup):
|
|||
|
||||
assert len(mock_flipr_client.mock_calls) == 1
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "FLIP2"
|
||||
assert result["data"] == {
|
||||
CONF_EMAIL: "dummylogin",
|
||||
|
|
|
@ -14,7 +14,7 @@ async def test_duplicate_error(hass, config, config_entry, setup_flunearyou):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=config
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -35,7 +35,7 @@ async def test_show_form(hass):
|
|||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
|
@ -44,7 +44,7 @@ async def test_step_user(hass, config, setup_flunearyou):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=config
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "51.528308, -0.3817765"
|
||||
assert result["data"] == {
|
||||
CONF_LATITUDE: 51.528308,
|
||||
|
|
|
@ -58,7 +58,7 @@ async def test_show_form(hass):
|
|||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == SOURCE_USER
|
||||
|
||||
|
||||
|
@ -78,7 +78,7 @@ async def test_config_flow(hass, config_entry):
|
|||
DOMAIN, context={"source": SOURCE_USER}, data=config_data
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "My Music on myhost"
|
||||
assert result["data"][CONF_HOST] == config_data[CONF_HOST]
|
||||
assert result["data"][CONF_PORT] == config_data[CONF_PORT]
|
||||
|
@ -91,7 +91,7 @@ async def test_config_flow(hass, config_entry):
|
|||
data=config_entry.data,
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
|
||||
|
||||
async def test_zeroconf_updates_title(hass, config_entry):
|
||||
|
@ -112,7 +112,7 @@ async def test_zeroconf_updates_title(hass, config_entry):
|
|||
DOMAIN, context={"source": SOURCE_ZEROCONF}, data=discovery_info
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert config_entry.title == "zeroconf_test"
|
||||
assert len(hass.config_entries.async_entries(DOMAIN)) == 2
|
||||
|
||||
|
@ -128,7 +128,7 @@ async def test_config_flow_no_websocket(hass, config_entry):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=config_entry.data
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
|
||||
async def test_config_flow_zeroconf_invalid(hass):
|
||||
|
@ -146,7 +146,7 @@ async def test_config_flow_zeroconf_invalid(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_ZEROCONF}, data=discovery_info
|
||||
) # doesn't create the entry, tries to show form but gets abort
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "not_forked_daapd"
|
||||
# test with forked-daapd version < 27
|
||||
discovery_info = zeroconf.ZeroconfServiceInfo(
|
||||
|
@ -161,7 +161,7 @@ async def test_config_flow_zeroconf_invalid(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_ZEROCONF}, data=discovery_info
|
||||
) # doesn't create the entry, tries to show form but gets abort
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "not_forked_daapd"
|
||||
# test with verbose mtd-version from Firefly
|
||||
discovery_info = zeroconf.ZeroconfServiceInfo(
|
||||
|
@ -176,7 +176,7 @@ async def test_config_flow_zeroconf_invalid(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_ZEROCONF}, data=discovery_info
|
||||
) # doesn't create the entry, tries to show form but gets abort
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "not_forked_daapd"
|
||||
# test with svn mtd-version from Firefly
|
||||
discovery_info = zeroconf.ZeroconfServiceInfo(
|
||||
|
@ -191,7 +191,7 @@ async def test_config_flow_zeroconf_invalid(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_ZEROCONF}, data=discovery_info
|
||||
) # doesn't create the entry, tries to show form but gets abort
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "not_forked_daapd"
|
||||
|
||||
|
||||
|
@ -213,7 +213,7 @@ async def test_config_flow_zeroconf_valid(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_ZEROCONF}, data=discovery_info
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
|
||||
async def test_options_flow(hass, config_entry):
|
||||
|
@ -229,7 +229,7 @@ async def test_options_flow(hass, config_entry):
|
|||
await hass.async_block_till_done()
|
||||
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"],
|
||||
|
@ -240,4 +240,4 @@ async def test_options_flow(hass, config_entry):
|
|||
CONF_MAX_PLAYLISTS: 8,
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
|
|
@ -80,7 +80,7 @@ async def test_user_valid(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
|
@ -98,7 +98,7 @@ async def test_user_valid(hass):
|
|||
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == CAMERA_NAME
|
||||
assert result["data"] == VALID_CONFIG
|
||||
|
||||
|
@ -111,7 +111,7 @@ async def test_user_invalid_auth(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
|
@ -129,7 +129,7 @@ async def test_user_invalid_auth(hass):
|
|||
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
|
||||
|
@ -139,7 +139,7 @@ async def test_user_cannot_connect(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
|
@ -157,7 +157,7 @@ async def test_user_cannot_connect(hass):
|
|||
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
|
@ -167,7 +167,7 @@ async def test_user_invalid_response(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
|
@ -187,7 +187,7 @@ async def test_user_invalid_response(hass):
|
|||
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "invalid_response"}
|
||||
|
||||
|
||||
|
@ -203,7 +203,7 @@ async def test_user_already_configured(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
|
@ -218,7 +218,7 @@ async def test_user_already_configured(hass):
|
|||
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -228,7 +228,7 @@ async def test_user_unknown_exception(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
|
@ -243,5 +243,5 @@ async def test_user_unknown_exception(hass):
|
|||
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "unknown"}
|
||||
|
|
|
@ -44,7 +44,7 @@ async def test_user(hass: HomeAssistant):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
# test with all provided
|
||||
|
@ -53,7 +53,7 @@ async def test_user(hass: HomeAssistant):
|
|||
context={"source": SOURCE_USER},
|
||||
data={CONF_HOST: MOCK_HOST, CONF_PORT: MOCK_PORT},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "link"
|
||||
|
||||
|
||||
|
@ -64,7 +64,7 @@ async def test_import(hass: HomeAssistant):
|
|||
context={"source": SOURCE_IMPORT},
|
||||
data={CONF_HOST: MOCK_HOST, CONF_PORT: MOCK_PORT},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "link"
|
||||
|
||||
|
||||
|
@ -75,7 +75,7 @@ async def test_zeroconf(hass: HomeAssistant):
|
|||
context={"source": SOURCE_ZEROCONF},
|
||||
data=MOCK_ZEROCONF_DATA,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "link"
|
||||
|
||||
|
||||
|
@ -94,7 +94,7 @@ async def test_link(hass: HomeAssistant, router: Mock):
|
|||
)
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["result"].unique_id == MOCK_HOST
|
||||
assert result["title"] == MOCK_HOST
|
||||
assert result["data"][CONF_HOST] == MOCK_HOST
|
||||
|
@ -118,7 +118,7 @@ async def test_abort_if_already_setup(hass: HomeAssistant):
|
|||
context={"source": SOURCE_IMPORT},
|
||||
data={CONF_HOST: MOCK_HOST, CONF_PORT: MOCK_PORT},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
# Should fail, same MOCK_HOST (flow)
|
||||
|
@ -127,7 +127,7 @@ async def test_abort_if_already_setup(hass: HomeAssistant):
|
|||
context={"source": SOURCE_USER},
|
||||
data={CONF_HOST: MOCK_HOST, CONF_PORT: MOCK_PORT},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -144,7 +144,7 @@ async def test_on_link_failed(hass: HomeAssistant):
|
|||
side_effect=AuthorizationError(),
|
||||
):
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "register_failed"}
|
||||
|
||||
with patch(
|
||||
|
@ -152,7 +152,7 @@ async def test_on_link_failed(hass: HomeAssistant):
|
|||
side_effect=HttpRequestError(),
|
||||
):
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
with patch(
|
||||
|
@ -160,5 +160,5 @@ async def test_on_link_failed(hass: HomeAssistant):
|
|||
side_effect=InvalidTokenError(),
|
||||
):
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "unknown"}
|
||||
|
|
|
@ -19,7 +19,7 @@ async def test_show_form(hass):
|
|||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == SOURCE_USER
|
||||
|
||||
|
||||
|
@ -77,6 +77,6 @@ async def test_create_entry(hass):
|
|||
data=VALID_CONFIG,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "Freedompro"
|
||||
assert result["data"][CONF_API_KEY] == "ksdjfgslkjdfksjdfksjgfksjd"
|
||||
|
|
|
@ -29,7 +29,7 @@ async def test_duplicate_error(hass, config_entry):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=conf
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -38,7 +38,7 @@ async def test_show_form(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
|
@ -55,7 +55,7 @@ async def test_step_import(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, data=conf
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "-41.2, 174.7"
|
||||
assert result["data"] == {
|
||||
CONF_LATITUDE: -41.2,
|
||||
|
@ -75,7 +75,7 @@ async def test_step_user(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=conf
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "-41.2, 174.7"
|
||||
assert result["data"] == {
|
||||
CONF_LATITUDE: -41.2,
|
||||
|
|
|
@ -68,7 +68,7 @@ async def test_form(hass, fakeimg_png, user_flow, mock_create_stream):
|
|||
user_flow["flow_id"],
|
||||
TESTDATA,
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "127_0_0_1"
|
||||
assert result2["options"] == {
|
||||
CONF_STILL_IMAGE_URL: "http://127.0.0.1/testurl/1",
|
||||
|
@ -104,7 +104,7 @@ async def test_form_only_stillimage(hass, fakeimg_png, user_flow):
|
|||
data,
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "127_0_0_1"
|
||||
assert result2["options"] == {
|
||||
CONF_STILL_IMAGE_URL: "http://127.0.0.1/testurl/1",
|
||||
|
@ -131,7 +131,7 @@ async def test_form_only_stillimage_gif(hass, fakeimg_gif, user_flow):
|
|||
data,
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result2["options"][CONF_CONTENT_TYPE] == "image/gif"
|
||||
|
||||
|
||||
|
@ -148,7 +148,7 @@ async def test_form_only_svg_whitespace(hass, fakeimgbytes_svg, user_flow):
|
|||
data,
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
|
||||
@respx.mock
|
||||
|
@ -175,7 +175,7 @@ async def test_form_only_still_sample(hass, user_flow, image_file):
|
|||
data,
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
|
||||
@respx.mock
|
||||
|
@ -186,31 +186,31 @@ async def test_form_only_still_sample(hass, user_flow, image_file):
|
|||
(
|
||||
"http://localhost:812{{3}}/static/icons/favicon-apple-180x180.png",
|
||||
"http://localhost:8123/static/icons/favicon-apple-180x180.png",
|
||||
data_entry_flow.RESULT_TYPE_CREATE_ENTRY,
|
||||
data_entry_flow.FlowResultType.CREATE_ENTRY,
|
||||
None,
|
||||
),
|
||||
(
|
||||
"{% if 1 %}https://bla{% else %}https://yo{% endif %}",
|
||||
"https://bla/",
|
||||
data_entry_flow.RESULT_TYPE_CREATE_ENTRY,
|
||||
data_entry_flow.FlowResultType.CREATE_ENTRY,
|
||||
None,
|
||||
),
|
||||
(
|
||||
"http://{{example.org",
|
||||
"http://example.org",
|
||||
data_entry_flow.RESULT_TYPE_FORM,
|
||||
data_entry_flow.FlowResultType.FORM,
|
||||
{"still_image_url": "template_error"},
|
||||
),
|
||||
(
|
||||
"invalid1://invalid:4\\1",
|
||||
"invalid1://invalid:4%5c1",
|
||||
data_entry_flow.RESULT_TYPE_FORM,
|
||||
data_entry_flow.FlowResultType.FORM,
|
||||
{"still_image_url": "malformed_url"},
|
||||
),
|
||||
(
|
||||
"relative/urls/are/not/allowed.jpg",
|
||||
"relative/urls/are/not/allowed.jpg",
|
||||
data_entry_flow.RESULT_TYPE_FORM,
|
||||
data_entry_flow.FlowResultType.FORM,
|
||||
{"still_image_url": "relative_url"},
|
||||
),
|
||||
],
|
||||
|
@ -246,7 +246,7 @@ async def test_form_rtsp_mode(hass, fakeimg_png, user_flow, mock_create_stream):
|
|||
user_flow["flow_id"], data
|
||||
)
|
||||
assert "errors" not in result2, f"errors={result2['errors']}"
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "127_0_0_1"
|
||||
assert result2["options"] == {
|
||||
CONF_STILL_IMAGE_URL: "http://127.0.0.1/testurl/1",
|
||||
|
@ -280,7 +280,7 @@ async def test_form_only_stream(hass, fakeimgbytes_jpg, mock_create_stream):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result3["title"] == "127_0_0_1"
|
||||
assert result3["options"] == {
|
||||
CONF_AUTHENTICATION: HTTP_BASIC_AUTHENTICATION,
|
||||
|
@ -314,7 +314,7 @@ async def test_form_still_and_stream_not_provided(hass, user_flow):
|
|||
CONF_VERIFY_SSL: False,
|
||||
},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "no_still_image_or_stream_url"}
|
||||
|
||||
|
||||
|
@ -492,7 +492,7 @@ async def test_options_template_error(hass, fakeimgbytes_png, mock_create_stream
|
|||
await hass.async_block_till_done()
|
||||
|
||||
result = await hass.config_entries.options.async_init(mock_entry.entry_id)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
# try updating the still image url
|
||||
|
@ -503,10 +503,10 @@ async def test_options_template_error(hass, fakeimgbytes_png, mock_create_stream
|
|||
result["flow_id"],
|
||||
user_input=data,
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
result3 = await hass.config_entries.options.async_init(mock_entry.entry_id)
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result3["step_id"] == "init"
|
||||
|
||||
# verify that an invalid template reports the correct UI error.
|
||||
|
@ -515,7 +515,7 @@ async def test_options_template_error(hass, fakeimgbytes_png, mock_create_stream
|
|||
result3["flow_id"],
|
||||
user_input=data,
|
||||
)
|
||||
assert result4.get("type") == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result4.get("type") == data_entry_flow.FlowResultType.FORM
|
||||
assert result4["errors"] == {"still_image_url": "template_error"}
|
||||
|
||||
# verify that an invalid template reports the correct UI error.
|
||||
|
@ -526,7 +526,7 @@ async def test_options_template_error(hass, fakeimgbytes_png, mock_create_stream
|
|||
user_input=data,
|
||||
)
|
||||
|
||||
assert result5.get("type") == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result5.get("type") == data_entry_flow.FlowResultType.FORM
|
||||
assert result5["errors"] == {"stream_source": "template_error"}
|
||||
|
||||
# verify that an relative stream url is rejected.
|
||||
|
@ -536,7 +536,7 @@ async def test_options_template_error(hass, fakeimgbytes_png, mock_create_stream
|
|||
result5["flow_id"],
|
||||
user_input=data,
|
||||
)
|
||||
assert result6.get("type") == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result6.get("type") == data_entry_flow.FlowResultType.FORM
|
||||
assert result6["errors"] == {"stream_source": "relative_url"}
|
||||
|
||||
# verify that an malformed stream url is rejected.
|
||||
|
@ -546,7 +546,7 @@ async def test_options_template_error(hass, fakeimgbytes_png, mock_create_stream
|
|||
result6["flow_id"],
|
||||
user_input=data,
|
||||
)
|
||||
assert result7.get("type") == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result7.get("type") == data_entry_flow.FlowResultType.FORM
|
||||
assert result7["errors"] == {"stream_source": "malformed_url"}
|
||||
|
||||
|
||||
|
@ -583,7 +583,7 @@ async def test_options_only_stream(hass, fakeimgbytes_png, mock_create_stream):
|
|||
await hass.async_block_till_done()
|
||||
|
||||
result = await hass.config_entries.options.async_init(mock_entry.entry_id)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
# try updating the config options
|
||||
|
@ -592,7 +592,7 @@ async def test_options_only_stream(hass, fakeimgbytes_png, mock_create_stream):
|
|||
result["flow_id"],
|
||||
user_input=data,
|
||||
)
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result3["data"][CONF_CONTENT_TYPE] == "image/jpeg"
|
||||
|
||||
|
||||
|
@ -607,12 +607,12 @@ async def test_import(hass, fakeimg_png):
|
|||
result2 = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, data=TESTDATA_YAML
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "Yaml Defined Name"
|
||||
await hass.async_block_till_done()
|
||||
# Any name defined in yaml should end up as the entity id.
|
||||
assert hass.states.get("camera.yaml_defined_name")
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
|
||||
|
||||
# These above can be deleted after deprecation period is finished.
|
||||
|
@ -707,7 +707,7 @@ async def test_use_wallclock_as_timestamps_option(
|
|||
result = await hass.config_entries.options.async_init(
|
||||
mock_entry.entry_id, context={"show_advanced_options": True}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
with patch(
|
||||
"homeassistant.components.generic.async_setup_entry", return_value=True
|
||||
|
@ -716,4 +716,4 @@ async def test_use_wallclock_as_timestamps_option(
|
|||
result["flow_id"],
|
||||
user_input={CONF_USE_WALLCLOCK_AS_TIMESTAMPS: True, **TESTDATA},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
|
|
@ -157,10 +157,10 @@ async def webhook_id(hass, geofency_client):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM, result
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM, result
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
await hass.async_block_till_done()
|
||||
return result["result"].data["webhook_id"]
|
||||
|
|
|
@ -25,7 +25,7 @@ async def test_duplicate_error(hass, config_entry):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=conf
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -34,7 +34,7 @@ async def test_show_form(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
|
@ -56,7 +56,7 @@ async def test_step_import(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, data=conf
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "-41.2, 174.7"
|
||||
assert result["data"] == {
|
||||
CONF_LATITUDE: -41.2,
|
||||
|
@ -81,7 +81,7 @@ async def test_step_user(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=conf
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "-41.2, 174.7"
|
||||
assert result["data"] == {
|
||||
CONF_LATITUDE: -41.2,
|
||||
|
|
|
@ -32,7 +32,7 @@ async def test_show_form(hass):
|
|||
|
||||
result = await flow.async_step_user(user_input=None)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
|
@ -55,7 +55,7 @@ async def test_step_import(hass):
|
|||
"homeassistant.components.geonetnz_volcano.async_setup", return_value=True
|
||||
):
|
||||
result = await flow.async_step_import(import_config=conf)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "-41.2, 174.7"
|
||||
assert result["data"] == {
|
||||
CONF_LATITUDE: -41.2,
|
||||
|
@ -81,7 +81,7 @@ async def test_step_user(hass):
|
|||
"homeassistant.components.geonetnz_volcano.async_setup", return_value=True
|
||||
):
|
||||
result = await flow.async_step_user(user_input=conf)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "-41.2, 174.7"
|
||||
assert result["data"] == {
|
||||
CONF_LATITUDE: -41.2,
|
||||
|
|
|
@ -25,7 +25,7 @@ async def test_show_form(hass):
|
|||
|
||||
result = await flow.async_step_user(user_input=None)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
|
@ -98,7 +98,7 @@ async def test_create_entry(hass):
|
|||
|
||||
result = await flow.async_step_user(user_input=CONFIG)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "Test Name 1"
|
||||
assert result["data"][CONF_STATION_ID] == CONFIG[CONF_STATION_ID]
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ async def test_form(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
glances.DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
with patch("homeassistant.components.glances.Glances.get_data", autospec=True):
|
||||
|
@ -109,14 +109,14 @@ async def test_options(hass):
|
|||
|
||||
result = await hass.config_entries.options.async_init(entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"], user_input={glances.CONF_SCAN_INTERVAL: 10}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == {
|
||||
glances.CONF_SCAN_INTERVAL: 10,
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ async def test_flow_user(hass: HomeAssistant):
|
|||
result["flow_id"],
|
||||
user_input=CONF_DATA,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == DEFAULT_NAME
|
||||
assert result["data"] == CONF_DATA
|
||||
assert result["result"].unique_id == MAC
|
||||
|
@ -47,7 +47,7 @@ async def test_flow_user_already_configured(hass: HomeAssistant):
|
|||
DOMAIN, context={"source": SOURCE_USER}, data=CONF_DATA
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -58,7 +58,7 @@ async def test_flow_user_cannot_connect(hass: HomeAssistant):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=CONF_DATA
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"]["base"] == "cannot_connect"
|
||||
|
||||
|
@ -70,7 +70,7 @@ async def test_flow_user_invalid_host(hass: HomeAssistant):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=CONF_DATA
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"]["base"] == "invalid_host"
|
||||
|
||||
|
@ -82,7 +82,7 @@ async def test_flow_user_unknown_error(hass: HomeAssistant):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=CONF_DATA
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"]["base"] == "unknown"
|
||||
|
||||
|
@ -97,14 +97,14 @@ async def test_dhcp_discovery(hass: HomeAssistant):
|
|||
context={"source": SOURCE_DHCP},
|
||||
data=CONF_DHCP_FLOW,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
{},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == MANUFACTURER
|
||||
assert result["data"] == CONF_DATA
|
||||
assert result["result"].unique_id == MAC
|
||||
|
@ -114,7 +114,7 @@ async def test_dhcp_discovery(hass: HomeAssistant):
|
|||
context={"source": SOURCE_DHCP},
|
||||
data=CONF_DHCP_FLOW,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -128,7 +128,7 @@ async def test_dhcp_discovery_failed(hass: HomeAssistant):
|
|||
context={"source": SOURCE_DHCP},
|
||||
data=CONF_DHCP_FLOW,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "cannot_connect"
|
||||
|
||||
with patch_config_flow_yeti(mocked_yeti) as yetimock:
|
||||
|
@ -138,7 +138,7 @@ async def test_dhcp_discovery_failed(hass: HomeAssistant):
|
|||
context={"source": SOURCE_DHCP},
|
||||
data=CONF_DHCP_FLOW,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "invalid_host"
|
||||
|
||||
with patch_config_flow_yeti(mocked_yeti) as yetimock:
|
||||
|
@ -148,5 +148,5 @@ async def test_dhcp_discovery_failed(hass: HomeAssistant):
|
|||
context={"source": SOURCE_DHCP},
|
||||
data=CONF_DHCP_FLOW,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "unknown"
|
||||
|
|
|
@ -36,7 +36,7 @@ async def test_minimum_fields(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
|
@ -44,7 +44,7 @@ async def test_minimum_fields(hass):
|
|||
MOCK_CONFIG,
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == DEFAULT_NAME
|
||||
assert result2["data"] == {
|
||||
CONF_NAME: DEFAULT_NAME,
|
||||
|
@ -60,14 +60,14 @@ async def test_invalid_config_entry(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
MOCK_CONFIG,
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
|
@ -91,7 +91,7 @@ async def test_options_flow(hass, mock_config):
|
|||
mock_config.entry_id, data=None
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -108,7 +108,7 @@ async def test_options_flow(hass, mock_config):
|
|||
CONF_TRANSIT_ROUTING_PREFERENCE: "less_walking",
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == ""
|
||||
assert result["data"] == {
|
||||
CONF_MODE: "driving",
|
||||
|
@ -144,7 +144,7 @@ async def test_options_flow_departure_time(hass, mock_config):
|
|||
mock_config.entry_id, data=None
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -161,7 +161,7 @@ async def test_options_flow_departure_time(hass, mock_config):
|
|||
CONF_TRANSIT_ROUTING_PREFERENCE: "less_walking",
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == ""
|
||||
assert result["data"] == {
|
||||
CONF_MODE: "driving",
|
||||
|
@ -192,7 +192,7 @@ async def test_dupe(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
|
@ -204,13 +204,13 @@ async def test_dupe(hass):
|
|||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
|
@ -223,4 +223,4 @@ async def test_dupe(hass):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
|
|
@ -65,10 +65,10 @@ async def webhook_id(hass, gpslogger_client):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM, result
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM, result
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
await hass.async_block_till_done()
|
||||
return result["result"].data["webhook_id"]
|
||||
|
|
|
@ -23,10 +23,10 @@ async def test_creating_entry_sets_up_climate(hass):
|
|||
)
|
||||
|
||||
# Confirmation form
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
@ -52,10 +52,10 @@ async def test_creating_entry_has_no_devices(hass):
|
|||
)
|
||||
|
||||
# Confirmation form
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ async def test_show_authenticate_form(hass):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
|
@ -68,7 +68,7 @@ async def test_incorrect_login(hass):
|
|||
result["flow_id"], FIXTURE_USER_INPUT
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
|
@ -110,7 +110,7 @@ async def test_multiple_plant_ids(hass):
|
|||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "plant"
|
||||
|
||||
user_input = {CONF_PLANT_ID: "123456"}
|
||||
|
@ -119,7 +119,7 @@ async def test_multiple_plant_ids(hass):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"][CONF_USERNAME] == FIXTURE_USER_INPUT[CONF_USERNAME]
|
||||
assert result["data"][CONF_PASSWORD] == FIXTURE_USER_INPUT[CONF_PASSWORD]
|
||||
assert result["data"][CONF_PLANT_ID] == "123456"
|
||||
|
@ -144,7 +144,7 @@ async def test_one_plant_on_account(hass):
|
|||
result["flow_id"], user_input
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"][CONF_USERNAME] == FIXTURE_USER_INPUT[CONF_USERNAME]
|
||||
assert result["data"][CONF_PASSWORD] == FIXTURE_USER_INPUT[CONF_PASSWORD]
|
||||
assert result["data"][CONF_PLANT_ID] == "123456"
|
||||
|
|
|
@ -21,7 +21,7 @@ async def test_duplicate_error(hass, config, config_entry, setup_guardian):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=config
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -34,7 +34,7 @@ async def test_connect_error(hass, config):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=config
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {CONF_IP_ADDRESS: "cannot_connect"}
|
||||
|
||||
|
||||
|
@ -55,13 +55,13 @@ async def test_step_user(hass, config, setup_guardian):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=config
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "ABCDEF123456"
|
||||
assert result["data"] == {
|
||||
CONF_IP_ADDRESS: "192.168.1.100",
|
||||
|
@ -85,13 +85,13 @@ async def test_step_zeroconf(hass, setup_guardian):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_ZEROCONF}, data=zeroconf_data
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "discovery_confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "ABCDEF123456"
|
||||
assert result["data"] == {
|
||||
CONF_IP_ADDRESS: "192.168.1.100",
|
||||
|
@ -115,7 +115,7 @@ async def test_step_zeroconf_already_in_progress(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_ZEROCONF}, data=zeroconf_data
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "discovery_confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
|
@ -136,13 +136,13 @@ async def test_step_dhcp(hass, setup_guardian):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_DHCP}, data=dhcp_data
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "discovery_confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "ABCDEF123456"
|
||||
assert result["data"] == {
|
||||
CONF_IP_ADDRESS: "192.168.1.100",
|
||||
|
@ -162,7 +162,7 @@ async def test_step_dhcp_already_in_progress(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_DHCP}, data=dhcp_data
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "discovery_confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
|
@ -188,7 +188,7 @@ async def test_step_dhcp_already_setup_match_mac(hass):
|
|||
macaddress="aa:bb:cc:dd:ab:cd",
|
||||
),
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -210,5 +210,5 @@ async def test_step_dhcp_already_setup_match_ip(hass):
|
|||
macaddress="aa:bb:cc:dd:ab:cd",
|
||||
),
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
|
|
@ -20,7 +20,7 @@ async def test_flow_works(hass, aioclient_mock):
|
|||
result = await flow.async_step_user(
|
||||
{CONF_EMAIL: EMAIL, CONF_PASSWORD: PASSWORD}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == EMAIL
|
||||
|
||||
|
||||
|
@ -38,7 +38,7 @@ async def test_flow_works_with_authcode(hass, aioclient_mock):
|
|||
"authorization_code": "c29tZXJhbmRvbXN0cmluZw==",
|
||||
}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == EMAIL
|
||||
|
||||
|
||||
|
@ -57,12 +57,12 @@ async def test_flow_works_with_2fa(hass, aioclient_mock):
|
|||
result = await flow.async_step_user(
|
||||
{CONF_EMAIL: EMAIL, CONF_PASSWORD: PASSWORD}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "2fa"
|
||||
|
||||
with patch("homeassistant.components.hangouts.config_flow.get_auth"):
|
||||
result = await flow.async_step_2fa({"2fa": 123456})
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == EMAIL
|
||||
|
||||
|
||||
|
@ -81,7 +81,7 @@ async def test_flow_with_unknown_2fa(hass, aioclient_mock):
|
|||
result = await flow.async_step_user(
|
||||
{CONF_EMAIL: EMAIL, CONF_PASSWORD: PASSWORD}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"]["base"] == "invalid_2fa_method"
|
||||
|
||||
|
||||
|
@ -100,7 +100,7 @@ async def test_flow_invalid_login(hass, aioclient_mock):
|
|||
result = await flow.async_step_user(
|
||||
{CONF_EMAIL: EMAIL, CONF_PASSWORD: PASSWORD}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"]["base"] == "invalid_login"
|
||||
|
||||
|
||||
|
@ -119,7 +119,7 @@ async def test_flow_invalid_2fa(hass, aioclient_mock):
|
|||
result = await flow.async_step_user(
|
||||
{CONF_EMAIL: EMAIL, CONF_PASSWORD: PASSWORD}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "2fa"
|
||||
|
||||
with patch(
|
||||
|
@ -128,5 +128,5 @@ async def test_flow_invalid_2fa(hass, aioclient_mock):
|
|||
):
|
||||
result = await flow.async_step_2fa({"2fa": 123456})
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"]["base"] == "invalid_2fa"
|
||||
|
|
|
@ -201,7 +201,7 @@ async def test_options_flow(hass, mock_hc, mock_write_config):
|
|||
assert await hass.config_entries.async_unload(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -209,7 +209,7 @@ async def test_options_flow(hass, mock_hc, mock_write_config):
|
|||
user_input={"activity": PREVIOUS_ACTIVE_ACTIVITY, "delay_secs": 0.4},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
"activity": PREVIOUS_ACTIVE_ACTIVITY,
|
||||
"delay_secs": 0.4,
|
||||
|
|
|
@ -18,7 +18,7 @@ async def test_flow_aborts_already_setup(hass, config_entry):
|
|||
flow = HeosFlowHandler()
|
||||
flow.hass = hass
|
||||
result = await flow.async_step_user()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "single_instance_allowed"
|
||||
|
||||
|
||||
|
@ -27,7 +27,7 @@ async def test_no_host_shows_form(hass):
|
|||
flow = HeosFlowHandler()
|
||||
flow.hass = hass
|
||||
result = await flow.async_step_user()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {}
|
||||
|
||||
|
@ -38,7 +38,7 @@ async def test_cannot_connect_shows_error_form(hass, controller):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
heos.DOMAIN, context={"source": SOURCE_USER}, data={CONF_HOST: "127.0.0.1"}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"][CONF_HOST] == "cannot_connect"
|
||||
assert controller.connect.call_count == 1
|
||||
|
@ -54,7 +54,7 @@ async def test_create_entry_when_host_valid(hass, controller):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
heos.DOMAIN, context={"source": SOURCE_USER}, data=data
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["result"].unique_id == DOMAIN
|
||||
assert result["title"] == "Controller (127.0.0.1)"
|
||||
assert result["data"] == data
|
||||
|
@ -70,7 +70,7 @@ async def test_create_entry_when_friendly_name_valid(hass, controller):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
heos.DOMAIN, context={"source": SOURCE_USER}, data=data
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["result"].unique_id == DOMAIN
|
||||
assert result["title"] == "Controller (127.0.0.1)"
|
||||
assert result["data"] == {CONF_HOST: "127.0.0.1"}
|
||||
|
@ -118,7 +118,7 @@ async def test_discovery_flow_aborts_already_setup(
|
|||
flow = HeosFlowHandler()
|
||||
flow.hass = hass
|
||||
result = await flow.async_step_ssdp(discovery_data)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "single_instance_allowed"
|
||||
|
||||
|
||||
|
@ -151,5 +151,5 @@ async def test_import_sets_the_unique_id(hass, controller):
|
|||
data={CONF_HOST: "127.0.0.2"},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["result"].unique_id == DOMAIN
|
||||
|
|
|
@ -141,7 +141,7 @@ async def test_step_user(hass: HomeAssistant, menu_options) -> None:
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
|
@ -166,7 +166,7 @@ async def test_step_origin_coordinates(
|
|||
menu_result = await hass.config_entries.flow.async_configure(
|
||||
user_step_result["flow_id"], {"next_step_id": "origin_coordinates"}
|
||||
)
|
||||
assert menu_result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert menu_result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
location_selector_result = await hass.config_entries.flow.async_configure(
|
||||
menu_result["flow_id"],
|
||||
|
@ -189,7 +189,7 @@ async def test_step_origin_entity(
|
|||
menu_result = await hass.config_entries.flow.async_configure(
|
||||
user_step_result["flow_id"], {"next_step_id": "origin_entity"}
|
||||
)
|
||||
assert menu_result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert menu_result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
entity_selector_result = await hass.config_entries.flow.async_configure(
|
||||
menu_result["flow_id"],
|
||||
|
@ -206,7 +206,7 @@ async def test_step_destination_coordinates(
|
|||
menu_result = await hass.config_entries.flow.async_configure(
|
||||
origin_step_result["flow_id"], {"next_step_id": "destination_coordinates"}
|
||||
)
|
||||
assert menu_result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert menu_result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
location_selector_result = await hass.config_entries.flow.async_configure(
|
||||
menu_result["flow_id"],
|
||||
|
@ -218,7 +218,9 @@ async def test_step_destination_coordinates(
|
|||
}
|
||||
},
|
||||
)
|
||||
assert location_selector_result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert (
|
||||
location_selector_result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
)
|
||||
entry = hass.config_entries.async_entries(DOMAIN)[0]
|
||||
assert entry.data == {
|
||||
CONF_NAME: "test",
|
||||
|
@ -239,13 +241,13 @@ async def test_step_destination_entity(
|
|||
menu_result = await hass.config_entries.flow.async_configure(
|
||||
origin_step_result["flow_id"], {"next_step_id": "destination_entity"}
|
||||
)
|
||||
assert menu_result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert menu_result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
entity_selector_result = await hass.config_entries.flow.async_configure(
|
||||
menu_result["flow_id"],
|
||||
{"destination_entity_id": "zone.home"},
|
||||
)
|
||||
assert entity_selector_result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert entity_selector_result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
entry = hass.config_entries.async_entries(DOMAIN)[0]
|
||||
assert entry.data == {
|
||||
CONF_NAME: "test",
|
||||
|
@ -327,7 +329,7 @@ async def test_options_flow(hass: HomeAssistant) -> None:
|
|||
|
||||
result = await hass.config_entries.options.async_init(entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -350,7 +352,7 @@ async def test_options_flow_arrival_time_step(
|
|||
menu_result = await hass.config_entries.options.async_configure(
|
||||
option_init_result["flow_id"], {"next_step_id": "arrival_time"}
|
||||
)
|
||||
assert menu_result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert menu_result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
time_selector_result = await hass.config_entries.options.async_configure(
|
||||
option_init_result["flow_id"],
|
||||
user_input={
|
||||
|
@ -358,7 +360,7 @@ async def test_options_flow_arrival_time_step(
|
|||
},
|
||||
)
|
||||
|
||||
assert time_selector_result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert time_selector_result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
entry = hass.config_entries.async_entries(DOMAIN)[0]
|
||||
assert entry.options == {
|
||||
CONF_UNIT_SYSTEM: CONF_UNIT_SYSTEM_METRIC,
|
||||
|
@ -376,7 +378,7 @@ async def test_options_flow_departure_time_step(
|
|||
menu_result = await hass.config_entries.options.async_configure(
|
||||
option_init_result["flow_id"], {"next_step_id": "departure_time"}
|
||||
)
|
||||
assert menu_result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert menu_result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
time_selector_result = await hass.config_entries.options.async_configure(
|
||||
option_init_result["flow_id"],
|
||||
user_input={
|
||||
|
@ -384,7 +386,7 @@ async def test_options_flow_departure_time_step(
|
|||
},
|
||||
)
|
||||
|
||||
assert time_selector_result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert time_selector_result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
entry = hass.config_entries.async_entries(DOMAIN)[0]
|
||||
assert entry.options == {
|
||||
CONF_UNIT_SYSTEM: CONF_UNIT_SYSTEM_METRIC,
|
||||
|
@ -403,7 +405,7 @@ async def test_options_flow_no_time_step(
|
|||
option_init_result["flow_id"], {"next_step_id": "no_time"}
|
||||
)
|
||||
|
||||
assert menu_result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert menu_result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
entry = hass.config_entries.async_entries(DOMAIN)[0]
|
||||
assert entry.options == {
|
||||
CONF_UNIT_SYSTEM: CONF_UNIT_SYSTEM_METRIC,
|
||||
|
@ -434,7 +436,7 @@ async def test_import_flow_entity_id(hass: HomeAssistant) -> None:
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "namespace test_name"
|
||||
|
||||
entry = hass.config_entries.async_entries(DOMAIN)[0]
|
||||
|
@ -476,7 +478,7 @@ async def test_import_flow_coordinates(hass: HomeAssistant) -> None:
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "test_name"
|
||||
|
||||
entry = hass.config_entries.async_entries(DOMAIN)[0]
|
||||
|
@ -519,7 +521,7 @@ async def test_dupe_import(hass: HomeAssistant) -> None:
|
|||
CONF_TRAFFIC_MODE: TRAFFIC_MODE_ENABLED,
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
await hass.async_block_till_done()
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
|
@ -539,7 +541,7 @@ async def test_dupe_import(hass: HomeAssistant) -> None:
|
|||
CONF_TRAFFIC_MODE: TRAFFIC_MODE_ENABLED,
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
await hass.async_block_till_done()
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
|
@ -559,7 +561,7 @@ async def test_dupe_import(hass: HomeAssistant) -> None:
|
|||
CONF_TRAFFIC_MODE: TRAFFIC_MODE_ENABLED,
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
await hass.async_block_till_done()
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
|
@ -579,7 +581,7 @@ async def test_dupe_import(hass: HomeAssistant) -> None:
|
|||
CONF_TRAFFIC_MODE: TRAFFIC_MODE_ENABLED,
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
await hass.async_block_till_done()
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
|
@ -599,5 +601,5 @@ async def test_dupe_import(hass: HomeAssistant) -> None:
|
|||
CONF_TRAFFIC_MODE: TRAFFIC_MODE_ENABLED,
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
|
|
@ -22,10 +22,10 @@ async def test_creating_entry_sets_up_climate_discovery(hass):
|
|||
)
|
||||
|
||||
# Confirmation form
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ async def test_import_flow(hass):
|
|||
data={CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == USERNAME
|
||||
assert result["data"] == {
|
||||
CONF_USERNAME: USERNAME,
|
||||
|
@ -70,7 +70,7 @@ async def test_user_flow(hass):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
|
@ -94,7 +94,7 @@ async def test_user_flow(hass):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == USERNAME
|
||||
assert result2["data"] == {
|
||||
CONF_USERNAME: USERNAME,
|
||||
|
@ -119,7 +119,7 @@ async def test_user_flow_2fa(hass):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
|
@ -136,7 +136,7 @@ async def test_user_flow_2fa(hass):
|
|||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == CONF_CODE
|
||||
assert result2["errors"] == {}
|
||||
|
||||
|
@ -157,7 +157,7 @@ async def test_user_flow_2fa(hass):
|
|||
},
|
||||
)
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result3["step_id"] == "configuration"
|
||||
assert result3["errors"] == {}
|
||||
|
||||
|
@ -185,7 +185,7 @@ async def test_user_flow_2fa(hass):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result4["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result4["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result4["title"] == USERNAME
|
||||
assert result4["data"] == {
|
||||
CONF_USERNAME: USERNAME,
|
||||
|
@ -239,7 +239,7 @@ async def test_reauth_flow(hass):
|
|||
data=mock_config.data,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "invalid_password"}
|
||||
|
||||
with patch(
|
||||
|
@ -263,7 +263,7 @@ async def test_reauth_flow(hass):
|
|||
|
||||
assert mock_config.data.get("username") == USERNAME
|
||||
assert mock_config.data.get("password") == UPDATED_PASSWORD
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result2["reason"] == "reauth_successful"
|
||||
assert len(hass.config_entries.async_entries(DOMAIN)) == 1
|
||||
|
||||
|
@ -298,7 +298,7 @@ async def test_reauth_2fa_flow(hass):
|
|||
data=mock_config.data,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "invalid_password"}
|
||||
|
||||
with patch(
|
||||
|
@ -338,7 +338,7 @@ async def test_reauth_2fa_flow(hass):
|
|||
|
||||
assert mock_config.data.get("username") == USERNAME
|
||||
assert mock_config.data.get("password") == UPDATED_PASSWORD
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result3["reason"] == "reauth_successful"
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
assert len(hass.config_entries.async_entries(DOMAIN)) == 1
|
||||
|
@ -370,14 +370,14 @@ async def test_option_flow(hass):
|
|||
data=None,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"], user_input={CONF_SCAN_INTERVAL: UPDATED_SCAN_INTERVAL}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"][CONF_SCAN_INTERVAL] == UPDATED_SCAN_INTERVAL
|
||||
|
||||
|
||||
|
@ -387,7 +387,7 @@ async def test_user_flow_2fa_send_new_code(hass):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
|
@ -404,7 +404,7 @@ async def test_user_flow_2fa_send_new_code(hass):
|
|||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == CONF_CODE
|
||||
assert result2["errors"] == {}
|
||||
|
||||
|
@ -419,7 +419,7 @@ async def test_user_flow_2fa_send_new_code(hass):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result3["step_id"] == CONF_CODE
|
||||
assert result3["errors"] == {}
|
||||
|
||||
|
@ -440,7 +440,7 @@ async def test_user_flow_2fa_send_new_code(hass):
|
|||
},
|
||||
)
|
||||
|
||||
assert result4["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result4["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result4["step_id"] == "configuration"
|
||||
assert result4["errors"] == {}
|
||||
|
||||
|
@ -465,7 +465,7 @@ async def test_user_flow_2fa_send_new_code(hass):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result5["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result5["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result5["title"] == USERNAME
|
||||
assert result5["data"] == {
|
||||
CONF_USERNAME: USERNAME,
|
||||
|
@ -507,7 +507,7 @@ async def test_abort_if_existing_entry(hass):
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -517,7 +517,7 @@ async def test_user_flow_invalid_username(hass):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
|
@ -529,7 +529,7 @@ async def test_user_flow_invalid_username(hass):
|
|||
{CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD},
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "user"
|
||||
assert result2["errors"] == {"base": "invalid_username"}
|
||||
|
||||
|
@ -540,7 +540,7 @@ async def test_user_flow_invalid_password(hass):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
|
@ -552,7 +552,7 @@ async def test_user_flow_invalid_password(hass):
|
|||
{CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD},
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "user"
|
||||
assert result2["errors"] == {"base": "invalid_password"}
|
||||
|
||||
|
@ -564,7 +564,7 @@ async def test_user_flow_no_internet_connection(hass):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
|
@ -576,7 +576,7 @@ async def test_user_flow_no_internet_connection(hass):
|
|||
{CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD},
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "user"
|
||||
assert result2["errors"] == {"base": "no_internet_available"}
|
||||
|
||||
|
@ -588,7 +588,7 @@ async def test_user_flow_2fa_no_internet_connection(hass):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
|
@ -602,7 +602,7 @@ async def test_user_flow_2fa_no_internet_connection(hass):
|
|||
{CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD},
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == CONF_CODE
|
||||
assert result2["errors"] == {}
|
||||
|
||||
|
@ -615,7 +615,7 @@ async def test_user_flow_2fa_no_internet_connection(hass):
|
|||
{CONF_CODE: MFA_CODE},
|
||||
)
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result3["step_id"] == CONF_CODE
|
||||
assert result3["errors"] == {"base": "no_internet_available"}
|
||||
|
||||
|
@ -626,7 +626,7 @@ async def test_user_flow_2fa_invalid_code(hass):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
|
@ -640,7 +640,7 @@ async def test_user_flow_2fa_invalid_code(hass):
|
|||
{CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD},
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == CONF_CODE
|
||||
assert result2["errors"] == {}
|
||||
|
||||
|
@ -652,7 +652,7 @@ async def test_user_flow_2fa_invalid_code(hass):
|
|||
result["flow_id"],
|
||||
{CONF_CODE: MFA_INVALID_CODE},
|
||||
)
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result3["step_id"] == CONF_CODE
|
||||
assert result3["errors"] == {"base": "invalid_code"}
|
||||
|
||||
|
@ -663,7 +663,7 @@ async def test_user_flow_unknown_error(hass):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
|
@ -676,7 +676,7 @@ async def test_user_flow_unknown_error(hass):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "unknown"}
|
||||
|
||||
|
||||
|
@ -686,7 +686,7 @@ async def test_user_flow_2fa_unknown_error(hass):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
|
@ -700,7 +700,7 @@ async def test_user_flow_2fa_unknown_error(hass):
|
|||
{CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD},
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == CONF_CODE
|
||||
|
||||
with patch(
|
||||
|
@ -712,7 +712,7 @@ async def test_user_flow_2fa_unknown_error(hass):
|
|||
{CONF_CODE: MFA_CODE},
|
||||
)
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result3["step_id"] == "configuration"
|
||||
assert result3["errors"] == {}
|
||||
|
||||
|
@ -733,6 +733,6 @@ async def test_user_flow_2fa_unknown_error(hass):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result4["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result4["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result4["step_id"] == "configuration"
|
||||
assert result4["errors"] == {"base": "unknown"}
|
||||
|
|
|
@ -42,7 +42,7 @@ async def test_full_flow(
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_EXTERNAL_STEP
|
||||
assert result["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP
|
||||
assert result["url"] == (
|
||||
f"{OAUTH2_AUTHORIZE}?response_type=code&client_id={CLIENT_ID}"
|
||||
"&redirect_uri=https://example.com/auth/external/callback"
|
||||
|
|
|
@ -47,7 +47,7 @@ async def test_full_flow(
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_EXTERNAL_STEP
|
||||
assert result["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP
|
||||
assert result["step_id"] == "auth"
|
||||
assert result["url"] == (
|
||||
f"{OAUTH2_AUTHORIZE}?response_type=code&client_id={CLIENT_ID}"
|
||||
|
@ -77,7 +77,7 @@ async def test_full_flow(
|
|||
result = await hass.config_entries.flow.async_configure(result["flow_id"])
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "Home+ Control"
|
||||
config_data = result["data"]
|
||||
assert config_data["token"]["refresh_token"] == "mock-refresh-token"
|
||||
|
@ -109,7 +109,7 @@ async def test_abort_if_entry_in_progress(hass, current_request_with_host):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
"home_plus_control", context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_in_progress"
|
||||
|
||||
|
||||
|
@ -134,7 +134,7 @@ async def test_abort_if_entry_exists(hass, current_request_with_host):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
"home_plus_control", context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "single_instance_allowed"
|
||||
|
||||
|
||||
|
@ -165,7 +165,7 @@ async def test_abort_if_invalid_token(
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_EXTERNAL_STEP
|
||||
assert result["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP
|
||||
assert result["step_id"] == "auth"
|
||||
assert result["url"] == (
|
||||
f"{OAUTH2_AUTHORIZE}?response_type=code&client_id={CLIENT_ID}"
|
||||
|
@ -189,5 +189,5 @@ async def test_abort_if_invalid_token(
|
|||
)
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"])
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "oauth_error"
|
||||
|
|
|
@ -56,7 +56,7 @@ async def test_setup_in_bridge_mode(hass, mock_get_source_ip):
|
|||
result["flow_id"],
|
||||
{"include_domains": ["light"]},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "pairing"
|
||||
|
||||
with patch(
|
||||
|
@ -74,7 +74,7 @@ async def test_setup_in_bridge_mode(hass, mock_get_source_ip):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
bridge_name = (result3["title"].split(":"))[0]
|
||||
assert bridge_name == SHORT_BRIDGE_NAME
|
||||
assert result3["data"] == {
|
||||
|
@ -112,7 +112,7 @@ async def test_setup_in_bridge_mode_name_taken(hass, mock_get_source_ip):
|
|||
result["flow_id"],
|
||||
{"include_domains": ["light"]},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "pairing"
|
||||
|
||||
with patch(
|
||||
|
@ -130,7 +130,7 @@ async def test_setup_in_bridge_mode_name_taken(hass, mock_get_source_ip):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result3["title"] != SHORT_BRIDGE_NAME
|
||||
assert result3["title"].startswith(SHORT_BRIDGE_NAME)
|
||||
bridge_name = (result3["title"].split(":"))[0]
|
||||
|
@ -194,7 +194,7 @@ async def test_setup_creates_entries_for_accessory_mode_devices(
|
|||
result["flow_id"],
|
||||
{"include_domains": ["camera", "media_player", "light", "lock", "remote"]},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "pairing"
|
||||
|
||||
with patch(
|
||||
|
@ -212,7 +212,7 @@ async def test_setup_creates_entries_for_accessory_mode_devices(
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result3["title"][:11] == "HASS Bridge"
|
||||
bridge_name = (result3["title"].split(":"))[0]
|
||||
assert result3["data"] == {
|
||||
|
@ -257,7 +257,7 @@ async def test_import(hass, mock_get_source_ip):
|
|||
context={"source": config_entries.SOURCE_IMPORT},
|
||||
data={CONF_NAME: "mock_name", CONF_PORT: 12345},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "port_name_in_use"
|
||||
|
||||
with patch(
|
||||
|
@ -273,7 +273,7 @@ async def test_import(hass, mock_get_source_ip):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "othername:56789"
|
||||
assert result2["data"] == {
|
||||
"name": "othername",
|
||||
|
@ -296,7 +296,7 @@ async def test_options_flow_exclude_mode_advanced(hass, mock_get_source_ip):
|
|||
config_entry.entry_id, context={"show_advanced_options": True}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -307,14 +307,14 @@ async def test_options_flow_exclude_mode_advanced(hass, mock_get_source_ip):
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "exclude"
|
||||
|
||||
result2 = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={"entities": ["climate.old"]},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "advanced"
|
||||
|
||||
with patch("homeassistant.components.homekit.async_setup_entry", return_value=True):
|
||||
|
@ -323,7 +323,7 @@ async def test_options_flow_exclude_mode_advanced(hass, mock_get_source_ip):
|
|||
user_input={},
|
||||
)
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
"devices": [],
|
||||
"mode": "bridge",
|
||||
|
@ -351,7 +351,7 @@ async def test_options_flow_exclude_mode_basic(hass, mock_get_source_ip):
|
|||
config_entry.entry_id, context={"show_advanced_options": False}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -362,7 +362,7 @@ async def test_options_flow_exclude_mode_basic(hass, mock_get_source_ip):
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "exclude"
|
||||
entities = result["data_schema"]({})["entities"]
|
||||
assert entities == ["climate.front_gate"]
|
||||
|
@ -375,7 +375,7 @@ async def test_options_flow_exclude_mode_basic(hass, mock_get_source_ip):
|
|||
result["flow_id"],
|
||||
user_input={"entities": ["climate.old"]},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
"mode": "bridge",
|
||||
"filter": {
|
||||
|
@ -430,7 +430,7 @@ async def test_options_flow_devices(
|
|||
config_entry.entry_id, context={"show_advanced_options": True}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -441,7 +441,7 @@ async def test_options_flow_devices(
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "exclude"
|
||||
|
||||
entry = entity_reg.async_get("light.ceiling_lights")
|
||||
|
@ -461,7 +461,7 @@ async def test_options_flow_devices(
|
|||
user_input={"devices": [device_id]},
|
||||
)
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
"devices": [device_id],
|
||||
"mode": "bridge",
|
||||
|
@ -510,7 +510,7 @@ async def test_options_flow_devices_preserved_when_advanced_off(
|
|||
config_entry.entry_id, context={"show_advanced_options": False}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -521,7 +521,7 @@ async def test_options_flow_devices_preserved_when_advanced_off(
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "exclude"
|
||||
|
||||
result2 = await hass.config_entries.options.async_configure(
|
||||
|
@ -531,7 +531,7 @@ async def test_options_flow_devices_preserved_when_advanced_off(
|
|||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
"devices": ["1fabcabcabcabcabcabcabcabcabc"],
|
||||
"mode": "bridge",
|
||||
|
@ -567,7 +567,7 @@ async def test_options_flow_include_mode_with_non_existant_entity(
|
|||
config_entry.entry_id, context={"show_advanced_options": False}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -578,7 +578,7 @@ async def test_options_flow_include_mode_with_non_existant_entity(
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "include"
|
||||
|
||||
entities = result["data_schema"]({})["entities"]
|
||||
|
@ -590,7 +590,7 @@ async def test_options_flow_include_mode_with_non_existant_entity(
|
|||
"entities": ["climate.new", "climate.front_gate"],
|
||||
},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
"mode": "bridge",
|
||||
"filter": {
|
||||
|
@ -626,7 +626,7 @@ async def test_options_flow_exclude_mode_with_non_existant_entity(
|
|||
config_entry.entry_id, context={"show_advanced_options": False}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -637,7 +637,7 @@ async def test_options_flow_exclude_mode_with_non_existant_entity(
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "exclude"
|
||||
|
||||
entities = result["data_schema"]({})["entities"]
|
||||
|
@ -649,7 +649,7 @@ async def test_options_flow_exclude_mode_with_non_existant_entity(
|
|||
"entities": ["climate.new", "climate.front_gate"],
|
||||
},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
"mode": "bridge",
|
||||
"filter": {
|
||||
|
@ -676,7 +676,7 @@ async def test_options_flow_include_mode_basic(hass, mock_get_source_ip):
|
|||
config_entry.entry_id, context={"show_advanced_options": False}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -687,14 +687,14 @@ async def test_options_flow_include_mode_basic(hass, mock_get_source_ip):
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "include"
|
||||
|
||||
result2 = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={"entities": ["climate.new"]},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
"mode": "bridge",
|
||||
"filter": {
|
||||
|
@ -723,7 +723,7 @@ async def test_options_flow_exclude_mode_with_cameras(hass, mock_get_source_ip):
|
|||
config_entry.entry_id, context={"show_advanced_options": False}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -734,7 +734,7 @@ async def test_options_flow_exclude_mode_with_cameras(hass, mock_get_source_ip):
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "exclude"
|
||||
|
||||
result2 = await hass.config_entries.options.async_configure(
|
||||
|
@ -743,7 +743,7 @@ async def test_options_flow_exclude_mode_with_cameras(hass, mock_get_source_ip):
|
|||
"entities": ["climate.old", "camera.excluded"],
|
||||
},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "cameras"
|
||||
|
||||
result3 = await hass.config_entries.options.async_configure(
|
||||
|
@ -751,7 +751,7 @@ async def test_options_flow_exclude_mode_with_cameras(hass, mock_get_source_ip):
|
|||
user_input={"camera_copy": ["camera.native_h264"]},
|
||||
)
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
"mode": "bridge",
|
||||
"filter": {
|
||||
|
@ -769,7 +769,7 @@ async def test_options_flow_exclude_mode_with_cameras(hass, mock_get_source_ip):
|
|||
config_entry.entry_id, context={"show_advanced_options": False}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -780,7 +780,7 @@ async def test_options_flow_exclude_mode_with_cameras(hass, mock_get_source_ip):
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "exclude"
|
||||
|
||||
result2 = await hass.config_entries.options.async_configure(
|
||||
|
@ -789,7 +789,7 @@ async def test_options_flow_exclude_mode_with_cameras(hass, mock_get_source_ip):
|
|||
"entities": ["climate.old", "camera.excluded"],
|
||||
},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "cameras"
|
||||
|
||||
result3 = await hass.config_entries.options.async_configure(
|
||||
|
@ -797,7 +797,7 @@ async def test_options_flow_exclude_mode_with_cameras(hass, mock_get_source_ip):
|
|||
user_input={"camera_copy": ["camera.native_h264"]},
|
||||
)
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
assert config_entry.options == {
|
||||
"mode": "bridge",
|
||||
|
@ -828,7 +828,7 @@ async def test_options_flow_include_mode_with_cameras(hass, mock_get_source_ip):
|
|||
config_entry.entry_id, context={"show_advanced_options": False}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -839,7 +839,7 @@ async def test_options_flow_include_mode_with_cameras(hass, mock_get_source_ip):
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "include"
|
||||
|
||||
result2 = await hass.config_entries.options.async_configure(
|
||||
|
@ -848,7 +848,7 @@ async def test_options_flow_include_mode_with_cameras(hass, mock_get_source_ip):
|
|||
"entities": ["camera.native_h264", "camera.transcode_h264"],
|
||||
},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "cameras"
|
||||
|
||||
result3 = await hass.config_entries.options.async_configure(
|
||||
|
@ -856,7 +856,7 @@ async def test_options_flow_include_mode_with_cameras(hass, mock_get_source_ip):
|
|||
user_input={"camera_copy": ["camera.native_h264"]},
|
||||
)
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
"mode": "bridge",
|
||||
"filter": {
|
||||
|
@ -874,7 +874,7 @@ async def test_options_flow_include_mode_with_cameras(hass, mock_get_source_ip):
|
|||
config_entry.entry_id, context={"show_advanced_options": False}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
assert result["data_schema"]({}) == {
|
||||
"domains": ["fan", "vacuum", "climate", "camera"],
|
||||
|
@ -899,7 +899,7 @@ async def test_options_flow_include_mode_with_cameras(hass, mock_get_source_ip):
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "exclude"
|
||||
assert result["data_schema"]({}) == {
|
||||
"entities": ["camera.native_h264", "camera.transcode_h264"],
|
||||
|
@ -916,7 +916,7 @@ async def test_options_flow_include_mode_with_cameras(hass, mock_get_source_ip):
|
|||
"entities": ["climate.old", "camera.excluded"],
|
||||
},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "cameras"
|
||||
assert result2["data_schema"]({}) == {
|
||||
"camera_copy": ["camera.native_h264"],
|
||||
|
@ -930,7 +930,7 @@ async def test_options_flow_include_mode_with_cameras(hass, mock_get_source_ip):
|
|||
user_input={"camera_copy": []},
|
||||
)
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
"entity_config": {"camera.native_h264": {}},
|
||||
"filter": {
|
||||
|
@ -960,7 +960,7 @@ async def test_options_flow_with_camera_audio(hass, mock_get_source_ip):
|
|||
config_entry.entry_id, context={"show_advanced_options": False}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -971,7 +971,7 @@ async def test_options_flow_with_camera_audio(hass, mock_get_source_ip):
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "include"
|
||||
|
||||
result2 = await hass.config_entries.options.async_configure(
|
||||
|
@ -980,7 +980,7 @@ async def test_options_flow_with_camera_audio(hass, mock_get_source_ip):
|
|||
"entities": ["camera.audio", "camera.no_audio"],
|
||||
},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "cameras"
|
||||
|
||||
result3 = await hass.config_entries.options.async_configure(
|
||||
|
@ -988,7 +988,7 @@ async def test_options_flow_with_camera_audio(hass, mock_get_source_ip):
|
|||
user_input={"camera_audio": ["camera.audio"]},
|
||||
)
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
"mode": "bridge",
|
||||
"filter": {
|
||||
|
@ -1006,7 +1006,7 @@ async def test_options_flow_with_camera_audio(hass, mock_get_source_ip):
|
|||
config_entry.entry_id, context={"show_advanced_options": False}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
assert result["data_schema"]({}) == {
|
||||
"domains": ["fan", "vacuum", "climate", "camera"],
|
||||
|
@ -1031,7 +1031,7 @@ async def test_options_flow_with_camera_audio(hass, mock_get_source_ip):
|
|||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "exclude"
|
||||
assert result["data_schema"]({}) == {
|
||||
"entities": ["camera.audio", "camera.no_audio"],
|
||||
|
@ -1048,7 +1048,7 @@ async def test_options_flow_with_camera_audio(hass, mock_get_source_ip):
|
|||
"entities": ["climate.old", "camera.excluded"],
|
||||
},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "cameras"
|
||||
assert result2["data_schema"]({}) == {
|
||||
"camera_copy": [],
|
||||
|
@ -1062,7 +1062,7 @@ async def test_options_flow_with_camera_audio(hass, mock_get_source_ip):
|
|||
user_input={"camera_audio": []},
|
||||
)
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
"entity_config": {"camera.audio": {}},
|
||||
"filter": {
|
||||
|
@ -1103,7 +1103,7 @@ async def test_options_flow_blocked_when_from_yaml(hass, mock_get_source_ip):
|
|||
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "yaml"
|
||||
|
||||
with patch("homeassistant.components.homekit.async_setup_entry", return_value=True):
|
||||
|
@ -1111,7 +1111,7 @@ async def test_options_flow_blocked_when_from_yaml(hass, mock_get_source_ip):
|
|||
result["flow_id"],
|
||||
user_input={},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
|
||||
@patch(f"{PATH_HOMEKIT}.async_port_is_available", return_value=True)
|
||||
|
@ -1131,7 +1131,7 @@ async def test_options_flow_include_mode_basic_accessory(
|
|||
config_entry.entry_id, context={"show_advanced_options": False}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
assert result["data_schema"]({}) == {
|
||||
"domains": [
|
||||
|
@ -1151,7 +1151,7 @@ async def test_options_flow_include_mode_basic_accessory(
|
|||
user_input={"domains": ["media_player"], "mode": "accessory"},
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "accessory"
|
||||
assert _get_schema_default(result2["data_schema"].schema, "entities") is None
|
||||
|
||||
|
@ -1159,7 +1159,7 @@ async def test_options_flow_include_mode_basic_accessory(
|
|||
result2["flow_id"],
|
||||
user_input={"entities": "media_player.tv"},
|
||||
)
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
"mode": "accessory",
|
||||
"filter": {
|
||||
|
@ -1177,7 +1177,7 @@ async def test_options_flow_include_mode_basic_accessory(
|
|||
config_entry.entry_id, context={"show_advanced_options": False}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
assert result["data_schema"]({}) == {
|
||||
"domains": ["media_player"],
|
||||
|
@ -1190,7 +1190,7 @@ async def test_options_flow_include_mode_basic_accessory(
|
|||
user_input={"domains": ["media_player"], "mode": "accessory"},
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "accessory"
|
||||
assert (
|
||||
_get_schema_default(result2["data_schema"].schema, "entities")
|
||||
|
@ -1201,7 +1201,7 @@ async def test_options_flow_include_mode_basic_accessory(
|
|||
result2["flow_id"],
|
||||
user_input={"entities": "media_player.tv"},
|
||||
)
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
"mode": "accessory",
|
||||
"filter": {
|
||||
|
@ -1226,7 +1226,7 @@ async def test_converting_bridge_to_accessory_mode(hass, hk_driver, mock_get_sou
|
|||
result["flow_id"],
|
||||
{"include_domains": ["light"]},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "pairing"
|
||||
|
||||
# We need to actually setup the config entry or the data
|
||||
|
@ -1244,7 +1244,7 @@ async def test_converting_bridge_to_accessory_mode(hass, hk_driver, mock_get_sou
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result3["title"][:11] == "HASS Bridge"
|
||||
bridge_name = (result3["title"].split(":"))[0]
|
||||
assert result3["data"] == {
|
||||
|
@ -1272,7 +1272,7 @@ async def test_converting_bridge_to_accessory_mode(hass, hk_driver, mock_get_sou
|
|||
config_entry.entry_id, context={"show_advanced_options": False}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
schema = result["data_schema"].schema
|
||||
assert _get_schema_default(schema, "mode") == "bridge"
|
||||
|
@ -1283,14 +1283,14 @@ async def test_converting_bridge_to_accessory_mode(hass, hk_driver, mock_get_sou
|
|||
user_input={"domains": ["camera"], "mode": "accessory"},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "accessory"
|
||||
|
||||
result2 = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={"entities": "camera.tv"},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "cameras"
|
||||
|
||||
with patch(
|
||||
|
@ -1305,7 +1305,7 @@ async def test_converting_bridge_to_accessory_mode(hass, hk_driver, mock_get_sou
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
"entity_config": {"camera.tv": {"video_codec": "copy"}},
|
||||
"mode": "accessory",
|
||||
|
@ -1363,7 +1363,7 @@ async def test_options_flow_exclude_mode_skips_category_entities(
|
|||
config_entry.entry_id, context={"show_advanced_options": False}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
assert result["data_schema"]({}) == {
|
||||
"domains": [
|
||||
|
@ -1387,7 +1387,7 @@ async def test_options_flow_exclude_mode_skips_category_entities(
|
|||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "exclude"
|
||||
assert _get_schema_default(result2["data_schema"].schema, "entities") == []
|
||||
|
||||
|
@ -1409,7 +1409,7 @@ async def test_options_flow_exclude_mode_skips_category_entities(
|
|||
]
|
||||
},
|
||||
)
|
||||
assert result4["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result4["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
"mode": "bridge",
|
||||
"filter": {
|
||||
|
@ -1451,7 +1451,7 @@ async def test_options_flow_exclude_mode_skips_hidden_entities(
|
|||
config_entry.entry_id, context={"show_advanced_options": False}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
assert result["data_schema"]({}) == {
|
||||
"domains": [
|
||||
|
@ -1475,7 +1475,7 @@ async def test_options_flow_exclude_mode_skips_hidden_entities(
|
|||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "exclude"
|
||||
assert _get_schema_default(result2["data_schema"].schema, "entities") == []
|
||||
|
||||
|
@ -1491,7 +1491,7 @@ async def test_options_flow_exclude_mode_skips_hidden_entities(
|
|||
result2["flow_id"],
|
||||
user_input={"entities": ["media_player.tv", "switch.other"]},
|
||||
)
|
||||
assert result4["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result4["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
"mode": "bridge",
|
||||
"filter": {
|
||||
|
@ -1529,7 +1529,7 @@ async def test_options_flow_include_mode_allows_hidden_entities(
|
|||
config_entry.entry_id, context={"show_advanced_options": False}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
assert result["data_schema"]({}) == {
|
||||
"domains": [
|
||||
|
@ -1553,7 +1553,7 @@ async def test_options_flow_include_mode_allows_hidden_entities(
|
|||
},
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "include"
|
||||
assert _get_schema_default(result2["data_schema"].schema, "entities") == []
|
||||
|
||||
|
@ -1569,7 +1569,7 @@ async def test_options_flow_include_mode_allows_hidden_entities(
|
|||
]
|
||||
},
|
||||
)
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
"mode": "bridge",
|
||||
"filter": {
|
||||
|
|
|
@ -29,7 +29,7 @@ async def test_show_authenticate_form(hass: HomeAssistant) -> None:
|
|||
context={"source": SOURCE_USER},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
|
@ -53,7 +53,7 @@ async def test_create_entry(hass: HomeAssistant) -> None:
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=FAKE_CONFIG
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] == FAKE_CONFIG
|
||||
|
||||
|
||||
|
@ -70,7 +70,7 @@ async def test_show_option_form(
|
|||
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
|
||||
|
@ -91,7 +91,7 @@ async def test_create_option_entry(
|
|||
user_input={CONF_COOL_AWAY_TEMPERATURE: 1, CONF_HEAT_AWAY_TEMPERATURE: 2},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
CONF_COOL_AWAY_TEMPERATURE: 1,
|
||||
CONF_HEAT_AWAY_TEMPERATURE: 2,
|
||||
|
|
|
@ -41,7 +41,7 @@ async def test_show_set_form(hass):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=None
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
|
@ -54,7 +54,7 @@ async def test_urlize_plain_host(hass, requests_mock):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=user_input
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert user_input[CONF_URL] == f"http://{host}/"
|
||||
|
||||
|
@ -85,7 +85,7 @@ async def test_already_configured(hass, requests_mock, login_requests_mock):
|
|||
data=FIXTURE_USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -96,7 +96,7 @@ async def test_connection_error(hass, requests_mock):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=FIXTURE_USER_INPUT
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {CONF_URL: "unknown"}
|
||||
|
||||
|
@ -142,7 +142,7 @@ async def test_login_error(hass, login_requests_mock, code, errors):
|
|||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=FIXTURE_USER_INPUT
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == errors
|
||||
|
||||
|
@ -164,7 +164,7 @@ async def test_success(hass, login_requests_mock):
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["data"][CONF_URL] == FIXTURE_USER_INPUT[CONF_URL]
|
||||
assert result["data"][CONF_USERNAME] == FIXTURE_USER_INPUT[CONF_USERNAME]
|
||||
assert result["data"][CONF_PASSWORD] == FIXTURE_USER_INPUT[CONF_PASSWORD]
|
||||
|
@ -195,7 +195,7 @@ async def test_ssdp(hass):
|
|||
),
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["data_schema"]({})[CONF_URL] == url
|
||||
|
||||
|
@ -209,7 +209,7 @@ async def test_options(hass):
|
|||
config_entry.add_to_hass(hass)
|
||||
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
recipient = "+15555550000"
|
||||
|
|
|
@ -17,7 +17,7 @@ async def test_form(hass):
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
|
||||
with patch(
|
||||
|
@ -68,7 +68,7 @@ async def test_form_invalid_auth(hass):
|
|||
},
|
||||
)
|
||||
|
||||
assert form_result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert form_result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert form_result["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
|
||||
|
@ -90,7 +90,7 @@ async def test_form_cannot_connect(hass):
|
|||
},
|
||||
)
|
||||
|
||||
assert form_result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert form_result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert form_result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
|
@ -112,7 +112,7 @@ async def test_form_unknown_error(hass):
|
|||
},
|
||||
)
|
||||
|
||||
assert form_result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert form_result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert form_result["errors"] == {"base": "unknown"}
|
||||
|
||||
|
||||
|
@ -148,5 +148,5 @@ async def test_form_entry_exists(hass):
|
|||
},
|
||||
)
|
||||
|
||||
assert form_result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert form_result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert form_result["reason"] == "already_configured"
|
||||
|
|
|
@ -273,7 +273,7 @@ async def test_options_flow(hass):
|
|||
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
|
@ -281,7 +281,7 @@ async def test_options_flow(hass):
|
|||
user_input={CONF_FILTER: ["0"], CONF_OFFSET: 15, CONF_REAL_TIME: False},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
CONF_FILTER: [
|
||||
{
|
||||
|
@ -329,7 +329,7 @@ async def test_options_flow_invalid_auth(hass):
|
|||
):
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
assert result["errors"] == {"base": "invalid_auth"}
|
||||
|
@ -364,7 +364,7 @@ async def test_options_flow_cannot_connect(hass):
|
|||
):
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue