Add type hints to integration tests (part 9) (#87983)

This commit is contained in:
epenet
2023-02-13 12:06:51 +01:00
committed by GitHub
parent 6359775cfc
commit 03710e58b5
63 changed files with 1526 additions and 781 deletions

View File

@@ -2,6 +2,7 @@
from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.services import ServicesTypes
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from .common import get_next_aid, setup_test_component
@@ -54,7 +55,7 @@ def create_window_covering_service_with_v_tilt(accessory):
tilt_target.value = 0
async def test_change_window_cover_state(hass, utcnow):
async def test_change_window_cover_state(hass: HomeAssistant, utcnow) -> None:
"""Test that we can turn a HomeKit alarm on and off again."""
helper = await setup_test_component(hass, create_window_covering_service)
@@ -79,7 +80,7 @@ async def test_change_window_cover_state(hass, utcnow):
)
async def test_read_window_cover_state(hass, utcnow):
async def test_read_window_cover_state(hass: HomeAssistant, utcnow) -> None:
"""Test that we can read the state of a HomeKit alarm accessory."""
helper = await setup_test_component(hass, create_window_covering_service)
@@ -112,7 +113,7 @@ async def test_read_window_cover_state(hass, utcnow):
assert state.attributes["obstruction-detected"] is True
async def test_read_window_cover_tilt_horizontal(hass, utcnow):
async def test_read_window_cover_tilt_horizontal(hass: HomeAssistant, utcnow) -> None:
"""Test that horizontal tilt is handled correctly."""
helper = await setup_test_component(
hass, create_window_covering_service_with_h_tilt
@@ -126,7 +127,7 @@ async def test_read_window_cover_tilt_horizontal(hass, utcnow):
assert state.attributes["current_tilt_position"] == 75
async def test_read_window_cover_tilt_vertical(hass, utcnow):
async def test_read_window_cover_tilt_vertical(hass: HomeAssistant, utcnow) -> None:
"""Test that vertical tilt is handled correctly."""
helper = await setup_test_component(
hass, create_window_covering_service_with_v_tilt
@@ -140,7 +141,7 @@ async def test_read_window_cover_tilt_vertical(hass, utcnow):
assert state.attributes["current_tilt_position"] == 75
async def test_write_window_cover_tilt_horizontal(hass, utcnow):
async def test_write_window_cover_tilt_horizontal(hass: HomeAssistant, utcnow) -> None:
"""Test that horizontal tilt is written correctly."""
helper = await setup_test_component(
hass, create_window_covering_service_with_h_tilt
@@ -160,7 +161,7 @@ async def test_write_window_cover_tilt_horizontal(hass, utcnow):
)
async def test_write_window_cover_tilt_vertical(hass, utcnow):
async def test_write_window_cover_tilt_vertical(hass: HomeAssistant, utcnow) -> None:
"""Test that vertical tilt is written correctly."""
helper = await setup_test_component(
hass, create_window_covering_service_with_v_tilt
@@ -180,7 +181,7 @@ async def test_write_window_cover_tilt_vertical(hass, utcnow):
)
async def test_window_cover_stop(hass, utcnow):
async def test_window_cover_stop(hass: HomeAssistant, utcnow) -> None:
"""Test that vertical tilt is written correctly."""
helper = await setup_test_component(
hass, create_window_covering_service_with_v_tilt
@@ -216,7 +217,7 @@ def create_garage_door_opener_service(accessory):
return service
async def test_change_door_state(hass, utcnow):
async def test_change_door_state(hass: HomeAssistant, utcnow) -> None:
"""Test that we can turn open and close a HomeKit garage door."""
helper = await setup_test_component(hass, create_garage_door_opener_service)
@@ -241,7 +242,7 @@ async def test_change_door_state(hass, utcnow):
)
async def test_read_door_state(hass, utcnow):
async def test_read_door_state(hass: HomeAssistant, utcnow) -> None:
"""Test that we can read the state of a HomeKit garage door."""
helper = await setup_test_component(hass, create_garage_door_opener_service)
@@ -281,7 +282,7 @@ async def test_read_door_state(hass, utcnow):
assert state.attributes["obstruction-detected"] is True
async def test_migrate_unique_id(hass, utcnow):
async def test_migrate_unique_id(hass: HomeAssistant, utcnow) -> None:
"""Test a we can migrate a cover unique id."""
entity_registry = er.async_get(hass)
aid = get_next_aid()