Add type hints to integration tests (f-g) (#87700)
This commit is contained in:
parent
3052de3e8e
commit
7a4d15a657
75 changed files with 609 additions and 415 deletions
|
@ -8,6 +8,7 @@ from homeassistant import data_entry_flow
|
|||
from homeassistant.components.gios import config_flow
|
||||
from homeassistant.components.gios.const import CONF_STATION_ID
|
||||
from homeassistant.const import CONF_NAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import STATIONS
|
||||
|
||||
|
@ -19,7 +20,7 @@ CONFIG = {
|
|||
}
|
||||
|
||||
|
||||
async def test_show_form(hass):
|
||||
async def test_show_form(hass: HomeAssistant) -> None:
|
||||
"""Test that the form is served with no input."""
|
||||
flow = config_flow.GiosFlowHandler()
|
||||
flow.hass = hass
|
||||
|
@ -30,7 +31,7 @@ async def test_show_form(hass):
|
|||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
async def test_invalid_station_id(hass):
|
||||
async def test_invalid_station_id(hass: HomeAssistant) -> None:
|
||||
"""Test that errors are shown when measuring station ID is invalid."""
|
||||
with patch(
|
||||
"homeassistant.components.gios.Gios._get_stations", return_value=STATIONS
|
||||
|
@ -46,7 +47,7 @@ async def test_invalid_station_id(hass):
|
|||
assert result["errors"] == {CONF_STATION_ID: "wrong_station_id"}
|
||||
|
||||
|
||||
async def test_invalid_sensor_data(hass):
|
||||
async def test_invalid_sensor_data(hass: HomeAssistant) -> None:
|
||||
"""Test that errors are shown when sensor data is invalid."""
|
||||
with patch(
|
||||
"homeassistant.components.gios.Gios._get_stations", return_value=STATIONS
|
||||
|
@ -65,7 +66,7 @@ async def test_invalid_sensor_data(hass):
|
|||
assert result["errors"] == {CONF_STATION_ID: "invalid_sensors_data"}
|
||||
|
||||
|
||||
async def test_cannot_connect(hass):
|
||||
async def test_cannot_connect(hass: HomeAssistant) -> None:
|
||||
"""Test that errors are shown when cannot connect to GIOS server."""
|
||||
with patch(
|
||||
"homeassistant.components.gios.Gios._async_get", side_effect=ApiError("error")
|
||||
|
@ -79,7 +80,7 @@ async def test_cannot_connect(hass):
|
|||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
async def test_create_entry(hass):
|
||||
async def test_create_entry(hass: HomeAssistant) -> None:
|
||||
"""Test that the user step works."""
|
||||
with patch(
|
||||
"homeassistant.components.gios.Gios._get_stations", return_value=STATIONS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue