mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Mark abode as single_config_entry (#131241)
This commit is contained in:
parent
384b2af31e
commit
f51662f31b
@ -112,9 +112,6 @@ class AbodeFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
self, user_input: dict[str, Any] | None = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
) -> ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle a flow initialized by the user."""
|
"""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:
|
if user_input is None:
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="user", data_schema=vol.Schema(self.data_schema)
|
step_id="user", data_schema=vol.Schema(self.data_schema)
|
||||||
|
@ -9,5 +9,6 @@
|
|||||||
},
|
},
|
||||||
"iot_class": "cloud_push",
|
"iot_class": "cloud_push",
|
||||||
"loggers": ["jaraco.abode", "lomond"],
|
"loggers": ["jaraco.abode", "lomond"],
|
||||||
"requirements": ["jaraco.abode==6.2.1"]
|
"requirements": ["jaraco.abode==6.2.1"],
|
||||||
|
"single_config_entry": true
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
"invalid_mfa_code": "Invalid MFA code"
|
"invalid_mfa_code": "Invalid MFA code"
|
||||||
},
|
},
|
||||||
"abort": {
|
"abort": {
|
||||||
"single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]",
|
|
||||||
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
|
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
"name": "Abode",
|
"name": "Abode",
|
||||||
"integration_type": "hub",
|
"integration_type": "hub",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"iot_class": "cloud_push"
|
"iot_class": "cloud_push",
|
||||||
|
"single_config_entry": true
|
||||||
},
|
},
|
||||||
"acaia": {
|
"acaia": {
|
||||||
"name": "Acaia",
|
"name": "Acaia",
|
||||||
|
@ -13,7 +13,6 @@ from homeassistant.components.alarm_control_panel import DOMAIN as ALARM_DOMAIN
|
|||||||
from homeassistant.config_entries import ConfigEntryState
|
from homeassistant.config_entries import ConfigEntryState
|
||||||
from homeassistant.const import CONF_USERNAME
|
from homeassistant.const import CONF_USERNAME
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.data_entry_flow import FlowResultType
|
|
||||||
|
|
||||||
from .common import setup_platform
|
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:
|
async def test_invalid_credentials(hass: HomeAssistant) -> None:
|
||||||
"""Test Abode credentials changing."""
|
"""Test Abode credentials changing."""
|
||||||
with (
|
with patch(
|
||||||
patch(
|
|
||||||
"homeassistant.components.abode.Abode",
|
"homeassistant.components.abode.Abode",
|
||||||
side_effect=AbodeAuthenticationException(
|
side_effect=AbodeAuthenticationException(
|
||||||
(HTTPStatus.BAD_REQUEST, "auth error")
|
(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:
|
async def test_raise_config_entry_not_ready_when_offline(hass: HomeAssistant) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user