mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 08:17:08 +00:00
Address late IntelliFire review (#70461)
* Addressing MartinHjelmare comments in closed PR * updated tests accordingly * Update tests/components/intellifire/test_config_flow.py Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Update tests/components/intellifire/test_config_flow.py Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * updated error message * addressing late review Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
56000c0378
commit
4a6ea5afd8
@ -128,21 +128,22 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
if user_input[CONF_USERNAME] != "":
|
try:
|
||||||
try:
|
return await self.validate_api_access_and_create_or_update(
|
||||||
return await self.validate_api_access_and_create_or_update(
|
host=self._host,
|
||||||
host=self._host,
|
username=user_input[CONF_USERNAME],
|
||||||
username=user_input[CONF_USERNAME],
|
password=user_input[CONF_PASSWORD],
|
||||||
password=user_input[CONF_PASSWORD],
|
serial=self._serial,
|
||||||
serial=self._serial,
|
)
|
||||||
)
|
|
||||||
|
|
||||||
except (ConnectionError, ClientConnectionError):
|
except (ConnectionError, ClientConnectionError):
|
||||||
errors["base"] = "iftapi_connect"
|
errors["base"] = "iftapi_connect"
|
||||||
LOGGER.info("ERROR: iftapi_connect")
|
LOGGER.error(
|
||||||
except LoginException:
|
"Could not connect to iftapi.net over https - verify connectivity"
|
||||||
errors["base"] = "api_error"
|
)
|
||||||
LOGGER.info("ERROR: api_error")
|
except LoginException:
|
||||||
|
errors["base"] = "api_error"
|
||||||
|
LOGGER.error("Invalid credentials for iftapi.net")
|
||||||
|
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="api_config", errors=errors, data_schema=control_schema
|
step_id="api_config", errors=errors, data_schema=control_schema
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
"manual_device_entry": {
|
"manual_device_entry": {
|
||||||
"description": "Local Configuration",
|
"description": "Local Configuration",
|
||||||
"data": {
|
"data": {
|
||||||
"host": "[%key:common::config_flow::data::host%] (IP Address)"
|
"host": "Host (IP Address)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"api_config": {
|
"api_config": {
|
||||||
|
@ -299,17 +299,14 @@ async def test_reauth_flow(
|
|||||||
assert result["type"] == RESULT_TYPE_FORM
|
assert result["type"] == RESULT_TYPE_FORM
|
||||||
assert result["step_id"] == "api_config"
|
assert result["step_id"] == "api_config"
|
||||||
|
|
||||||
with patch(
|
result3 = await hass.config_entries.flow.async_configure(
|
||||||
"homeassistant.config_entries.ConfigFlow.async_set_unique_id",
|
result["flow_id"],
|
||||||
return_value=entry,
|
{CONF_USERNAME: "test", CONF_PASSWORD: "AROONIE"},
|
||||||
):
|
)
|
||||||
|
|
||||||
result3 = await hass.config_entries.flow.async_configure(
|
|
||||||
result["flow_id"],
|
|
||||||
{CONF_USERNAME: "test", CONF_PASSWORD: "AROONIE"},
|
|
||||||
)
|
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert result3["type"] == RESULT_TYPE_ABORT
|
assert result3["type"] == RESULT_TYPE_ABORT
|
||||||
|
assert entry.data[CONF_PASSWORD] == "AROONIE"
|
||||||
|
assert entry.data[CONF_USERNAME] == "test"
|
||||||
|
|
||||||
|
|
||||||
async def test_dhcp_discovery_intellifire_device(
|
async def test_dhcp_discovery_intellifire_device(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user