File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
homeassistant/components/portainer
tests/components/portainer Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -159,8 +159,12 @@ async def async_step_reconfigure(
159159 _LOGGER .exception ("Unexpected exception" )
160160 errors ["base" ] = "unknown"
161161 else :
162- await self .async_set_unique_id (user_input [CONF_API_TOKEN ])
163- self ._abort_if_unique_id_configured ()
162+ # Logic that can be reverted back once the new unique ID is in
163+ existing_entry = await self .async_set_unique_id (
164+ user_input [CONF_API_TOKEN ]
165+ )
166+ if existing_entry and existing_entry .entry_id != reconf_entry .entry_id :
167+ return self .async_abort (reason = "already_configured" )
164168 return self .async_update_reload_and_abort (
165169 reconf_entry ,
166170 data_updates = {
Original file line number Diff line number Diff line change @@ -263,20 +263,28 @@ async def test_full_flow_reconfigure_unique_id(
263263) -> None :
264264 """Test the full flow of the config flow, this time with a known unique ID."""
265265 mock_config_entry .add_to_hass (hass )
266+
267+ other_entry = MockConfigEntry (
268+ domain = DOMAIN ,
269+ title = "Portainer other" ,
270+ data = USER_INPUT_RECONFIGURE ,
271+ unique_id = USER_INPUT_RECONFIGURE [CONF_API_TOKEN ],
272+ )
273+ other_entry .add_to_hass (hass )
274+
266275 result = await mock_config_entry .start_reconfigure_flow (hass )
267276 assert result ["type" ] is FlowResultType .FORM
268277 assert result ["step_id" ] == "reconfigure"
269278
270279 result = await hass .config_entries .flow .async_configure (
271280 result ["flow_id" ],
272- user_input = MOCK_USER_SETUP ,
281+ user_input = USER_INPUT_RECONFIGURE ,
273282 )
274283
275284 assert result ["type" ] is FlowResultType .ABORT
276285 assert result ["reason" ] == "already_configured"
277286 assert mock_config_entry .data [CONF_API_TOKEN ] == "test_api_token"
278287 assert mock_config_entry .data [CONF_URL ] == "https://127.0.0.1:9000/"
279- assert mock_config_entry .data [CONF_VERIFY_SSL ] is True
280288 assert len (mock_setup_entry .mock_calls ) == 0
281289
282290
You can’t perform that action at this time.
0 commit comments