Use common string names in ipp config flow (#41409)
* connection_error->cannot_connect * connection_error->cannot_connect in config flow
This commit is contained in:
parent
b8f291d58e
commit
3d9d90c4c8
3 changed files with 7 additions and 7 deletions
|
@ -73,7 +73,7 @@ class IPPFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||||
return self._show_setup_form({"base": "connection_upgrade"})
|
return self._show_setup_form({"base": "connection_upgrade"})
|
||||||
except (IPPConnectionError, IPPResponseError):
|
except (IPPConnectionError, IPPResponseError):
|
||||||
_LOGGER.debug("IPP Connection/Response Error", exc_info=True)
|
_LOGGER.debug("IPP Connection/Response Error", exc_info=True)
|
||||||
return self._show_setup_form({"base": "connection_error"})
|
return self._show_setup_form({"base": "cannot_connect"})
|
||||||
except IPPParseError:
|
except IPPParseError:
|
||||||
_LOGGER.debug("IPP Parse Error", exc_info=True)
|
_LOGGER.debug("IPP Parse Error", exc_info=True)
|
||||||
return self.async_abort(reason="parse_error")
|
return self.async_abort(reason="parse_error")
|
||||||
|
@ -127,7 +127,7 @@ class IPPFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||||
return self.async_abort(reason="connection_upgrade")
|
return self.async_abort(reason="connection_upgrade")
|
||||||
except (IPPConnectionError, IPPResponseError):
|
except (IPPConnectionError, IPPResponseError):
|
||||||
_LOGGER.debug("IPP Connection/Response Error", exc_info=True)
|
_LOGGER.debug("IPP Connection/Response Error", exc_info=True)
|
||||||
return self.async_abort(reason="connection_error")
|
return self.async_abort(reason="cannot_connect")
|
||||||
except IPPParseError:
|
except IPPParseError:
|
||||||
_LOGGER.debug("IPP Parse Error", exc_info=True)
|
_LOGGER.debug("IPP Parse Error", exc_info=True)
|
||||||
return self.async_abort(reason="parse_error")
|
return self.async_abort(reason="parse_error")
|
||||||
|
|
|
@ -19,12 +19,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
"connection_error": "[%key:common::config_flow::error::cannot_connect%]",
|
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
||||||
"connection_upgrade": "Failed to connect to printer. Please try again with SSL/TLS option checked."
|
"connection_upgrade": "Failed to connect to printer. Please try again with SSL/TLS option checked."
|
||||||
},
|
},
|
||||||
"abort": {
|
"abort": {
|
||||||
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
|
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
|
||||||
"connection_error": "[%key:common::config_flow::error::cannot_connect%]",
|
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
||||||
"connection_upgrade": "Failed to connect to printer due to connection upgrade being required.",
|
"connection_upgrade": "Failed to connect to printer due to connection upgrade being required.",
|
||||||
"ipp_error": "Encountered IPP error.",
|
"ipp_error": "Encountered IPP error.",
|
||||||
"ipp_version_error": "IPP version not supported by printer.",
|
"ipp_version_error": "IPP version not supported by printer.",
|
||||||
|
|
|
@ -65,7 +65,7 @@ async def test_connection_error(
|
||||||
|
|
||||||
assert result["step_id"] == "user"
|
assert result["step_id"] == "user"
|
||||||
assert result["type"] == RESULT_TYPE_FORM
|
assert result["type"] == RESULT_TYPE_FORM
|
||||||
assert result["errors"] == {"base": "connection_error"}
|
assert result["errors"] == {"base": "cannot_connect"}
|
||||||
|
|
||||||
|
|
||||||
async def test_zeroconf_connection_error(
|
async def test_zeroconf_connection_error(
|
||||||
|
@ -82,7 +82,7 @@ async def test_zeroconf_connection_error(
|
||||||
)
|
)
|
||||||
|
|
||||||
assert result["type"] == RESULT_TYPE_ABORT
|
assert result["type"] == RESULT_TYPE_ABORT
|
||||||
assert result["reason"] == "connection_error"
|
assert result["reason"] == "cannot_connect"
|
||||||
|
|
||||||
|
|
||||||
async def test_zeroconf_confirm_connection_error(
|
async def test_zeroconf_confirm_connection_error(
|
||||||
|
@ -97,7 +97,7 @@ async def test_zeroconf_confirm_connection_error(
|
||||||
)
|
)
|
||||||
|
|
||||||
assert result["type"] == RESULT_TYPE_ABORT
|
assert result["type"] == RESULT_TYPE_ABORT
|
||||||
assert result["reason"] == "connection_error"
|
assert result["reason"] == "cannot_connect"
|
||||||
|
|
||||||
|
|
||||||
async def test_user_connection_upgrade_required(
|
async def test_user_connection_upgrade_required(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue