Add monkeypatch type hints to switcher_kis tests (#121055)
* Add monkeypatch type hints to switch_kis * Improve
This commit is contained in:
parent
7958c0825e
commit
c9240b8e34
7 changed files with 31 additions and 17 deletions
|
@ -63,7 +63,12 @@ async def test_assume_button(
|
|||
)
|
||||
@pytest.mark.parametrize("mock_bridge", [[DEVICE]], indirect=True)
|
||||
async def test_swing_button(
|
||||
hass: HomeAssistant, entity, swing, mock_bridge, mock_api, monkeypatch
|
||||
hass: HomeAssistant,
|
||||
entity,
|
||||
swing,
|
||||
mock_bridge,
|
||||
mock_api,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
"""Test vertical swing on/off button."""
|
||||
monkeypatch.setattr(DEVICE, "remote_id", "ELEC7022")
|
||||
|
@ -88,7 +93,7 @@ async def test_swing_button(
|
|||
|
||||
@pytest.mark.parametrize("mock_bridge", [[DEVICE]], indirect=True)
|
||||
async def test_control_device_fail(
|
||||
hass: HomeAssistant, mock_bridge, mock_api, monkeypatch
|
||||
hass: HomeAssistant, mock_bridge, mock_api, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
"""Test control device fail."""
|
||||
await init_integration(hass)
|
||||
|
|
|
@ -37,7 +37,7 @@ ENTITY_ID = f"{CLIMATE_DOMAIN}.{slugify(DEVICE.name)}"
|
|||
|
||||
@pytest.mark.parametrize("mock_bridge", [[DEVICE]], indirect=True)
|
||||
async def test_climate_hvac_mode(
|
||||
hass: HomeAssistant, mock_bridge, mock_api, monkeypatch
|
||||
hass: HomeAssistant, mock_bridge, mock_api, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
"""Test climate hvac mode service."""
|
||||
await init_integration(hass)
|
||||
|
@ -92,7 +92,7 @@ async def test_climate_hvac_mode(
|
|||
|
||||
@pytest.mark.parametrize("mock_bridge", [[DEVICE]], indirect=True)
|
||||
async def test_climate_temperature(
|
||||
hass: HomeAssistant, mock_bridge, mock_api, monkeypatch
|
||||
hass: HomeAssistant, mock_bridge, mock_api, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
"""Test climate temperature service."""
|
||||
await init_integration(hass)
|
||||
|
@ -144,7 +144,7 @@ async def test_climate_temperature(
|
|||
|
||||
@pytest.mark.parametrize("mock_bridge", [[DEVICE]], indirect=True)
|
||||
async def test_climate_fan_level(
|
||||
hass: HomeAssistant, mock_bridge, mock_api, monkeypatch
|
||||
hass: HomeAssistant, mock_bridge, mock_api, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
"""Test climate fan level service."""
|
||||
await init_integration(hass)
|
||||
|
@ -179,7 +179,7 @@ async def test_climate_fan_level(
|
|||
|
||||
@pytest.mark.parametrize("mock_bridge", [[DEVICE]], indirect=True)
|
||||
async def test_climate_swing(
|
||||
hass: HomeAssistant, mock_bridge, mock_api, monkeypatch
|
||||
hass: HomeAssistant, mock_bridge, mock_api, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
"""Test climate swing service."""
|
||||
await init_integration(hass)
|
||||
|
@ -234,9 +234,7 @@ async def test_climate_swing(
|
|||
|
||||
|
||||
@pytest.mark.parametrize("mock_bridge", [[DEVICE]], indirect=True)
|
||||
async def test_control_device_fail(
|
||||
hass: HomeAssistant, mock_bridge, mock_api, monkeypatch
|
||||
) -> None:
|
||||
async def test_control_device_fail(hass: HomeAssistant, mock_bridge, mock_api) -> None:
|
||||
"""Test control device fail."""
|
||||
await init_integration(hass)
|
||||
assert mock_bridge
|
||||
|
@ -295,7 +293,7 @@ async def test_control_device_fail(
|
|||
|
||||
@pytest.mark.parametrize("mock_bridge", [[DEVICE]], indirect=True)
|
||||
async def test_bad_update_discard(
|
||||
hass: HomeAssistant, mock_bridge, mock_api, monkeypatch
|
||||
hass: HomeAssistant, mock_bridge, mock_api, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
"""Test that a bad update from device is discarded."""
|
||||
await init_integration(hass)
|
||||
|
@ -318,7 +316,7 @@ async def test_bad_update_discard(
|
|||
|
||||
@pytest.mark.parametrize("mock_bridge", [[DEVICE]], indirect=True)
|
||||
async def test_climate_control_errors(
|
||||
hass: HomeAssistant, mock_bridge, mock_api, monkeypatch
|
||||
hass: HomeAssistant, mock_bridge, mock_api, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
"""Test control with settings not supported by device."""
|
||||
await init_integration(hass)
|
||||
|
|
|
@ -31,7 +31,9 @@ ENTITY_ID = f"{COVER_DOMAIN}.{slugify(DEVICE.name)}"
|
|||
|
||||
|
||||
@pytest.mark.parametrize("mock_bridge", [[DEVICE]], indirect=True)
|
||||
async def test_cover(hass: HomeAssistant, mock_bridge, mock_api, monkeypatch) -> None:
|
||||
async def test_cover(
|
||||
hass: HomeAssistant, mock_bridge, mock_api, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
"""Test cover services."""
|
||||
await init_integration(hass)
|
||||
assert mock_bridge
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
"""Tests for the diagnostics data provided by Switcher."""
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
|
@ -11,7 +13,10 @@ from tests.typing import ClientSessionGenerator
|
|||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant, hass_client: ClientSessionGenerator, mock_bridge, monkeypatch
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
mock_bridge,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
"""Test diagnostics."""
|
||||
entry = await init_integration(hass)
|
||||
|
|
|
@ -74,7 +74,9 @@ async def test_sensor_disabled(
|
|||
|
||||
|
||||
@pytest.mark.parametrize("mock_bridge", [[DUMMY_WATER_HEATER_DEVICE]], indirect=True)
|
||||
async def test_sensor_update(hass: HomeAssistant, mock_bridge, monkeypatch) -> None:
|
||||
async def test_sensor_update(
|
||||
hass: HomeAssistant, mock_bridge, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
"""Test sensor update."""
|
||||
await init_integration(hass)
|
||||
assert mock_bridge
|
||||
|
|
|
@ -30,7 +30,7 @@ from .consts import (
|
|||
|
||||
@pytest.mark.parametrize("mock_bridge", [[DUMMY_WATER_HEATER_DEVICE]], indirect=True)
|
||||
async def test_turn_on_with_timer_service(
|
||||
hass: HomeAssistant, mock_bridge, mock_api, monkeypatch
|
||||
hass: HomeAssistant, mock_bridge, mock_api, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
"""Test the turn on with timer service."""
|
||||
await init_integration(hass)
|
||||
|
|
|
@ -23,7 +23,9 @@ from .consts import DUMMY_PLUG_DEVICE, DUMMY_WATER_HEATER_DEVICE
|
|||
|
||||
|
||||
@pytest.mark.parametrize("mock_bridge", [[DUMMY_WATER_HEATER_DEVICE]], indirect=True)
|
||||
async def test_switch(hass: HomeAssistant, mock_bridge, mock_api, monkeypatch) -> None:
|
||||
async def test_switch(
|
||||
hass: HomeAssistant, mock_bridge, mock_api, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
"""Test the switch."""
|
||||
await init_integration(hass)
|
||||
assert mock_bridge
|
||||
|
@ -75,7 +77,7 @@ async def test_switch_control_fail(
|
|||
hass: HomeAssistant,
|
||||
mock_bridge,
|
||||
mock_api,
|
||||
monkeypatch,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Test switch control fail."""
|
||||
|
|
Loading…
Add table
Reference in a new issue