mirror of
https://github.com/home-assistant/core.git
synced 2026-04-17 07:34:07 +01:00
Fix forced VERIFY_SSL in Portainer (#165079)
This commit is contained in:
@@ -159,8 +159,12 @@ class PortainerConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
_LOGGER.exception("Unexpected exception")
|
||||
errors["base"] = "unknown"
|
||||
else:
|
||||
await self.async_set_unique_id(user_input[CONF_API_TOKEN])
|
||||
self._abort_if_unique_id_configured()
|
||||
# Logic that can be reverted back once the new unique ID is in
|
||||
existing_entry = await self.async_set_unique_id(
|
||||
user_input[CONF_API_TOKEN]
|
||||
)
|
||||
if existing_entry and existing_entry.entry_id != reconf_entry.entry_id:
|
||||
return self.async_abort(reason="already_configured")
|
||||
return self.async_update_reload_and_abort(
|
||||
reconf_entry,
|
||||
data_updates={
|
||||
|
||||
@@ -263,20 +263,28 @@ async def test_full_flow_reconfigure_unique_id(
|
||||
) -> None:
|
||||
"""Test the full flow of the config flow, this time with a known unique ID."""
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
|
||||
other_entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
title="Portainer other",
|
||||
data=USER_INPUT_RECONFIGURE,
|
||||
unique_id=USER_INPUT_RECONFIGURE[CONF_API_TOKEN],
|
||||
)
|
||||
other_entry.add_to_hass(hass)
|
||||
|
||||
result = await mock_config_entry.start_reconfigure_flow(hass)
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "reconfigure"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input=MOCK_USER_SETUP,
|
||||
user_input=USER_INPUT_RECONFIGURE,
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
assert mock_config_entry.data[CONF_API_TOKEN] == "test_api_token"
|
||||
assert mock_config_entry.data[CONF_URL] == "https://127.0.0.1:9000/"
|
||||
assert mock_config_entry.data[CONF_VERIFY_SSL] is True
|
||||
assert len(mock_setup_entry.mock_calls) == 0
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user