Add type hints to integration tests (j-m) (#87704)

This commit is contained in:
epenet 2023-02-08 19:06:59 +01:00 committed by GitHub
parent 630028106a
commit f75ac17554
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
103 changed files with 605 additions and 417 deletions

View file

@ -6,11 +6,12 @@ from serial import SerialException
from homeassistant import config_entries, data_entry_flow
from homeassistant.components.litejet.const import CONF_DEFAULT_TRANSITION, DOMAIN
from homeassistant.const import CONF_PORT
from homeassistant.core import HomeAssistant
from tests.common import MockConfigEntry
async def test_show_config_form(hass):
async def test_show_config_form(hass: HomeAssistant) -> None:
"""Test show configuration form."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
@ -33,7 +34,7 @@ async def test_create_entry(hass, mock_litejet):
assert result["data"] == test_data
async def test_flow_entry_already_exists(hass):
async def test_flow_entry_already_exists(hass: HomeAssistant) -> None:
"""Test user input when a config entry already exists."""
first_entry = MockConfigEntry(
domain=DOMAIN,
@ -51,7 +52,7 @@ async def test_flow_entry_already_exists(hass):
assert result["reason"] == "single_instance_allowed"
async def test_flow_open_failed(hass):
async def test_flow_open_failed(hass: HomeAssistant) -> None:
"""Test user input when serial port open fails."""
test_data = {CONF_PORT: "/dev/test"}
@ -66,7 +67,7 @@ async def test_flow_open_failed(hass):
assert result["errors"][CONF_PORT] == "open_failed"
async def test_import_step(hass):
async def test_import_step(hass: HomeAssistant) -> None:
"""Test initializing via import step."""
test_data = {CONF_PORT: "/dev/imported"}
result = await hass.config_entries.flow.async_init(
@ -78,7 +79,7 @@ async def test_import_step(hass):
assert result["data"] == test_data
async def test_options(hass):
async def test_options(hass: HomeAssistant) -> None:
"""Test updating options."""
entry = MockConfigEntry(domain=DOMAIN, data={CONF_PORT: "/dev/test"})
entry.add_to_hass(hass)