Add type hints to integration tests (#88476)
parent
5f25b71df7
commit
ec5c3d6330
|
@ -37,8 +37,8 @@ pytestmark = pytest.mark.usefixtures("init_integration")
|
|||
)
|
||||
async def test_light_state_temperature(
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceEntry,
|
||||
entity_registry: er.RegistryEntry,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test the creation and values of the Elgato Lights in temperature mode."""
|
||||
|
|
|
@ -22,7 +22,7 @@ import homeassistant.util.dt as dt_util
|
|||
from tests.common import async_fire_time_changed, get_fixture_path
|
||||
|
||||
|
||||
async def test_setup(recorder_mock, hass):
|
||||
async def test_setup(recorder_mock: Recorder, hass: HomeAssistant) -> None:
|
||||
"""Test the history statistics sensor setup."""
|
||||
|
||||
config = {
|
||||
|
@ -44,7 +44,9 @@ async def test_setup(recorder_mock, hass):
|
|||
assert state.state == "0.0"
|
||||
|
||||
|
||||
async def test_setup_multiple_states(recorder_mock, hass):
|
||||
async def test_setup_multiple_states(
|
||||
recorder_mock: Recorder, hass: HomeAssistant
|
||||
) -> None:
|
||||
"""Test the history statistics sensor setup for multiple states."""
|
||||
|
||||
config = {
|
||||
|
@ -95,7 +97,7 @@ async def test_setup_multiple_states(recorder_mock, hass):
|
|||
},
|
||||
],
|
||||
)
|
||||
def test_setup_invalid_config(config):
|
||||
def test_setup_invalid_config(config) -> None:
|
||||
"""Test the history statistics sensor setup with invalid config."""
|
||||
|
||||
with pytest.raises(vol.Invalid):
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
"""Test the Insteon Scenes APIs."""
|
||||
|
||||
import json
|
||||
import os
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
@ -10,10 +9,12 @@ import pytest
|
|||
|
||||
from homeassistant.components.insteon.api import async_load_api, scenes
|
||||
from homeassistant.components.insteon.const import ID, TYPE
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .mock_devices import MockDevices
|
||||
|
||||
from tests.common import load_fixture
|
||||
from tests.typing import WebSocketGenerator
|
||||
|
||||
|
||||
@pytest.fixture(name="scene_data", scope="session")
|
||||
|
@ -58,7 +59,9 @@ async def _setup(hass, hass_ws_client, scene_data):
|
|||
return ws_client, devices
|
||||
|
||||
|
||||
async def test_get_scenes(hass, hass_ws_client, scene_data):
|
||||
async def test_get_scenes(
|
||||
hass: HomeAssistant, hass_ws_client: WebSocketGenerator, scene_data
|
||||
) -> None:
|
||||
"""Test getting all Insteon scenes."""
|
||||
ws_client, devices = await _setup(hass, hass_ws_client, scene_data)
|
||||
|
||||
|
@ -70,7 +73,9 @@ async def test_get_scenes(hass, hass_ws_client, scene_data):
|
|||
assert len(result["20"]) == 3
|
||||
|
||||
|
||||
async def test_get_scene(hass, hass_ws_client, scene_data):
|
||||
async def test_get_scene(
|
||||
hass: HomeAssistant, hass_ws_client: WebSocketGenerator, scene_data
|
||||
) -> None:
|
||||
"""Test getting an Insteon scene."""
|
||||
ws_client, devices = await _setup(hass, hass_ws_client, scene_data)
|
||||
|
||||
|
@ -81,7 +86,9 @@ async def test_get_scene(hass, hass_ws_client, scene_data):
|
|||
assert len(result["devices"]) == 3
|
||||
|
||||
|
||||
async def test_save_scene(hass, hass_ws_client, scene_data, remove_json):
|
||||
async def test_save_scene(
|
||||
hass: HomeAssistant, hass_ws_client: WebSocketGenerator, scene_data, remove_json
|
||||
) -> None:
|
||||
"""Test saving an Insteon scene."""
|
||||
ws_client, devices = await _setup(hass, hass_ws_client, scene_data)
|
||||
|
||||
|
@ -108,7 +115,9 @@ async def test_save_scene(hass, hass_ws_client, scene_data, remove_json):
|
|||
assert result["scene_id"] == 20
|
||||
|
||||
|
||||
async def test_save_new_scene(hass, hass_ws_client, scene_data, remove_json):
|
||||
async def test_save_new_scene(
|
||||
hass: HomeAssistant, hass_ws_client: WebSocketGenerator, scene_data, remove_json
|
||||
) -> None:
|
||||
"""Test saving a new Insteon scene."""
|
||||
ws_client, devices = await _setup(hass, hass_ws_client, scene_data)
|
||||
|
||||
|
@ -135,7 +144,9 @@ async def test_save_new_scene(hass, hass_ws_client, scene_data, remove_json):
|
|||
assert result["scene_id"] == 21
|
||||
|
||||
|
||||
async def test_save_scene_error(hass, hass_ws_client, scene_data, remove_json):
|
||||
async def test_save_scene_error(
|
||||
hass: HomeAssistant, hass_ws_client: WebSocketGenerator, scene_data, remove_json
|
||||
) -> None:
|
||||
"""Test saving an Insteon scene with error."""
|
||||
ws_client, devices = await _setup(hass, hass_ws_client, scene_data)
|
||||
|
||||
|
@ -162,7 +173,9 @@ async def test_save_scene_error(hass, hass_ws_client, scene_data, remove_json):
|
|||
assert result["scene_id"] == 20
|
||||
|
||||
|
||||
async def test_delete_scene(hass, hass_ws_client, scene_data, remove_json):
|
||||
async def test_delete_scene(
|
||||
hass: HomeAssistant, hass_ws_client: WebSocketGenerator, scene_data, remove_json
|
||||
) -> None:
|
||||
"""Test delete an Insteon scene."""
|
||||
ws_client, devices = await _setup(hass, hass_ws_client, scene_data)
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ async def test_deactivated_event(hass: HomeAssistant, mock_litejet) -> None:
|
|||
assert hass.states.get(ENTITY_OTHER_LIGHT).state == "off"
|
||||
|
||||
|
||||
async def test_connected_event(hass, mock_litejet):
|
||||
async def test_connected_event(hass: HomeAssistant, mock_litejet) -> None:
|
||||
"""Test handling an event from LiteJet."""
|
||||
|
||||
await async_init_integration(hass)
|
||||
|
|
|
@ -47,7 +47,7 @@ async def test_activate(hass: HomeAssistant, mock_litejet) -> None:
|
|||
mock_litejet.activate_scene.assert_called_once_with(ENTITY_SCENE_NUMBER)
|
||||
|
||||
|
||||
async def test_connected_event(hass, mock_litejet):
|
||||
async def test_connected_event(hass: HomeAssistant, mock_litejet) -> None:
|
||||
"""Test handling an event from LiteJet."""
|
||||
|
||||
await async_init_integration(hass, use_scene=True)
|
||||
|
|
|
@ -84,7 +84,7 @@ async def test_released_event(hass: HomeAssistant, mock_litejet) -> None:
|
|||
assert hass.states.get(ENTITY_OTHER_SWITCH).state == STATE_OFF
|
||||
|
||||
|
||||
async def test_connected_event(hass, mock_litejet):
|
||||
async def test_connected_event(hass: HomeAssistant, mock_litejet) -> None:
|
||||
"""Test handling an event from LiteJet."""
|
||||
|
||||
await async_init_integration(hass, use_switch=True)
|
||||
|
|
Loading…
Reference in New Issue