mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Update axis to use common strings (#41164)
* Update axis to use common strings * Update common str device_unavailable to cannot_connect Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
This commit is contained in:
parent
8b2df5bf99
commit
33e69fe4bf
@ -94,10 +94,10 @@ class AxisFlowHandler(config_entries.ConfigFlow, domain=AXIS_DOMAIN):
|
|||||||
return await self._create_entry()
|
return await self._create_entry()
|
||||||
|
|
||||||
except AuthenticationRequired:
|
except AuthenticationRequired:
|
||||||
errors["base"] = "faulty_credentials"
|
errors["base"] = "invalid_auth"
|
||||||
|
|
||||||
except CannotConnect:
|
except CannotConnect:
|
||||||
errors["base"] = "device_unavailable"
|
errors["base"] = "cannot_connect"
|
||||||
|
|
||||||
data = self.discovery_schema or {
|
data = self.discovery_schema or {
|
||||||
vol.Required(CONF_HOST): str,
|
vol.Required(CONF_HOST): str,
|
||||||
|
@ -13,13 +13,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
"already_configured": "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%]",
|
"already_in_progress": "[%key:common::config_flow::abort::already_in_progress%]",
|
||||||
"device_unavailable": "Device is not available",
|
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
||||||
"faulty_credentials": "Bad user credentials"
|
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]"
|
||||||
},
|
},
|
||||||
"abort": {
|
"abort": {
|
||||||
"already_configured": "Device is already configured",
|
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
|
||||||
"link_local_address": "Link local addresses are not supported",
|
"link_local_address": "Link local addresses are not supported",
|
||||||
"not_axis_device": "Discovered device not an Axis device"
|
"not_axis_device": "Discovered device not an Axis device"
|
||||||
}
|
}
|
||||||
|
@ -139,11 +139,11 @@ async def test_flow_fails_faulty_credentials(hass):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
assert result["errors"] == {"base": "faulty_credentials"}
|
assert result["errors"] == {"base": "invalid_auth"}
|
||||||
|
|
||||||
|
|
||||||
async def test_flow_fails_device_unavailable(hass):
|
async def test_flow_fails_cannot_connect(hass):
|
||||||
"""Test that config flow fails on device unavailable."""
|
"""Test that config flow fails on cannot connect."""
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
AXIS_DOMAIN, context={"source": "user"}
|
AXIS_DOMAIN, context={"source": "user"}
|
||||||
)
|
)
|
||||||
@ -165,7 +165,7 @@ async def test_flow_fails_device_unavailable(hass):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
assert result["errors"] == {"base": "device_unavailable"}
|
assert result["errors"] == {"base": "cannot_connect"}
|
||||||
|
|
||||||
|
|
||||||
async def test_flow_create_entry_multiple_existing_entries_of_same_model(hass):
|
async def test_flow_create_entry_multiple_existing_entries_of_same_model(hass):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user