From f4bcbbabf52d27ba97562fa85a60d303156a68be Mon Sep 17 00:00:00 2001 From: Michael <35783820+mib1185@users.noreply.github.com> Date: Tue, 15 Oct 2024 21:17:21 +0200 Subject: [PATCH] =?UTF-8?q?Revert=20"Remove=20obsolete=20entity=20count=20?= =?UTF-8?q?safeguards=20when=20using=20`snapshot=5Fplatform=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 808d93d767859a3ce5d0ea27e6f06727435d8acf. --- tests/components/axis/test_binary_sensor.py | 1 + tests/components/fritz/test_button.py | 3 +++ tests/components/fritz/test_sensor.py | 3 +++ tests/components/fritz/test_update.py | 9 +++++++++ tests/components/israel_rail/test_sensor.py | 1 + tests/components/nextcloud/test_binary_sensor.py | 3 +++ tests/components/nextcloud/test_sensor.py | 3 +++ tests/components/nextcloud/test_update.py | 3 +++ 8 files changed, 26 insertions(+) diff --git a/tests/components/axis/test_binary_sensor.py b/tests/components/axis/test_binary_sensor.py index 766a51463a4..a1cf1e129d5 100644 --- a/tests/components/axis/test_binary_sensor.py +++ b/tests/components/axis/test_binary_sensor.py @@ -119,6 +119,7 @@ async def test_binary_sensors( with patch("homeassistant.components.axis.PLATFORMS", [Platform.BINARY_SENSOR]): config_entry = await config_entry_factory() mock_rtsp_event(**event) + assert len(hass.states.async_entity_ids(BINARY_SENSOR_DOMAIN)) == 1 await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id) diff --git a/tests/components/fritz/test_button.py b/tests/components/fritz/test_button.py index 068b07c4337..507331cde0b 100644 --- a/tests/components/fritz/test_button.py +++ b/tests/components/fritz/test_button.py @@ -42,6 +42,9 @@ async def test_button_setup( assert await hass.config_entries.async_setup(entry.entry_id) await hass.async_block_till_done() + states = hass.states.async_all() + assert len(states) == 5 + await snapshot_platform(hass, entity_registry, snapshot, entry.entry_id) diff --git a/tests/components/fritz/test_sensor.py b/tests/components/fritz/test_sensor.py index 77deb665f5e..fcdb4b63450 100644 --- a/tests/components/fritz/test_sensor.py +++ b/tests/components/fritz/test_sensor.py @@ -39,6 +39,9 @@ async def test_sensor_setup( assert await hass.config_entries.async_setup(entry.entry_id) await hass.async_block_till_done() + states = hass.states.async_all() + assert len(states) == 16 + await snapshot_platform(hass, entity_registry, snapshot, entry.entry_id) diff --git a/tests/components/fritz/test_update.py b/tests/components/fritz/test_update.py index 72997b1aa12..cca5decbcc4 100644 --- a/tests/components/fritz/test_update.py +++ b/tests/components/fritz/test_update.py @@ -46,6 +46,9 @@ async def test_update_entities_initialized( assert await hass.config_entries.async_setup(entry.entry_id) await hass.async_block_till_done() + states = hass.states.async_all() + assert len(states) == 1 + await snapshot_platform(hass, entity_registry, snapshot, entry.entry_id) @@ -68,6 +71,9 @@ async def test_update_available( assert await hass.config_entries.async_setup(entry.entry_id) await hass.async_block_till_done() + states = hass.states.async_all() + assert len(states) == 1 + await snapshot_platform(hass, entity_registry, snapshot, entry.entry_id) @@ -96,6 +102,9 @@ async def test_available_update_can_be_installed( assert await hass.config_entries.async_setup(entry.entry_id) await hass.async_block_till_done() + states = hass.states.async_all() + assert len(states) == 1 + await snapshot_platform(hass, entity_registry, snapshot, entry.entry_id) await hass.services.async_call( diff --git a/tests/components/israel_rail/test_sensor.py b/tests/components/israel_rail/test_sensor.py index 85b7328742f..d044dfe1d7c 100644 --- a/tests/components/israel_rail/test_sensor.py +++ b/tests/components/israel_rail/test_sensor.py @@ -26,6 +26,7 @@ async def test_valid_config( ) -> None: """Ensure everything starts correctly.""" await init_integration(hass, mock_config_entry) + assert len(hass.states.async_entity_ids()) == 6 await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id) diff --git a/tests/components/nextcloud/test_binary_sensor.py b/tests/components/nextcloud/test_binary_sensor.py index dd53f4fb2cf..ff121c53ec3 100644 --- a/tests/components/nextcloud/test_binary_sensor.py +++ b/tests/components/nextcloud/test_binary_sensor.py @@ -27,4 +27,7 @@ async def test_async_setup_entry( ): entry = await init_integration(hass, VALID_CONFIG, NC_DATA) + states = hass.states.async_all() + assert len(states) == 6 + await snapshot_platform(hass, entity_registry, snapshot, entry.entry_id) diff --git a/tests/components/nextcloud/test_sensor.py b/tests/components/nextcloud/test_sensor.py index 2ccaf2b7770..1ea2c87db11 100644 --- a/tests/components/nextcloud/test_sensor.py +++ b/tests/components/nextcloud/test_sensor.py @@ -25,4 +25,7 @@ async def test_async_setup_entry( with patch("homeassistant.components.nextcloud.PLATFORMS", [Platform.SENSOR]): entry = await init_integration(hass, VALID_CONFIG, NC_DATA) + states = hass.states.async_all() + assert len(states) == 80 + await snapshot_platform(hass, entity_registry, snapshot, entry.entry_id) diff --git a/tests/components/nextcloud/test_update.py b/tests/components/nextcloud/test_update.py index ed9b65ee55f..d47c9f1df53 100644 --- a/tests/components/nextcloud/test_update.py +++ b/tests/components/nextcloud/test_update.py @@ -26,6 +26,9 @@ async def test_async_setup_entry( with patch("homeassistant.components.nextcloud.PLATFORMS", [Platform.UPDATE]): entry = await init_integration(hass, VALID_CONFIG, NC_DATA) + states = hass.states.async_all() + assert len(states) == 1 + await snapshot_platform(hass, entity_registry, snapshot, entry.entry_id)