From 71b302a410017cd62f95b2983452d1758bf2e592 Mon Sep 17 00:00:00 2001 From: dotvav Date: Mon, 16 Nov 2026 10:17:32 +0100 Subject: [PATCH] Add test for Palazzetti DHCP discovery of already configured device (#192666) --- .../components/palazzetti/test_config_flow.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/components/palazzetti/test_config_flow.py b/tests/components/palazzetti/test_config_flow.py index 6b9c82821434..7cf7fafe7e84 100644 --- a/tests/components/palazzetti/test_config_flow.py +++ b/tests/components/palazzetti/test_config_flow.py @@ -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"