Add type hints to integration tests (part 12) (#87997)

This commit is contained in:
epenet 2023-02-13 13:03:51 +01:00 committed by GitHub
parent 896dd1a36b
commit ea29cdfe83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 371 additions and 246 deletions

View file

@ -3,6 +3,7 @@ import asyncio
from unittest.mock import patch
from pyinsteon.address import Address
import pytest
from homeassistant.components import insteon
from homeassistant.components.insteon.const import (
@ -55,7 +56,7 @@ async def mock_failed_connection(*args, **kwargs):
raise ConnectionError("Connection failed")
async def test_setup_entry(hass: HomeAssistant):
async def test_setup_entry(hass: HomeAssistant) -> None:
"""Test setting up the entry."""
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_USER_INPUT_PLM)
config_entry.add_to_hass(hass)
@ -78,7 +79,7 @@ async def test_setup_entry(hass: HomeAssistant):
assert mock_close.called
async def test_import_plm(hass: HomeAssistant):
async def test_import_plm(hass: HomeAssistant) -> None:
"""Test setting up the entry from YAML to a PLM."""
config = {}
config[DOMAIN] = MOCK_IMPORT_CONFIG_PLM
@ -103,7 +104,7 @@ async def test_import_plm(hass: HomeAssistant):
assert CONF_PORT not in data
async def test_import_hub1(hass: HomeAssistant):
async def test_import_hub1(hass: HomeAssistant) -> None:
"""Test setting up the entry from YAML to a hub v1."""
config = {}
config[DOMAIN] = MOCK_IMPORT_MINIMUM_HUB_V1
@ -130,7 +131,7 @@ async def test_import_hub1(hass: HomeAssistant):
assert CONF_PASSWORD not in data
async def test_import_hub2(hass: HomeAssistant):
async def test_import_hub2(hass: HomeAssistant) -> None:
"""Test setting up the entry from YAML to a hub v2."""
config = {}
config[DOMAIN] = MOCK_IMPORT_MINIMUM_HUB_V2
@ -157,7 +158,7 @@ async def test_import_hub2(hass: HomeAssistant):
assert data[CONF_PASSWORD] == MOCK_IMPORT_MINIMUM_HUB_V2[CONF_PASSWORD]
async def test_import_options(hass: HomeAssistant):
async def test_import_options(hass: HomeAssistant) -> None:
"""Test setting up the entry from YAML including options."""
config = {}
config[DOMAIN] = MOCK_IMPORT_FULL_CONFIG_PLM
@ -190,7 +191,7 @@ async def test_import_options(hass: HomeAssistant):
assert options[CONF_X10][1] == MOCK_IMPORT_FULL_CONFIG_PLM[CONF_X10][1]
async def test_import_failed_connection(hass: HomeAssistant):
async def test_import_failed_connection(hass: HomeAssistant) -> None:
"""Test a failed connection in import does not create a config entry."""
config = {}
config[DOMAIN] = MOCK_IMPORT_CONFIG_PLM
@ -209,7 +210,9 @@ async def test_import_failed_connection(hass: HomeAssistant):
assert not hass.config_entries.async_entries(DOMAIN)
async def test_setup_entry_failed_connection(hass: HomeAssistant, caplog):
async def test_setup_entry_failed_connection(
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
) -> None:
"""Test setting up the entry with a failed connection."""
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_USER_INPUT_PLM)
config_entry.add_to_hass(hass)
@ -225,7 +228,7 @@ async def test_setup_entry_failed_connection(hass: HomeAssistant, caplog):
assert "Could not connect to Insteon modem" in caplog.text
async def test_import_frontend_dev_url(hass: HomeAssistant):
async def test_import_frontend_dev_url(hass: HomeAssistant) -> None:
"""Test importing a dev_url config entry."""
config = {}
config[DOMAIN] = {CONF_DEV_PATH: "/some/path"}