Add type hints to integration tests (part 13) (#87998)

This commit is contained in:
epenet 2023-02-13 14:38:37 +01:00 committed by GitHub
parent c557cd2b1e
commit ea11a30a35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 798 additions and 404 deletions

View file

@ -3,6 +3,8 @@ from pypck.inputs import Input, ModSendKeysHost, ModStatusAccessControl
from pypck.lcn_addr import LcnAddr
from pypck.lcn_defs import AccessControlPeriphery, KeyAction, SendKeyCommand
from homeassistant.core import HomeAssistant
from tests.common import async_capture_events
LCN_TRANSPONDER = "lcn_transponder"
@ -11,7 +13,7 @@ LCN_TRANSMITTER = "lcn_transmitter"
LCN_SEND_KEYS = "lcn_send_keys"
async def test_fire_transponder_event(hass, lcn_connection):
async def test_fire_transponder_event(hass: HomeAssistant, lcn_connection) -> None:
"""Test the transponder event is fired."""
events = async_capture_events(hass, LCN_TRANSPONDER)
@ -29,7 +31,7 @@ async def test_fire_transponder_event(hass, lcn_connection):
assert events[0].data["code"] == "aabbcc"
async def test_fire_fingerprint_event(hass, lcn_connection):
async def test_fire_fingerprint_event(hass: HomeAssistant, lcn_connection) -> None:
"""Test the fingerprint event is fired."""
events = async_capture_events(hass, LCN_FINGERPRINT)
@ -47,7 +49,7 @@ async def test_fire_fingerprint_event(hass, lcn_connection):
assert events[0].data["code"] == "aabbcc"
async def test_fire_codelock_event(hass, lcn_connection):
async def test_fire_codelock_event(hass: HomeAssistant, lcn_connection) -> None:
"""Test the codelock event is fired."""
events = async_capture_events(hass, "lcn_codelock")
@ -65,7 +67,7 @@ async def test_fire_codelock_event(hass, lcn_connection):
assert events[0].data["code"] == "aabbcc"
async def test_fire_transmitter_event(hass, lcn_connection):
async def test_fire_transmitter_event(hass: HomeAssistant, lcn_connection) -> None:
"""Test the transmitter event is fired."""
events = async_capture_events(hass, LCN_TRANSMITTER)
@ -89,7 +91,7 @@ async def test_fire_transmitter_event(hass, lcn_connection):
assert events[0].data["action"] == "hit"
async def test_fire_sendkeys_event(hass, lcn_connection):
async def test_fire_sendkeys_event(hass: HomeAssistant, lcn_connection) -> None:
"""Test the send_keys event is fired."""
events = async_capture_events(hass, LCN_SEND_KEYS)
@ -117,7 +119,9 @@ async def test_fire_sendkeys_event(hass, lcn_connection):
assert events[3].data["action"] == "make"
async def test_dont_fire_on_non_module_input(hass, lcn_connection):
async def test_dont_fire_on_non_module_input(
hass: HomeAssistant, lcn_connection
) -> None:
"""Test for no event is fired if a non-module input is received."""
inp = Input()
@ -133,7 +137,7 @@ async def test_dont_fire_on_non_module_input(hass, lcn_connection):
assert len(events) == 0
async def test_dont_fire_on_unknown_module(hass, lcn_connection):
async def test_dont_fire_on_unknown_module(hass: HomeAssistant, lcn_connection) -> None:
"""Test for no event is fired if an input from an unknown module is received."""
inp = ModStatusAccessControl(
LcnAddr(0, 10, False), # unknown module