mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Cleanup devolo Home Control tests (#147051)
This commit is contained in:
parent
75d6b885cf
commit
596951ea9f
@ -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)
|
||||
|
@ -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(
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user