From dde465da48feb4b540b3a3b769b38e1a5f109669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diefferson=20Koderer=20M=C3=B4ro?= Date: Mon, 5 Oct 2020 10:27:48 -0300 Subject: [PATCH] Use common strings for Onvif config flow (#41170) * Use common strings for Onvif config flow * Fix tests * Update homeassistant/components/onvif/strings.json Co-authored-by: Paulus Schoutsen --- homeassistant/components/onvif/config_flow.py | 2 +- homeassistant/components/onvif/strings.json | 4 ++-- tests/components/onvif/test_config_flow.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/onvif/config_flow.py b/homeassistant/components/onvif/config_flow.py index cbe6d03fa68..ccb301a455f 100644 --- a/homeassistant/components/onvif/config_flow.py +++ b/homeassistant/components/onvif/config_flow.py @@ -262,7 +262,7 @@ class OnvifFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): return self.async_abort(reason="onvif_error") except Fault: - errors["base"] = "connection_failed" + errors["base"] = "cannot_connect" return self.async_show_form(step_id="auth", errors=errors) diff --git a/homeassistant/components/onvif/strings.json b/homeassistant/components/onvif/strings.json index 4dc411a2212..dac8ef8647d 100644 --- a/homeassistant/components/onvif/strings.json +++ b/homeassistant/components/onvif/strings.json @@ -1,14 +1,14 @@ { "config": { "abort": { - "already_configured": "ONVIF device is already configured.", + "already_configured": "[%key:common::config_flow::abort::already_configured_device%]", "already_in_progress": "[%key:common::config_flow::abort::already_in_progress%]", "onvif_error": "Error setting up ONVIF device. Check logs for more information.", "no_h264": "There were no H264 streams available. Check the profile configuration on your device.", "no_mac": "Could not configure unique ID for ONVIF device." }, "error": { - "connection_failed": "Could not connect to ONVIF service with provided credentials." + "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]" }, "step": { "user": { diff --git a/tests/components/onvif/test_config_flow.py b/tests/components/onvif/test_config_flow.py index 864968f848d..e54b0c7a4ec 100644 --- a/tests/components/onvif/test_config_flow.py +++ b/tests/components/onvif/test_config_flow.py @@ -531,7 +531,7 @@ async def test_flow_import_onvif_auth_error(hass): assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["step_id"] == "auth" - assert result["errors"]["base"] == "connection_failed" + assert result["errors"]["base"] == "cannot_connect" async def test_option_flow(hass):