mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Add type hints to integration tests (d-e) (#87699)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
"""Test deCONZ gateway."""
|
||||
|
||||
import asyncio
|
||||
from copy import deepcopy
|
||||
from unittest.mock import patch
|
||||
@@ -46,9 +45,11 @@ from homeassistant.const import (
|
||||
STATE_OFF,
|
||||
STATE_UNAVAILABLE,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
|
||||
API_KEY = "1234567890ABCDEF"
|
||||
BRIDGEID = "01234E56789A"
|
||||
@@ -137,7 +138,9 @@ async def setup_deconz_integration(
|
||||
return config_entry
|
||||
|
||||
|
||||
async def test_gateway_setup(hass, aioclient_mock):
|
||||
async def test_gateway_setup(
|
||||
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
|
||||
) -> None:
|
||||
"""Successful setup."""
|
||||
with patch(
|
||||
"homeassistant.config_entries.ConfigEntries.async_forward_entry_setup",
|
||||
@@ -184,7 +187,9 @@ async def test_gateway_setup(hass, aioclient_mock):
|
||||
assert gateway_entry.entry_type is dr.DeviceEntryType.SERVICE
|
||||
|
||||
|
||||
async def test_gateway_device_configuration_url_when_addon(hass, aioclient_mock):
|
||||
async def test_gateway_device_configuration_url_when_addon(
|
||||
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
|
||||
) -> None:
|
||||
"""Successful setup."""
|
||||
with patch(
|
||||
"homeassistant.config_entries.ConfigEntries.async_forward_entry_setup",
|
||||
@@ -236,7 +241,9 @@ async def test_connection_status_signalling(
|
||||
assert hass.states.get("binary_sensor.presence").state == STATE_OFF
|
||||
|
||||
|
||||
async def test_update_address(hass, aioclient_mock):
|
||||
async def test_update_address(
|
||||
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
|
||||
) -> None:
|
||||
"""Make sure that connection status triggers a dispatcher send."""
|
||||
config_entry = await setup_deconz_integration(hass, aioclient_mock)
|
||||
gateway = get_gateway_from_config_entry(hass, config_entry)
|
||||
@@ -266,7 +273,9 @@ async def test_update_address(hass, aioclient_mock):
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
||||
|
||||
async def test_reset_after_successful_setup(hass, aioclient_mock):
|
||||
async def test_reset_after_successful_setup(
|
||||
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
|
||||
) -> None:
|
||||
"""Make sure that connection status triggers a dispatcher send."""
|
||||
config_entry = await setup_deconz_integration(hass, aioclient_mock)
|
||||
gateway = get_gateway_from_config_entry(hass, config_entry)
|
||||
@@ -277,7 +286,7 @@ async def test_reset_after_successful_setup(hass, aioclient_mock):
|
||||
assert result is True
|
||||
|
||||
|
||||
async def test_get_deconz_session(hass):
|
||||
async def test_get_deconz_session(hass: HomeAssistant) -> None:
|
||||
"""Successful call."""
|
||||
with patch("pydeconz.DeconzSession.refresh_state", return_value=True):
|
||||
assert await get_deconz_session(hass, ENTRY_CONFIG)
|
||||
|
||||
Reference in New Issue
Block a user