From a021b1f4d80a3fd96baa8ad4a334b03a17153fa0 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 8 Oct 2026 11:40:22 +0200 Subject: [PATCH] Test nx584 setup failures through the binary sensor platform (#184829) Co-authored-by: Claude Opus 5.5 --- tests/components/nx584/test_binary_sensor.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/components/nx584/test_binary_sensor.py b/tests/components/nx584/test_binary_sensor.py index cad1a74ae338..c44e699a7580 100644 --- a/tests/components/nx584/test_binary_sensor.py +++ b/tests/components/nx584/test_binary_sensor.py @@ -7,6 +7,7 @@ from nx584 import client as nx584_client import pytest import requests +from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN from homeassistant.components.nx584 import binary_sensor as nx584 from homeassistant.core import HomeAssistant from homeassistant.setup import async_setup_component @@ -104,7 +105,13 @@ async def _test_assert_graceful_fail( hass: HomeAssistant, config: dict[str, Any] ) -> None: """Test the failing.""" - assert not await async_setup_component(hass, "nx584", config) + assert await async_setup_component( + hass, + BINARY_SENSOR_DOMAIN, + {BINARY_SENSOR_DOMAIN: {"platform": "nx584", **config}}, + ) + await hass.async_block_till_done() + assert hass.states.async_entity_ids(BINARY_SENSOR_DOMAIN) == [] @pytest.mark.usefixtures("client") @@ -122,6 +129,7 @@ async def test_nx584_sensor_setup_bad_config( ) -> None: """Test the setup with bad configuration.""" await _test_assert_graceful_fail(hass, config) + assert not nx584_client.Client.called @pytest.mark.usefixtures("client")