mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 14:57:09 +00:00
Use reference strings in Tuya (#41236)
This commit is contained in:
parent
d6fff02b11
commit
cf5c99d2a9
@ -22,8 +22,8 @@ DATA_SCHEMA_USER = vol.Schema(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
RESULT_AUTH_FAILED = "auth_failed"
|
RESULT_AUTH_FAILED = "invalid_auth"
|
||||||
RESULT_CONN_ERROR = "conn_error"
|
RESULT_CONN_ERROR = "cannot_connect"
|
||||||
RESULT_SUCCESS = "success"
|
RESULT_SUCCESS = "success"
|
||||||
|
|
||||||
RESULT_LOG_MESSAGE = {
|
RESULT_LOG_MESSAGE = {
|
||||||
|
@ -14,12 +14,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"abort": {
|
"abort": {
|
||||||
"auth_failed": "[%key:common::config_flow::error::invalid_auth%]",
|
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
|
||||||
"conn_error": "[%key:common::config_flow::error::cannot_connect%]",
|
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
||||||
"single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]"
|
"single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]"
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
"auth_failed": "[%key:common::config_flow::error::invalid_auth%]"
|
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,14 +120,14 @@ async def test_abort_on_invalid_credentials(hass, tuya):
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||||
assert result["errors"] == {"base": "auth_failed"}
|
assert result["errors"] == {"base": "invalid_auth"}
|
||||||
|
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, data=TUYA_USER_DATA
|
DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, data=TUYA_USER_DATA
|
||||||
)
|
)
|
||||||
|
|
||||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||||
assert result["reason"] == "auth_failed"
|
assert result["reason"] == "invalid_auth"
|
||||||
|
|
||||||
|
|
||||||
async def test_abort_on_connection_error(hass, tuya):
|
async def test_abort_on_connection_error(hass, tuya):
|
||||||
@ -139,11 +139,11 @@ async def test_abort_on_connection_error(hass, tuya):
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||||
assert result["reason"] == "conn_error"
|
assert result["reason"] == "cannot_connect"
|
||||||
|
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, data=TUYA_USER_DATA
|
DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, data=TUYA_USER_DATA
|
||||||
)
|
)
|
||||||
|
|
||||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||||
assert result["reason"] == "conn_error"
|
assert result["reason"] == "cannot_connect"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user