Mark abode as single_config_entry (#131241)

This commit is contained in:
epenet 2024-11-22 15:04:41 +01:00 committed by GitHub
parent 384b2af31e
commit f51662f31b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 18 additions and 23 deletions

View File

@ -112,9 +112,6 @@ class AbodeFlowHandler(ConfigFlow, domain=DOMAIN):
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initialized by the user."""
if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed")
if user_input is None:
return self.async_show_form(
step_id="user", data_schema=vol.Schema(self.data_schema)

View File

@ -9,5 +9,6 @@
},
"iot_class": "cloud_push",
"loggers": ["jaraco.abode", "lomond"],
"requirements": ["jaraco.abode==6.2.1"]
"requirements": ["jaraco.abode==6.2.1"],
"single_config_entry": true
}

View File

@ -28,7 +28,6 @@
"invalid_mfa_code": "Invalid MFA code"
},
"abort": {
"single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
}
},

View File

@ -9,7 +9,8 @@
"name": "Abode",
"integration_type": "hub",
"config_flow": true,
"iot_class": "cloud_push"
"iot_class": "cloud_push",
"single_config_entry": true
},
"acaia": {
"name": "Acaia",

View File

@ -13,7 +13,6 @@ from homeassistant.components.alarm_control_panel import DOMAIN as ALARM_DOMAIN
from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import CONF_USERNAME
from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResultType
from .common import setup_platform
@ -63,25 +62,23 @@ async def test_unload_entry(hass: HomeAssistant) -> None:
async def test_invalid_credentials(hass: HomeAssistant) -> None:
"""Test Abode credentials changing."""
with (
patch(
"homeassistant.components.abode.Abode",
side_effect=AbodeAuthenticationException(
(HTTPStatus.BAD_REQUEST, "auth error")
),
with patch(
"homeassistant.components.abode.Abode",
side_effect=AbodeAuthenticationException(
(HTTPStatus.BAD_REQUEST, "auth error")
),
patch(
"homeassistant.components.abode.config_flow.AbodeFlowHandler.async_step_reauth",
return_value={
"type": FlowResultType.FORM,
"flow_id": "mock_flow",
"step_id": "reauth_confirm",
},
) as mock_async_step_reauth,
):
await setup_platform(hass, ALARM_DOMAIN)
config_entry = await setup_platform(hass, ALARM_DOMAIN)
await hass.async_block_till_done()
mock_async_step_reauth.assert_called_once()
assert config_entry.state is ConfigEntryState.SETUP_ERROR
flows = hass.config_entries.flow.async_progress()
assert len(flows) == 1
assert flows[0]["step_id"] == "reauth_confirm"
hass.config_entries.flow.async_abort(flows[0]["flow_id"])
assert not hass.config_entries.flow.async_progress()
async def test_raise_config_entry_not_ready_when_offline(hass: HomeAssistant) -> None: