Add type hints to integration tests (t-z) (#87707)
This commit is contained in:
parent
f75ac17554
commit
278050a73f
110 changed files with 961 additions and 606 deletions
|
@ -1,9 +1,9 @@
|
|||
"""Test the ThermoPro config flow."""
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.thermopro.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import NOT_THERMOPRO_SERVICE_INFO, TP357_SERVICE_INFO
|
||||
|
@ -11,7 +11,7 @@ from . import NOT_THERMOPRO_SERVICE_INFO, TP357_SERVICE_INFO
|
|||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
async def test_async_step_bluetooth_valid_device(hass):
|
||||
async def test_async_step_bluetooth_valid_device(hass: HomeAssistant) -> None:
|
||||
"""Test discovery via bluetooth with a valid device."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
|
@ -32,7 +32,7 @@ async def test_async_step_bluetooth_valid_device(hass):
|
|||
assert result2["result"].unique_id == "4125DDBA-2774-4851-9889-6AADDD4CAC3D"
|
||||
|
||||
|
||||
async def test_async_step_bluetooth_not_thermopro(hass):
|
||||
async def test_async_step_bluetooth_not_thermopro(hass: HomeAssistant) -> None:
|
||||
"""Test discovery via bluetooth not thermopro."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
|
@ -43,7 +43,7 @@ async def test_async_step_bluetooth_not_thermopro(hass):
|
|||
assert result["reason"] == "not_supported"
|
||||
|
||||
|
||||
async def test_async_step_user_no_devices_found(hass):
|
||||
async def test_async_step_user_no_devices_found(hass: HomeAssistant) -> None:
|
||||
"""Test setup from service info cache with no devices found."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
|
@ -53,7 +53,7 @@ async def test_async_step_user_no_devices_found(hass):
|
|||
assert result["reason"] == "no_devices_found"
|
||||
|
||||
|
||||
async def test_async_step_user_with_found_devices(hass):
|
||||
async def test_async_step_user_with_found_devices(hass: HomeAssistant) -> None:
|
||||
"""Test setup from service info cache with devices found."""
|
||||
with patch(
|
||||
"homeassistant.components.thermopro.config_flow.async_discovered_service_info",
|
||||
|
@ -78,7 +78,7 @@ async def test_async_step_user_with_found_devices(hass):
|
|||
assert result2["result"].unique_id == "4125DDBA-2774-4851-9889-6AADDD4CAC3D"
|
||||
|
||||
|
||||
async def test_async_step_user_device_added_between_steps(hass):
|
||||
async def test_async_step_user_device_added_between_steps(hass: HomeAssistant) -> None:
|
||||
"""Test the device gets added via another flow between steps."""
|
||||
with patch(
|
||||
"homeassistant.components.thermopro.config_flow.async_discovered_service_info",
|
||||
|
@ -108,7 +108,9 @@ async def test_async_step_user_device_added_between_steps(hass):
|
|||
assert result2["reason"] == "already_configured"
|
||||
|
||||
|
||||
async def test_async_step_user_with_found_devices_already_setup(hass):
|
||||
async def test_async_step_user_with_found_devices_already_setup(
|
||||
hass: HomeAssistant,
|
||||
) -> None:
|
||||
"""Test setup from service info cache with devices found."""
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
|
@ -128,7 +130,7 @@ async def test_async_step_user_with_found_devices_already_setup(hass):
|
|||
assert result["reason"] == "no_devices_found"
|
||||
|
||||
|
||||
async def test_async_step_bluetooth_devices_already_setup(hass):
|
||||
async def test_async_step_bluetooth_devices_already_setup(hass: HomeAssistant) -> None:
|
||||
"""Test we can't start a flow if there is already a config entry."""
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
|
@ -145,7 +147,7 @@ async def test_async_step_bluetooth_devices_already_setup(hass):
|
|||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
async def test_async_step_bluetooth_already_in_progress(hass):
|
||||
async def test_async_step_bluetooth_already_in_progress(hass: HomeAssistant) -> None:
|
||||
"""Test we can't start a flow for the same device twice."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
|
@ -164,7 +166,9 @@ async def test_async_step_bluetooth_already_in_progress(hass):
|
|||
assert result["reason"] == "already_in_progress"
|
||||
|
||||
|
||||
async def test_async_step_user_takes_precedence_over_discovery(hass):
|
||||
async def test_async_step_user_takes_precedence_over_discovery(
|
||||
hass: HomeAssistant,
|
||||
) -> None:
|
||||
"""Test manual setup takes precedence over discovery."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue