1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Add type hints to integration tests (part 8) (#87982)

This commit is contained in:
epenet
2023-02-13 11:13:48 +01:00
committed by GitHub
parent 575f7c4205
commit 89e4ee5320
50 changed files with 696 additions and 339 deletions

View File

@@ -1,5 +1,4 @@
"""Test the Logitech Harmony Hub remote."""
from datetime import timedelta
from aioharmony.const import SendCommandDevice
@@ -30,6 +29,7 @@ from homeassistant.const import (
STATE_ON,
STATE_UNAVAILABLE,
)
from homeassistant.core import HomeAssistant
from homeassistant.util import utcnow
from .conftest import ACTIVITIES_TO_IDS, TV_DEVICE_ID, TV_DEVICE_NAME
@@ -42,8 +42,8 @@ STOP_COMMAND = "Stop"
async def test_connection_state_changes(
harmony_client, mock_hc, hass, mock_write_config
):
harmony_client, mock_hc, hass: HomeAssistant, mock_write_config
) -> None:
"""Ensure connection changes are reflected in the remote state."""
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_HOST: "192.0.2.0", CONF_NAME: HUB_NAME}
@@ -81,7 +81,7 @@ async def test_connection_state_changes(
assert hass.states.is_state(ENTITY_REMOTE, STATE_ON)
async def test_remote_toggles(mock_hc, hass, mock_write_config):
async def test_remote_toggles(mock_hc, hass: HomeAssistant, mock_write_config) -> None:
"""Ensure calls to the remote also updates the switches."""
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_HOST: "192.0.2.0", CONF_NAME: HUB_NAME}
@@ -149,7 +149,9 @@ async def test_remote_toggles(mock_hc, hass, mock_write_config):
assert state.attributes.get("current_activity") == "Watch TV"
async def test_async_send_command(mock_hc, harmony_client, hass, mock_write_config):
async def test_async_send_command(
mock_hc, harmony_client, hass: HomeAssistant, mock_write_config
) -> None:
"""Ensure calls to send remote commands properly propagate to devices."""
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_HOST: "192.0.2.0", CONF_NAME: HUB_NAME}
@@ -282,8 +284,8 @@ async def test_async_send_command(mock_hc, harmony_client, hass, mock_write_conf
async def test_async_send_command_custom_delay(
mock_hc, harmony_client, hass, mock_write_config
):
mock_hc, harmony_client, hass: HomeAssistant, mock_write_config
) -> None:
"""Ensure calls to send remote commands properly propagate to devices with custom delays."""
entry = MockConfigEntry(
domain=DOMAIN,
@@ -323,7 +325,9 @@ async def test_async_send_command_custom_delay(
send_commands_mock.reset_mock()
async def test_change_channel(mock_hc, harmony_client, hass, mock_write_config):
async def test_change_channel(
mock_hc, harmony_client, hass: HomeAssistant, mock_write_config
) -> None:
"""Test change channel commands."""
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_HOST: "192.0.2.0", CONF_NAME: HUB_NAME}
@@ -347,7 +351,9 @@ async def test_change_channel(mock_hc, harmony_client, hass, mock_write_config):
change_channel_mock.assert_awaited_once_with(100)
async def test_sync(mock_hc, harmony_client, mock_write_config, hass):
async def test_sync(
mock_hc, harmony_client, mock_write_config, hass: HomeAssistant
) -> None:
"""Test the sync command."""
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_HOST: "192.0.2.0", CONF_NAME: HUB_NAME}