mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Add type hints to integration tests (a) (#87684)
* Add type hints to accuweather tests * Adjust a** components * Adjust aiohttp_client * ClientSessionGenerator/WebSocketGenerator
This commit is contained in:
@@ -8,6 +8,7 @@ from accuweather import ApiError
|
||||
from homeassistant.components.accuweather.const import DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import STATE_UNAVAILABLE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
from . import init_integration
|
||||
@@ -15,7 +16,7 @@ from . import init_integration
|
||||
from tests.common import MockConfigEntry, async_fire_time_changed, load_fixture
|
||||
|
||||
|
||||
async def test_async_setup_entry(hass):
|
||||
async def test_async_setup_entry(hass: HomeAssistant) -> None:
|
||||
"""Test a successful setup entry."""
|
||||
await init_integration(hass)
|
||||
|
||||
@@ -25,7 +26,7 @@ async def test_async_setup_entry(hass):
|
||||
assert state.state == "sunny"
|
||||
|
||||
|
||||
async def test_config_not_ready(hass):
|
||||
async def test_config_not_ready(hass: HomeAssistant) -> None:
|
||||
"""Test for setup failure if connection to AccuWeather is missing."""
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
@@ -48,7 +49,7 @@ async def test_config_not_ready(hass):
|
||||
assert entry.state is ConfigEntryState.SETUP_RETRY
|
||||
|
||||
|
||||
async def test_unload_entry(hass):
|
||||
async def test_unload_entry(hass: HomeAssistant) -> None:
|
||||
"""Test successful unload of entry."""
|
||||
entry = await init_integration(hass)
|
||||
|
||||
@@ -62,7 +63,7 @@ async def test_unload_entry(hass):
|
||||
assert not hass.data.get(DOMAIN)
|
||||
|
||||
|
||||
async def test_update_interval(hass):
|
||||
async def test_update_interval(hass: HomeAssistant) -> None:
|
||||
"""Test correct update interval."""
|
||||
entry = await init_integration(hass)
|
||||
|
||||
@@ -83,7 +84,7 @@ async def test_update_interval(hass):
|
||||
assert mock_current.call_count == 1
|
||||
|
||||
|
||||
async def test_update_interval_forecast(hass):
|
||||
async def test_update_interval_forecast(hass: HomeAssistant) -> None:
|
||||
"""Test correct update interval when forecast is True."""
|
||||
entry = await init_integration(hass, forecast=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user