From 596951ea9fbb9dd80759a6d55898d0aec6728080 Mon Sep 17 00:00:00 2001 From: Guido Schmitz Date: Wed, 18 Jun 2025 09:24:09 +0200 Subject: [PATCH] Cleanup devolo Home Control tests (#147051) --- .../devolo_home_control/test_binary_sensor.py | 5 --- .../devolo_home_control/test_config_flow.py | 38 ------------------- .../devolo_home_control/test_diagnostics.py | 2 - .../devolo_home_control/test_init.py | 2 - .../devolo_home_control/test_siren.py | 5 --- 5 files changed, 52 deletions(-) diff --git a/tests/components/devolo_home_control/test_binary_sensor.py b/tests/components/devolo_home_control/test_binary_sensor.py index fd28ce2fdf6..b2a58ef5038 100644 --- a/tests/components/devolo_home_control/test_binary_sensor.py +++ b/tests/components/devolo_home_control/test_binary_sensor.py @@ -2,7 +2,6 @@ from unittest.mock import patch -import pytest from syrupy.assertion import SnapshotAssertion from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN @@ -19,7 +18,6 @@ from .mocks import ( ) -@pytest.mark.usefixtures("mock_zeroconf") async def test_binary_sensor( hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion ) -> None: @@ -58,7 +56,6 @@ async def test_binary_sensor( ) -@pytest.mark.usefixtures("mock_zeroconf") async def test_remote_control( hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion ) -> None: @@ -99,7 +96,6 @@ async def test_remote_control( ) -@pytest.mark.usefixtures("mock_zeroconf") async def test_disabled(hass: HomeAssistant) -> None: """Test setup of a disabled device.""" entry = configure_integration(hass) @@ -113,7 +109,6 @@ async def test_disabled(hass: HomeAssistant) -> None: assert hass.states.get(f"{BINARY_SENSOR_DOMAIN}.test_door") is None -@pytest.mark.usefixtures("mock_zeroconf") async def test_remove_from_hass(hass: HomeAssistant) -> None: """Test removing entity.""" entry = configure_integration(hass) diff --git a/tests/components/devolo_home_control/test_config_flow.py b/tests/components/devolo_home_control/test_config_flow.py index aab3e69b38f..9367d746d2e 100644 --- a/tests/components/devolo_home_control/test_config_flow.py +++ b/tests/components/devolo_home_control/test_config_flow.py @@ -66,44 +66,6 @@ async def test_form_already_configured(hass: HomeAssistant) -> None: assert result["reason"] == "already_configured" -async def test_form_advanced_options(hass: HomeAssistant) -> None: - """Test if we get the advanced options if user has enabled it.""" - result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": config_entries.SOURCE_USER, "show_advanced_options": True}, - ) - assert result["type"] is FlowResultType.FORM - assert result["errors"] == {} - - with ( - patch( - "homeassistant.components.devolo_home_control.async_setup_entry", - return_value=True, - ) as mock_setup_entry, - patch( - "homeassistant.components.devolo_home_control.Mydevolo.uuid", - return_value="123456", - ), - ): - result2 = await hass.config_entries.flow.async_configure( - result["flow_id"], - { - "username": "test-username", - "password": "test-password", - }, - ) - await hass.async_block_till_done() - - assert result2["type"] is FlowResultType.CREATE_ENTRY - assert result2["title"] == "devolo Home Control" - assert result2["data"] == { - "username": "test-username", - "password": "test-password", - } - - assert len(mock_setup_entry.mock_calls) == 1 - - async def test_form_zeroconf(hass: HomeAssistant) -> None: """Test that the zeroconf confirmation form is served.""" result = await hass.config_entries.flow.async_init( diff --git a/tests/components/devolo_home_control/test_diagnostics.py b/tests/components/devolo_home_control/test_diagnostics.py index dfadc4d1c4b..558ed6394fa 100644 --- a/tests/components/devolo_home_control/test_diagnostics.py +++ b/tests/components/devolo_home_control/test_diagnostics.py @@ -1,7 +1,5 @@ """Tests for the devolo Home Control diagnostics.""" -from __future__ import annotations - from unittest.mock import patch from syrupy.assertion import SnapshotAssertion diff --git a/tests/components/devolo_home_control/test_init.py b/tests/components/devolo_home_control/test_init.py index da007303688..fb97447264d 100644 --- a/tests/components/devolo_home_control/test_init.py +++ b/tests/components/devolo_home_control/test_init.py @@ -19,7 +19,6 @@ from .mocks import HomeControlMock, HomeControlMockBinarySensor from tests.typing import WebSocketGenerator -@pytest.mark.usefixtures("mock_zeroconf") async def test_setup_entry(hass: HomeAssistant) -> None: """Test setup entry.""" entry = configure_integration(hass) @@ -44,7 +43,6 @@ async def test_setup_entry_maintenance(hass: HomeAssistant) -> None: assert entry.state is ConfigEntryState.SETUP_RETRY -@pytest.mark.usefixtures("mock_zeroconf") async def test_setup_gateway_offline(hass: HomeAssistant) -> None: """Test setup entry fails on gateway offline.""" entry = configure_integration(hass) diff --git a/tests/components/devolo_home_control/test_siren.py b/tests/components/devolo_home_control/test_siren.py index 71f4dfdd34d..7c943e05cef 100644 --- a/tests/components/devolo_home_control/test_siren.py +++ b/tests/components/devolo_home_control/test_siren.py @@ -2,7 +2,6 @@ from unittest.mock import patch -import pytest from syrupy.assertion import SnapshotAssertion from homeassistant.components.siren import DOMAIN as SIREN_DOMAIN @@ -14,7 +13,6 @@ from . import configure_integration from .mocks import HomeControlMock, HomeControlMockSiren -@pytest.mark.usefixtures("mock_zeroconf") async def test_siren( hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion ) -> None: @@ -45,7 +43,6 @@ async def test_siren( assert hass.states.get(f"{SIREN_DOMAIN}.test").state == STATE_UNAVAILABLE -@pytest.mark.usefixtures("mock_zeroconf") async def test_siren_switching( hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion ) -> None: @@ -98,7 +95,6 @@ async def test_siren_switching( property_set.assert_called_once_with(0) -@pytest.mark.usefixtures("mock_zeroconf") async def test_siren_change_default_tone( hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion ) -> None: @@ -130,7 +126,6 @@ async def test_siren_change_default_tone( property_set.assert_called_once_with(2) -@pytest.mark.usefixtures("mock_zeroconf") async def test_remove_from_hass(hass: HomeAssistant) -> None: """Test removing entity.""" entry = configure_integration(hass)