Add type hints to integration tests (part 12) (#87997)
This commit is contained in:
parent
896dd1a36b
commit
ea29cdfe83
51 changed files with 371 additions and 246 deletions
|
@ -2,12 +2,13 @@
|
|||
import httpx
|
||||
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from . import INPUT_SENSOR
|
||||
|
||||
|
||||
async def test_setup_unload(hass, mock_iotawatt, entry):
|
||||
async def test_setup_unload(hass: HomeAssistant, mock_iotawatt, entry) -> None:
|
||||
"""Test we can setup and unload an entry."""
|
||||
mock_iotawatt.getSensors.return_value["sensors"]["my_sensor_key"] = INPUT_SENSOR
|
||||
assert await async_setup_component(hass, "iotawatt", {})
|
||||
|
@ -15,7 +16,9 @@ async def test_setup_unload(hass, mock_iotawatt, entry):
|
|||
assert await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
||||
|
||||
async def test_setup_connection_failed(hass, mock_iotawatt, entry):
|
||||
async def test_setup_connection_failed(
|
||||
hass: HomeAssistant, mock_iotawatt, entry
|
||||
) -> None:
|
||||
"""Test connection error during startup."""
|
||||
mock_iotawatt.connect.side_effect = httpx.ConnectError("")
|
||||
assert await async_setup_component(hass, "iotawatt", {})
|
||||
|
@ -23,7 +26,7 @@ async def test_setup_connection_failed(hass, mock_iotawatt, entry):
|
|||
assert entry.state == ConfigEntryState.SETUP_RETRY
|
||||
|
||||
|
||||
async def test_setup_auth_failed(hass, mock_iotawatt, entry):
|
||||
async def test_setup_auth_failed(hass: HomeAssistant, mock_iotawatt, entry) -> None:
|
||||
"""Test auth error during startup."""
|
||||
mock_iotawatt.connect.return_value = False
|
||||
assert await async_setup_component(hass, "iotawatt", {})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue