mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Allow only single instance of energyzero integration (#133443)
This commit is contained in:
parent
5e5bebd7eb
commit
c9ca1f63ea
@ -4,6 +4,8 @@
|
||||
"codeowners": ["@klaasnicolaas"],
|
||||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/energyzero",
|
||||
"integration_type": "service",
|
||||
"iot_class": "cloud_polling",
|
||||
"requirements": ["energyzero==2.1.1"]
|
||||
"requirements": ["energyzero==2.1.1"],
|
||||
"single_config_entry": true
|
||||
}
|
||||
|
@ -1653,9 +1653,10 @@
|
||||
},
|
||||
"energyzero": {
|
||||
"name": "EnergyZero",
|
||||
"integration_type": "hub",
|
||||
"integration_type": "service",
|
||||
"config_flow": true,
|
||||
"iot_class": "cloud_polling"
|
||||
"iot_class": "cloud_polling",
|
||||
"single_config_entry": true
|
||||
},
|
||||
"enigma2": {
|
||||
"name": "Enigma2 (OpenWebif)",
|
||||
|
@ -9,6 +9,8 @@ from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
async def test_full_user_flow(
|
||||
hass: HomeAssistant,
|
||||
@ -33,3 +35,18 @@ async def test_full_user_flow(
|
||||
assert result2 == snapshot
|
||||
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
||||
|
||||
async def test_single_instance(
|
||||
hass: HomeAssistant,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
) -> None:
|
||||
"""Test abort when setting up a duplicate entry."""
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") is FlowResultType.ABORT
|
||||
assert result.get("reason") == "single_instance_allowed"
|
||||
|
Loading…
x
Reference in New Issue
Block a user