Skip to content

Commit

Permalink
Mark abode as single_config_entry (#131241)
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet authored Nov 22, 2024
1 parent 384b2af commit f51662f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 23 deletions.
3 changes: 0 additions & 3 deletions homeassistant/components/abode/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ async def async_step_user(
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)
Expand Down
3 changes: 2 additions & 1 deletion homeassistant/components/abode/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
1 change: 0 additions & 1 deletion homeassistant/components/abode/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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%]"
}
},
Expand Down
3 changes: 2 additions & 1 deletion homeassistant/generated/integrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
31 changes: 14 additions & 17 deletions tests/components/abode/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
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

Expand Down Expand Up @@ -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()

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"

mock_async_step_reauth.assert_called_once()
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:
Expand Down

0 comments on commit f51662f

Please sign in to comment.