mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 06:47:09 +00:00
Use unique_id in devolo Home Network tests (#133147)
This commit is contained in:
parent
836fd94a56
commit
cc27c95bad
@ -4,7 +4,7 @@ from homeassistant.components.devolo_home_network.const import DOMAIN
|
|||||||
from homeassistant.const import CONF_IP_ADDRESS, CONF_PASSWORD
|
from homeassistant.const import CONF_IP_ADDRESS, CONF_PASSWORD
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from .const import IP
|
from .const import DISCOVERY_INFO, IP
|
||||||
|
|
||||||
from tests.common import MockConfigEntry
|
from tests.common import MockConfigEntry
|
||||||
|
|
||||||
@ -15,7 +15,12 @@ def configure_integration(hass: HomeAssistant) -> MockConfigEntry:
|
|||||||
CONF_IP_ADDRESS: IP,
|
CONF_IP_ADDRESS: IP,
|
||||||
CONF_PASSWORD: "test",
|
CONF_PASSWORD: "test",
|
||||||
}
|
}
|
||||||
entry = MockConfigEntry(domain=DOMAIN, data=config, entry_id="123456")
|
entry = MockConfigEntry(
|
||||||
|
domain=DOMAIN,
|
||||||
|
data=config,
|
||||||
|
entry_id="123456",
|
||||||
|
unique_id=DISCOVERY_INFO.properties["SN"],
|
||||||
|
)
|
||||||
entry.add_to_hass(hass)
|
entry.add_to_hass(hass)
|
||||||
|
|
||||||
return entry
|
return entry
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
'subentries': list([
|
'subentries': list([
|
||||||
]),
|
]),
|
||||||
'title': 'Mock Title',
|
'title': 'Mock Title',
|
||||||
'unique_id': None,
|
'unique_id': '1234567890',
|
||||||
'version': 1,
|
'version': 1,
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
@ -29,8 +29,6 @@ from .const import (
|
|||||||
)
|
)
|
||||||
from .mock import MockDevice
|
from .mock import MockDevice
|
||||||
|
|
||||||
from tests.common import MockConfigEntry
|
|
||||||
|
|
||||||
|
|
||||||
async def test_form(hass: HomeAssistant, info: dict[str, Any]) -> None:
|
async def test_form(hass: HomeAssistant, info: dict[str, Any]) -> None:
|
||||||
"""Test we get the form."""
|
"""Test we get the form."""
|
||||||
@ -125,6 +123,8 @@ async def test_zeroconf(hass: HomeAssistant) -> None:
|
|||||||
CONF_IP_ADDRESS: IP,
|
CONF_IP_ADDRESS: IP,
|
||||||
CONF_PASSWORD: "",
|
CONF_PASSWORD: "",
|
||||||
}
|
}
|
||||||
|
assert result2["type"] is FlowResultType.CREATE_ENTRY
|
||||||
|
assert result2["result"].unique_id == "1234567890"
|
||||||
|
|
||||||
|
|
||||||
async def test_abort_zeroconf_wrong_device(hass: HomeAssistant) -> None:
|
async def test_abort_zeroconf_wrong_device(hass: HomeAssistant) -> None:
|
||||||
@ -141,11 +141,7 @@ async def test_abort_zeroconf_wrong_device(hass: HomeAssistant) -> None:
|
|||||||
@pytest.mark.usefixtures("info")
|
@pytest.mark.usefixtures("info")
|
||||||
async def test_abort_if_configured(hass: HomeAssistant) -> None:
|
async def test_abort_if_configured(hass: HomeAssistant) -> None:
|
||||||
"""Test we abort config flow if already configured."""
|
"""Test we abort config flow if already configured."""
|
||||||
serial_number = DISCOVERY_INFO.properties["SN"]
|
entry = configure_integration(hass)
|
||||||
entry = MockConfigEntry(
|
|
||||||
domain=DOMAIN, unique_id=serial_number, data={CONF_IP_ADDRESS: IP}
|
|
||||||
)
|
|
||||||
entry.add_to_hass(hass)
|
|
||||||
|
|
||||||
# Abort on concurrent user flow
|
# Abort on concurrent user flow
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user