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

Add type hints to integration tests (part 1) (#87777)

This commit is contained in:
epenet
2023-02-09 16:09:13 +01:00
committed by GitHub
parent 2b3e6a4ca8
commit 07a1a0efa9
51 changed files with 905 additions and 471 deletions

View File

@@ -8,6 +8,7 @@ from homeassistant import data_entry_flow
from homeassistant.components.acmeda.const import DOMAIN
from homeassistant.config_entries import SOURCE_USER
from homeassistant.const import CONF_HOST
from homeassistant.core import HomeAssistant
from tests.common import MockConfigEntry
@@ -39,7 +40,7 @@ async def async_generator(items):
yield item
async def test_show_form_no_hubs(hass, mock_hub_discover):
async def test_show_form_no_hubs(hass: HomeAssistant, mock_hub_discover) -> None:
"""Test that flow aborts if no hubs are discovered."""
mock_hub_discover.return_value = async_generator([])
@@ -54,7 +55,9 @@ async def test_show_form_no_hubs(hass, mock_hub_discover):
assert len(mock_hub_discover.mock_calls) == 1
async def test_show_form_one_hub(hass, mock_hub_discover, mock_hub_run):
async def test_show_form_one_hub(
hass: HomeAssistant, mock_hub_discover, mock_hub_run
) -> None:
"""Test that a config is created when one hub discovered."""
dummy_hub_1 = aiopulse.Hub(DUMMY_HOST1)
@@ -76,7 +79,7 @@ async def test_show_form_one_hub(hass, mock_hub_discover, mock_hub_run):
assert len(mock_hub_discover.mock_calls) == 1
async def test_show_form_two_hubs(hass, mock_hub_discover):
async def test_show_form_two_hubs(hass: HomeAssistant, mock_hub_discover) -> None:
"""Test that the form is served when more than one hub discovered."""
dummy_hub_1 = aiopulse.Hub(DUMMY_HOST1)
@@ -98,7 +101,9 @@ async def test_show_form_two_hubs(hass, mock_hub_discover):
assert len(mock_hub_discover.mock_calls) == 1
async def test_create_second_entry(hass, mock_hub_run, mock_hub_discover):
async def test_create_second_entry(
hass: HomeAssistant, mock_hub_run, mock_hub_discover
) -> None:
"""Test that a config is created when a second hub is discovered."""
dummy_hub_1 = aiopulse.Hub(DUMMY_HOST1)
@@ -124,7 +129,7 @@ async def test_create_second_entry(hass, mock_hub_run, mock_hub_discover):
}
async def test_already_configured(hass, mock_hub_discover):
async def test_already_configured(hass: HomeAssistant, mock_hub_discover) -> None:
"""Test that flow aborts when all hubs are configured."""
dummy_hub_1 = aiopulse.Hub(DUMMY_HOST1)