Cleanup devolo Home Control tests (#147051)

This commit is contained in:
Guido Schmitz 2025-06-18 09:24:09 +02:00 committed by GitHub
parent 75d6b885cf
commit 596951ea9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 0 additions and 52 deletions

View File

@ -2,7 +2,6 @@
from unittest.mock import patch from unittest.mock import patch
import pytest
from syrupy.assertion import SnapshotAssertion from syrupy.assertion import SnapshotAssertion
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN 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( async def test_binary_sensor(
hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion
) -> None: ) -> None:
@ -58,7 +56,6 @@ async def test_binary_sensor(
) )
@pytest.mark.usefixtures("mock_zeroconf")
async def test_remote_control( async def test_remote_control(
hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion
) -> None: ) -> None:
@ -99,7 +96,6 @@ async def test_remote_control(
) )
@pytest.mark.usefixtures("mock_zeroconf")
async def test_disabled(hass: HomeAssistant) -> None: async def test_disabled(hass: HomeAssistant) -> None:
"""Test setup of a disabled device.""" """Test setup of a disabled device."""
entry = configure_integration(hass) 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 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: async def test_remove_from_hass(hass: HomeAssistant) -> None:
"""Test removing entity.""" """Test removing entity."""
entry = configure_integration(hass) entry = configure_integration(hass)

View File

@ -66,44 +66,6 @@ async def test_form_already_configured(hass: HomeAssistant) -> None:
assert result["reason"] == "already_configured" 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: async def test_form_zeroconf(hass: HomeAssistant) -> None:
"""Test that the zeroconf confirmation form is served.""" """Test that the zeroconf confirmation form is served."""
result = await hass.config_entries.flow.async_init( result = await hass.config_entries.flow.async_init(

View File

@ -1,7 +1,5 @@
"""Tests for the devolo Home Control diagnostics.""" """Tests for the devolo Home Control diagnostics."""
from __future__ import annotations
from unittest.mock import patch from unittest.mock import patch
from syrupy.assertion import SnapshotAssertion from syrupy.assertion import SnapshotAssertion

View File

@ -19,7 +19,6 @@ from .mocks import HomeControlMock, HomeControlMockBinarySensor
from tests.typing import WebSocketGenerator from tests.typing import WebSocketGenerator
@pytest.mark.usefixtures("mock_zeroconf")
async def test_setup_entry(hass: HomeAssistant) -> None: async def test_setup_entry(hass: HomeAssistant) -> None:
"""Test setup entry.""" """Test setup entry."""
entry = configure_integration(hass) entry = configure_integration(hass)
@ -44,7 +43,6 @@ async def test_setup_entry_maintenance(hass: HomeAssistant) -> None:
assert entry.state is ConfigEntryState.SETUP_RETRY assert entry.state is ConfigEntryState.SETUP_RETRY
@pytest.mark.usefixtures("mock_zeroconf")
async def test_setup_gateway_offline(hass: HomeAssistant) -> None: async def test_setup_gateway_offline(hass: HomeAssistant) -> None:
"""Test setup entry fails on gateway offline.""" """Test setup entry fails on gateway offline."""
entry = configure_integration(hass) entry = configure_integration(hass)

View File

@ -2,7 +2,6 @@
from unittest.mock import patch from unittest.mock import patch
import pytest
from syrupy.assertion import SnapshotAssertion from syrupy.assertion import SnapshotAssertion
from homeassistant.components.siren import DOMAIN as SIREN_DOMAIN from homeassistant.components.siren import DOMAIN as SIREN_DOMAIN
@ -14,7 +13,6 @@ from . import configure_integration
from .mocks import HomeControlMock, HomeControlMockSiren from .mocks import HomeControlMock, HomeControlMockSiren
@pytest.mark.usefixtures("mock_zeroconf")
async def test_siren( async def test_siren(
hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion
) -> None: ) -> None:
@ -45,7 +43,6 @@ async def test_siren(
assert hass.states.get(f"{SIREN_DOMAIN}.test").state == STATE_UNAVAILABLE assert hass.states.get(f"{SIREN_DOMAIN}.test").state == STATE_UNAVAILABLE
@pytest.mark.usefixtures("mock_zeroconf")
async def test_siren_switching( async def test_siren_switching(
hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion
) -> None: ) -> None:
@ -98,7 +95,6 @@ async def test_siren_switching(
property_set.assert_called_once_with(0) property_set.assert_called_once_with(0)
@pytest.mark.usefixtures("mock_zeroconf")
async def test_siren_change_default_tone( async def test_siren_change_default_tone(
hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion
) -> None: ) -> None:
@ -130,7 +126,6 @@ async def test_siren_change_default_tone(
property_set.assert_called_once_with(2) property_set.assert_called_once_with(2)
@pytest.mark.usefixtures("mock_zeroconf")
async def test_remove_from_hass(hass: HomeAssistant) -> None: async def test_remove_from_hass(hass: HomeAssistant) -> None:
"""Test removing entity.""" """Test removing entity."""
entry = configure_integration(hass) entry = configure_integration(hass)