Add test for Palazzetti DHCP discovery of already configured device (#192666)

This commit is contained in:
dotvav
2026-11-16 10:17:32 +01:00
committed by GitHub
parent 7a7ad16d83
commit 71b302a410
@@ -140,3 +140,24 @@ async def test_dhcp_flow_error(
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "cannot_connect"
@pytest.mark.usefixtures("mock_setup_entry")
async def test_dhcp_already_configured(
hass: HomeAssistant,
mock_palazzetti_client: AsyncMock,
mock_config_entry: MockConfigEntry,
) -> None:
"""Test DHCP discovery aborts when device is already configured."""
mock_config_entry.add_to_hass(hass)
result = await hass.config_entries.flow.async_init(
DOMAIN,
data=DhcpServiceInfo(
hostname="connbox1234", ip="192.168.1.1", macaddress="112233445566"
),
context={"source": SOURCE_DHCP},
)
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "already_configured"