mirror of
https://github.com/home-assistant/core.git
synced 2025-11-12 20:40:18 +00:00
Add type hints to integration tests (part 18) (#88174)
This commit is contained in:
@@ -12,7 +12,7 @@ from homeassistant.const import (
|
||||
STATE_CLOSED,
|
||||
STATE_OPEN,
|
||||
)
|
||||
from homeassistant.core import CoreState, State, callback
|
||||
from homeassistant.core import CoreState, HomeAssistant, State, callback
|
||||
|
||||
from .test_init import mock_rflink
|
||||
|
||||
@@ -36,7 +36,7 @@ CONFIG = {
|
||||
}
|
||||
|
||||
|
||||
async def test_default_setup(hass, monkeypatch):
|
||||
async def test_default_setup(hass: HomeAssistant, monkeypatch) -> None:
|
||||
"""Test all basic functionality of the RFLink cover component."""
|
||||
# setup mocking rflink module
|
||||
event_callback, create, protocol, _ = await mock_rflink(
|
||||
@@ -106,7 +106,7 @@ async def test_default_setup(hass, monkeypatch):
|
||||
assert protocol.send_command_ack.call_args_list[1][0][1] == "UP"
|
||||
|
||||
|
||||
async def test_firing_bus_event(hass, monkeypatch):
|
||||
async def test_firing_bus_event(hass: HomeAssistant, monkeypatch) -> None:
|
||||
"""Incoming RFLink command events should be put on the HA event bus."""
|
||||
config = {
|
||||
"rflink": {"port": "/dev/ttyABC0"},
|
||||
@@ -141,7 +141,7 @@ async def test_firing_bus_event(hass, monkeypatch):
|
||||
assert calls[0].data == {"state": "down", "entity_id": f"{DOMAIN}.test"}
|
||||
|
||||
|
||||
async def test_signal_repetitions(hass, monkeypatch):
|
||||
async def test_signal_repetitions(hass: HomeAssistant, monkeypatch) -> None:
|
||||
"""Command should be sent amount of configured repetitions."""
|
||||
config = {
|
||||
"rflink": {"port": "/dev/ttyABC0"},
|
||||
@@ -179,7 +179,7 @@ async def test_signal_repetitions(hass, monkeypatch):
|
||||
assert protocol.send_command_ack.call_count == 5
|
||||
|
||||
|
||||
async def test_signal_repetitions_alternation(hass, monkeypatch):
|
||||
async def test_signal_repetitions_alternation(hass: HomeAssistant, monkeypatch) -> None:
|
||||
"""Simultaneously switching entities must alternate repetitions."""
|
||||
config = {
|
||||
"rflink": {"port": "/dev/ttyABC0"},
|
||||
@@ -210,7 +210,7 @@ async def test_signal_repetitions_alternation(hass, monkeypatch):
|
||||
assert protocol.send_command_ack.call_args_list[3][0][0] == "protocol_0_1"
|
||||
|
||||
|
||||
async def test_signal_repetitions_cancelling(hass, monkeypatch):
|
||||
async def test_signal_repetitions_cancelling(hass: HomeAssistant, monkeypatch) -> None:
|
||||
"""Cancel outstanding repetitions when state changed."""
|
||||
config = {
|
||||
"rflink": {"port": "/dev/ttyABC0"},
|
||||
@@ -239,7 +239,7 @@ async def test_signal_repetitions_cancelling(hass, monkeypatch):
|
||||
assert protocol.send_command_ack.call_args_list[3][0][1] == "UP"
|
||||
|
||||
|
||||
async def test_group_alias(hass, monkeypatch):
|
||||
async def test_group_alias(hass: HomeAssistant, monkeypatch) -> None:
|
||||
"""Group aliases should only respond to group commands (allon/alloff)."""
|
||||
config = {
|
||||
"rflink": {"port": "/dev/ttyABC0"},
|
||||
@@ -269,7 +269,7 @@ async def test_group_alias(hass, monkeypatch):
|
||||
assert hass.states.get(f"{DOMAIN}.test").state == STATE_OPEN
|
||||
|
||||
|
||||
async def test_nogroup_alias(hass, monkeypatch):
|
||||
async def test_nogroup_alias(hass: HomeAssistant, monkeypatch) -> None:
|
||||
"""Non group aliases should not respond to group commands."""
|
||||
config = {
|
||||
"rflink": {"port": "/dev/ttyABC0"},
|
||||
@@ -302,7 +302,7 @@ async def test_nogroup_alias(hass, monkeypatch):
|
||||
assert hass.states.get(f"{DOMAIN}.test").state == STATE_OPEN
|
||||
|
||||
|
||||
async def test_nogroup_device_id(hass, monkeypatch):
|
||||
async def test_nogroup_device_id(hass: HomeAssistant, monkeypatch) -> None:
|
||||
"""Device id that do not respond to group commands (allon/alloff)."""
|
||||
config = {
|
||||
"rflink": {"port": "/dev/ttyABC0"},
|
||||
@@ -330,7 +330,7 @@ async def test_nogroup_device_id(hass, monkeypatch):
|
||||
assert hass.states.get(f"{DOMAIN}.test").state == STATE_OPEN
|
||||
|
||||
|
||||
async def test_restore_state(hass, monkeypatch):
|
||||
async def test_restore_state(hass: HomeAssistant, monkeypatch) -> None:
|
||||
"""Ensure states are restored on startup."""
|
||||
config = {
|
||||
"rflink": {"port": "/dev/ttyABC0"},
|
||||
@@ -376,7 +376,7 @@ async def test_restore_state(hass, monkeypatch):
|
||||
# The code checks the ID, it will use the
|
||||
# 'inverted' class when the name starts with
|
||||
# 'newkaku'
|
||||
async def test_inverted_cover(hass, monkeypatch):
|
||||
async def test_inverted_cover(hass: HomeAssistant, monkeypatch) -> None:
|
||||
"""Ensure states are restored on startup."""
|
||||
config = {
|
||||
"rflink": {"port": "/dev/ttyABC0"},
|
||||
|
||||
Reference in New Issue
Block a user