Add type hints to integration tests (part 3) (#87844)
This commit is contained in:
parent
22bfb99db4
commit
fa7acb4f0d
50 changed files with 745 additions and 386 deletions
|
@ -11,6 +11,8 @@ from homeassistant.core import Context, HomeAssistant
|
|||
from homeassistant.exceptions import Unauthorized
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import MockUser
|
||||
|
||||
|
||||
async def test_constructor_loads_info_from_config(hass: HomeAssistant) -> None:
|
||||
"""Test non-dev mode loads info from SERVERS constant."""
|
||||
|
@ -51,7 +53,9 @@ async def test_constructor_loads_info_from_config(hass: HomeAssistant) -> None:
|
|||
assert cl.remotestate_server == "test-remotestate-server"
|
||||
|
||||
|
||||
async def test_remote_services(hass, mock_cloud_fixture, hass_read_only_user):
|
||||
async def test_remote_services(
|
||||
hass: HomeAssistant, mock_cloud_fixture, hass_read_only_user: MockUser
|
||||
) -> None:
|
||||
"""Setup cloud component and test services."""
|
||||
cloud = hass.data[DOMAIN]
|
||||
|
||||
|
@ -92,7 +96,7 @@ async def test_remote_services(hass, mock_cloud_fixture, hass_read_only_user):
|
|||
assert mock_disconnect.called is False
|
||||
|
||||
|
||||
async def test_startup_shutdown_events(hass, mock_cloud_fixture):
|
||||
async def test_startup_shutdown_events(hass: HomeAssistant, mock_cloud_fixture) -> None:
|
||||
"""Test if the cloud will start on startup event."""
|
||||
with patch("hass_nabucasa.Cloud.stop") as mock_stop:
|
||||
hass.bus.async_fire(EVENT_HOMEASSISTANT_STOP)
|
||||
|
@ -101,7 +105,7 @@ async def test_startup_shutdown_events(hass, mock_cloud_fixture):
|
|||
assert mock_stop.called
|
||||
|
||||
|
||||
async def test_setup_existing_cloud_user(hass, hass_storage):
|
||||
async def test_setup_existing_cloud_user(hass: HomeAssistant, hass_storage) -> None:
|
||||
"""Test setup with API push default data."""
|
||||
user = await hass.auth.async_create_system_user("Cloud test")
|
||||
hass_storage[STORAGE_KEY] = {"version": 1, "data": {"cloud_user": user.id}}
|
||||
|
@ -125,7 +129,7 @@ async def test_setup_existing_cloud_user(hass, hass_storage):
|
|||
assert hass_storage[STORAGE_KEY]["data"]["cloud_user"] == user.id
|
||||
|
||||
|
||||
async def test_on_connect(hass, mock_cloud_fixture):
|
||||
async def test_on_connect(hass: HomeAssistant, mock_cloud_fixture) -> None:
|
||||
"""Test cloud on connect triggers."""
|
||||
cl = hass.data["cloud"]
|
||||
|
||||
|
@ -165,7 +169,7 @@ async def test_on_connect(hass, mock_cloud_fixture):
|
|||
assert cloud_states[-1] == cloud.CloudConnectionState.CLOUD_DISCONNECTED
|
||||
|
||||
|
||||
async def test_remote_ui_url(hass, mock_cloud_fixture):
|
||||
async def test_remote_ui_url(hass: HomeAssistant, mock_cloud_fixture) -> None:
|
||||
"""Test getting remote ui url."""
|
||||
cl = hass.data["cloud"]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue