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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user