Adjust hass_client type hint in integration tests (#86954)
* Adjust hass_client type hint in integration tests * Adjust hass_client_no_auth * Fix rebase
This commit is contained in:
parent
8bff95014c
commit
a79be493e5
54 changed files with 179 additions and 178 deletions
|
@ -30,7 +30,7 @@ from homeassistant.helpers import config_entry_oauth2_flow
|
|||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import MockConfigEntry, mock_platform
|
||||
from tests.typing import WebSocketGenerator
|
||||
from tests.typing import ClientSessionGenerator, WebSocketGenerator
|
||||
|
||||
CLIENT_ID = "some-client-id"
|
||||
CLIENT_SECRET = "some-client-secret"
|
||||
|
@ -171,7 +171,9 @@ class OAuthFixture:
|
|||
|
||||
@pytest.fixture
|
||||
async def oauth_fixture(
|
||||
hass: HomeAssistant, hass_client_no_auth: Any, aioclient_mock: Any
|
||||
hass: HomeAssistant,
|
||||
hass_client_no_auth: ClientSessionGenerator,
|
||||
aioclient_mock: Any,
|
||||
) -> OAuthFixture:
|
||||
"""Fixture for testing the OAuth flow."""
|
||||
return OAuthFixture(hass, hass_client_no_auth, aioclient_mock)
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
"""Tests for the Backup integration."""
|
||||
from collections.abc import Awaitable, Callable
|
||||
from unittest.mock import patch
|
||||
|
||||
from aiohttp import ClientSession, web
|
||||
from aiohttp import web
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .common import TEST_BACKUP, setup_backup_integration
|
||||
|
||||
from tests.common import MockUser
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_downloading_backup(
|
||||
hass: HomeAssistant,
|
||||
hass_client: Callable[..., Awaitable[ClientSession]],
|
||||
hass_client: ClientSessionGenerator,
|
||||
) -> None:
|
||||
"""Test downloading a backup file."""
|
||||
await setup_backup_integration(hass)
|
||||
|
@ -33,7 +33,7 @@ async def test_downloading_backup(
|
|||
|
||||
async def test_downloading_backup_not_found(
|
||||
hass: HomeAssistant,
|
||||
hass_client: Callable[..., Awaitable[ClientSession]],
|
||||
hass_client: ClientSessionGenerator,
|
||||
) -> None:
|
||||
"""Test downloading a backup file that does not exist."""
|
||||
await setup_backup_integration(hass)
|
||||
|
@ -46,7 +46,7 @@ async def test_downloading_backup_not_found(
|
|||
|
||||
async def test_non_admin(
|
||||
hass: HomeAssistant,
|
||||
hass_client: Callable[..., Awaitable[ClientSession]],
|
||||
hass_client: ClientSessionGenerator,
|
||||
hass_admin_user: MockUser,
|
||||
) -> None:
|
||||
"""Test downloading a backup file that does not exist."""
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
"""Test Brother diagnostics."""
|
||||
from collections.abc import Awaitable, Callable
|
||||
from datetime import datetime
|
||||
import json
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.util.dt import UTC
|
||||
|
||||
|
@ -13,10 +10,11 @@ from . import init_integration
|
|||
|
||||
from tests.common import load_fixture
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_entry_diagnostics(
|
||||
hass: HomeAssistant, hass_client: Callable[..., Awaitable[ClientSession]]
|
||||
hass: HomeAssistant, hass_client: ClientSessionGenerator
|
||||
) -> None:
|
||||
"""Test config entry diagnostics."""
|
||||
entry = await init_integration(hass, skip_setup=True)
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
"""Tests for the diagnostics data provided by the BSBLan integration."""
|
||||
import json
|
||||
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry, load_fixture
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
init_integration: MockConfigEntry,
|
||||
):
|
||||
"""Test diagnostics."""
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
"""Test cloud repairs."""
|
||||
from collections.abc import Awaitable, Callable, Generator
|
||||
from collections.abc import Generator
|
||||
from datetime import timedelta
|
||||
from http import HTTPStatus
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.components.cloud import DOMAIN
|
||||
import homeassistant.components.cloud.repairs as cloud_repairs
|
||||
from homeassistant.components.repairs import DOMAIN as REPAIRS_DOMAIN
|
||||
|
@ -18,6 +16,7 @@ from . import mock_cloud
|
|||
|
||||
from tests.common import async_fire_time_changed
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_do_not_create_repair_issues_at_startup_if_not_logged_in(
|
||||
|
@ -80,7 +79,7 @@ async def test_legacy_subscription_repair_flow(
|
|||
hass: HomeAssistant,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
mock_auth: Generator[None, AsyncMock, None],
|
||||
hass_client: Callable[..., Awaitable[ClientSession]],
|
||||
hass_client: ClientSessionGenerator,
|
||||
):
|
||||
"""Test desired flow of the fix flow for legacy subscription."""
|
||||
issue_registry: ir.IssueRegistry = ir.async_get(hass)
|
||||
|
@ -163,7 +162,7 @@ async def test_legacy_subscription_repair_flow(
|
|||
|
||||
async def test_legacy_subscription_repair_flow_timeout(
|
||||
hass: HomeAssistant,
|
||||
hass_client: Callable[..., Awaitable[ClientSession]],
|
||||
hass_client: ClientSessionGenerator,
|
||||
mock_auth: Generator[None, AsyncMock, None],
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
):
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
from unittest.mock import patch
|
||||
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from .common import (
|
||||
init_mock_coinbase,
|
||||
mock_get_current_user,
|
||||
|
@ -13,9 +11,10 @@ from .common import (
|
|||
from .const import MOCK_ACCOUNTS_RESPONSE_REDACTED, MOCK_ENTRY_REDACTED
|
||||
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_entry_diagnostics(hass, hass_client: ClientSession):
|
||||
async def test_entry_diagnostics(hass, hass_client: ClientSessionGenerator):
|
||||
"""Test we handle a and redact a diagnostics request."""
|
||||
|
||||
with patch(
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
"""Tests for the diagnostics data provided by the CPU Speed integration."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
init_integration: MockConfigEntry,
|
||||
):
|
||||
"""Test diagnostics."""
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"""Tests for the devolo Home Network diagnostics."""
|
||||
from __future__ import annotations
|
||||
|
||||
from aiohttp import ClientSession
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.devolo_home_network.diagnostics import TO_REDACT
|
||||
|
@ -13,12 +12,13 @@ from . import configure_integration
|
|||
from .const import DISCOVERY_INFO
|
||||
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("mock_device")
|
||||
async def test_entry_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
):
|
||||
"""Test config entry diagnostics."""
|
||||
entry = configure_integration(hass)
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
"""Tests for the diagnostics data provided by the Elgato integration."""
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
init_integration: MockConfigEntry,
|
||||
):
|
||||
"""Test diagnostics."""
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"""Tests for the diagnostics data provided by the EnergyZero integration."""
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from aiohttp import ClientSession
|
||||
from energyzero import EnergyZeroNoDataError
|
||||
import pytest
|
||||
|
||||
|
@ -12,12 +11,13 @@ from homeassistant.setup import async_setup_component
|
|||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
@pytest.mark.freeze_time("2022-12-07 15:00:00")
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
init_integration: MockConfigEntry,
|
||||
) -> None:
|
||||
"""Test diagnostics."""
|
||||
|
@ -47,7 +47,7 @@ async def test_diagnostics(
|
|||
@pytest.mark.freeze_time("2022-12-07 15:00:00")
|
||||
async def test_diagnostics_no_gas_today(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
mock_energyzero: MagicMock,
|
||||
init_integration: MockConfigEntry,
|
||||
) -> None:
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""Tests for the diagnostics data provided by the ESPHome integration."""
|
||||
|
||||
from aiohttp import ClientSession
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.esphome import CONF_DEVICE_NAME, CONF_NOISE_PSK
|
||||
|
@ -11,11 +10,12 @@ from . import DASHBOARD_SLUG
|
|||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
init_integration: MockConfigEntry,
|
||||
enable_bluetooth: pytest.fixture,
|
||||
mock_dashboard,
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
"""Tests for the diagnostics data provided by the Forecast.Solar integration."""
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
init_integration: MockConfigEntry,
|
||||
):
|
||||
"""Test diagnostics."""
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
"""Tests for Fritz!Tools diagnostics platform."""
|
||||
from __future__ import annotations
|
||||
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
from homeassistant.components.fritz.common import AvmWrapper
|
||||
from homeassistant.components.fritz.const import DOMAIN
|
||||
|
@ -15,10 +13,14 @@ from .const import MOCK_MESH_MASTER_MAC, MOCK_USER_DATA
|
|||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_entry_diagnostics(
|
||||
hass: HomeAssistant, hass_client: ClientSession, fc_class_mock, fh_class_mock
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
fc_class_mock,
|
||||
fh_class_mock,
|
||||
):
|
||||
"""Test config entry diagnostics."""
|
||||
entry = MockConfigEntry(domain=DOMAIN, data=MOCK_USER_DATA)
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
from unittest.mock import patch
|
||||
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.components.fritz.const import DOMAIN
|
||||
from homeassistant.components.update import DOMAIN as UPDATE_DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
|
@ -18,10 +16,14 @@ from .const import (
|
|||
)
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_update_entities_initialized(
|
||||
hass: HomeAssistant, hass_client: ClientSession, fc_class_mock, fh_class_mock
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
fc_class_mock,
|
||||
fh_class_mock,
|
||||
):
|
||||
"""Test update entities."""
|
||||
|
||||
|
@ -37,7 +39,10 @@ async def test_update_entities_initialized(
|
|||
|
||||
|
||||
async def test_update_available(
|
||||
hass: HomeAssistant, hass_client: ClientSession, fc_class_mock, fh_class_mock
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
fc_class_mock,
|
||||
fh_class_mock,
|
||||
):
|
||||
"""Test update entities."""
|
||||
|
||||
|
@ -61,7 +66,10 @@ async def test_update_available(
|
|||
|
||||
|
||||
async def test_no_update_available(
|
||||
hass: HomeAssistant, hass_client: ClientSession, fc_class_mock, fh_class_mock
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
fc_class_mock,
|
||||
fh_class_mock,
|
||||
):
|
||||
"""Test update entities."""
|
||||
|
||||
|
@ -80,7 +88,10 @@ async def test_no_update_available(
|
|||
|
||||
|
||||
async def test_available_update_can_be_installed(
|
||||
hass: HomeAssistant, hass_client: ClientSession, fc_class_mock, fh_class_mock
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
fc_class_mock,
|
||||
fh_class_mock,
|
||||
):
|
||||
"""Test update entities."""
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@ from __future__ import annotations
|
|||
|
||||
from unittest.mock import Mock
|
||||
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
from homeassistant.components.fritzbox.const import DOMAIN as FB_DOMAIN
|
||||
from homeassistant.components.fritzbox.diagnostics import TO_REDACT
|
||||
|
@ -15,10 +13,11 @@ from . import setup_config_entry
|
|||
from .const import MOCK_CONFIG
|
||||
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_entry_diagnostics(
|
||||
hass: HomeAssistant, hass_client: ClientSession, fritz: Mock
|
||||
hass: HomeAssistant, hass_client: ClientSessionGenerator, fritz: Mock
|
||||
):
|
||||
"""Test config entry diagnostics."""
|
||||
assert await setup_config_entry(hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0])
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
"""Test the Fully Kiosk Browser diagnostics."""
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
from homeassistant.components.fully_kiosk.const import DOMAIN
|
||||
from homeassistant.components.fully_kiosk.diagnostics import (
|
||||
|
@ -14,11 +12,12 @@ from homeassistant.helpers import device_registry as dr
|
|||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_device
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
mock_fully_kiosk: MagicMock,
|
||||
init_integration: MockConfigEntry,
|
||||
) -> None:
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
"""Test the Geocaching config flow."""
|
||||
from collections.abc import Awaitable, Callable
|
||||
from http import HTTPStatus
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from aiohttp.test_utils import TestClient
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.application_credentials import (
|
||||
|
@ -25,6 +23,7 @@ from . import CLIENT_ID, CLIENT_SECRET, REDIRECT_URI
|
|||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
CURRENT_ENVIRONMENT_URLS = ENVIRONMENT_URLS[ENVIRONMENT]
|
||||
|
||||
|
@ -42,7 +41,7 @@ async def setup_credentials(hass: HomeAssistant) -> None:
|
|||
|
||||
async def test_full_flow(
|
||||
hass: HomeAssistant,
|
||||
hass_client_no_auth: Callable[[], Awaitable[TestClient]],
|
||||
hass_client_no_auth: ClientSessionGenerator,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
current_request_with_host: None,
|
||||
mock_geocaching_config_flow: MagicMock,
|
||||
|
@ -92,7 +91,7 @@ async def test_full_flow(
|
|||
|
||||
async def test_existing_entry(
|
||||
hass: HomeAssistant,
|
||||
hass_client_no_auth: Callable[[], Awaitable[TestClient]],
|
||||
hass_client_no_auth: ClientSessionGenerator,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
current_request_with_host: None,
|
||||
mock_geocaching_config_flow: MagicMock,
|
||||
|
@ -138,7 +137,7 @@ async def test_existing_entry(
|
|||
|
||||
async def test_oauth_error(
|
||||
hass: HomeAssistant,
|
||||
hass_client_no_auth: Callable[[], Awaitable[TestClient]],
|
||||
hass_client_no_auth: ClientSessionGenerator,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
current_request_with_host: None,
|
||||
mock_geocaching_config_flow: MagicMock,
|
||||
|
@ -185,7 +184,7 @@ async def test_oauth_error(
|
|||
|
||||
async def test_reauthentication(
|
||||
hass: HomeAssistant,
|
||||
hass_client_no_auth: Callable[[], Awaitable[TestClient]],
|
||||
hass_client_no_auth: ClientSessionGenerator,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
current_request_with_host: None,
|
||||
mock_geocaching_config_flow: MagicMock,
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
import json
|
||||
|
||||
from aiogithubapi import GitHubException
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.components.github.const import CONF_REPOSITORIES, DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
@ -13,11 +12,12 @@ from .common import setup_github_integration
|
|||
from tests.common import MockConfigEntry, load_fixture
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_entry_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
) -> None:
|
||||
|
@ -56,7 +56,7 @@ async def test_entry_diagnostics(
|
|||
|
||||
async def test_entry_diagnostics_exception(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
init_integration: MockConfigEntry,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
) -> None:
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
"""Test diagnostics."""
|
||||
|
||||
from typing import Any
|
||||
from unittest.mock import ANY
|
||||
|
||||
from homeassistant import core, setup
|
||||
|
@ -10,9 +8,12 @@ from homeassistant.setup import async_setup_component
|
|||
from .test_http import DUMMY_CONFIG
|
||||
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(hass: core.HomeAssistant, hass_client: Any):
|
||||
async def test_diagnostics(
|
||||
hass: core.HomeAssistant, hass_client: ClientSessionGenerator
|
||||
):
|
||||
"""Test diagnostics v1."""
|
||||
|
||||
await setup.async_setup_component(
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
import os
|
||||
from unittest.mock import patch
|
||||
|
||||
from aiohttp import ClientSession
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.hassio import DOMAIN
|
||||
|
@ -12,6 +11,7 @@ from homeassistant.setup import async_setup_component
|
|||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
MOCK_ENVIRON = {"SUPERVISOR": "127.0.0.1", "SUPERVISOR_TOKEN": "abcdefgh"}
|
||||
|
||||
|
@ -156,7 +156,7 @@ def mock_all(aioclient_mock, request):
|
|||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
) -> None:
|
||||
"""Test diagnostic information."""
|
||||
config_entry = MockConfigEntry(domain=DOMAIN, data={}, unique_id=DOMAIN)
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
"""Test homekit_controller diagnostics."""
|
||||
from unittest.mock import ANY
|
||||
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.components.homekit_controller.const import KNOWN_DEVICES
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
|
@ -13,9 +11,12 @@ from tests.components.diagnostics import (
|
|||
get_diagnostics_for_config_entry,
|
||||
get_diagnostics_for_device,
|
||||
)
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_config_entry(hass: HomeAssistant, hass_client: ClientSession, utcnow):
|
||||
async def test_config_entry(
|
||||
hass: HomeAssistant, hass_client: ClientSessionGenerator, utcnow
|
||||
):
|
||||
"""Test generating diagnostics for a config entry."""
|
||||
accessories = await setup_accessories_from_file(hass, "koogeek_ls1.json")
|
||||
config_entry, _ = await setup_test_accessories(hass, accessories)
|
||||
|
@ -283,7 +284,7 @@ async def test_config_entry(hass: HomeAssistant, hass_client: ClientSession, utc
|
|||
}
|
||||
|
||||
|
||||
async def test_device(hass: HomeAssistant, hass_client: ClientSession, utcnow):
|
||||
async def test_device(hass: HomeAssistant, hass_client: ClientSessionGenerator, utcnow):
|
||||
"""Test generating diagnostics for a device entry."""
|
||||
accessories = await setup_accessories_from_file(hass, "koogeek_ls1.json")
|
||||
config_entry, _ = await setup_test_accessories(hass, accessories)
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
"""Tests for diagnostics data."""
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
init_integration: MockConfigEntry,
|
||||
):
|
||||
"""Test diagnostics."""
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
"""Test Jellyfin diagnostics."""
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
init_integration: MockConfigEntry,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
):
|
||||
"""Test generating diagnostics for a config entry."""
|
||||
entry = init_integration
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"""Tests for the diagnostics data provided by the KNX integration."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from aiohttp import ClientSession
|
||||
from xknx.io import DEFAULT_MCAST_GRP, DEFAULT_MCAST_PORT
|
||||
|
||||
from homeassistant.components.knx.const import (
|
||||
|
@ -27,11 +26,12 @@ from .conftest import KNXTestKit
|
|||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
knx: KNXTestKit,
|
||||
):
|
||||
|
@ -60,7 +60,7 @@ async def test_diagnostics(
|
|||
|
||||
async def test_diagnostic_config_error(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
knx: KNXTestKit,
|
||||
):
|
||||
|
@ -92,7 +92,7 @@ async def test_diagnostic_config_error(
|
|||
|
||||
async def test_diagnostic_redact(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
):
|
||||
"""Test diagnostics redacting data."""
|
||||
mock_config_entry: MockConfigEntry = MockConfigEntry(
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
"""Test Kostal Plenticore diagnostics."""
|
||||
from aiohttp import ClientSession
|
||||
from pykoplenti import SettingsData
|
||||
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
|
@ -8,11 +7,12 @@ from homeassistant.core import HomeAssistant
|
|||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_entry_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
mock_plenticore: Plenticore,
|
||||
init_integration: MockConfigEntry,
|
||||
) -> None:
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
"""Tests for the LaMetric config flow."""
|
||||
from collections.abc import Awaitable, Callable
|
||||
from http import HTTPStatus
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from aiohttp.test_utils import TestClient
|
||||
from demetriek import (
|
||||
LaMetricConnectionError,
|
||||
LaMetricConnectionTimeoutError,
|
||||
|
@ -31,6 +29,7 @@ from homeassistant.helpers import config_entry_oauth2_flow
|
|||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
SSDP_DISCOVERY_INFO = SsdpServiceInfo(
|
||||
ssdp_usn="mock_usn",
|
||||
|
@ -45,7 +44,7 @@ SSDP_DISCOVERY_INFO = SsdpServiceInfo(
|
|||
|
||||
async def test_full_cloud_import_flow_multiple_devices(
|
||||
hass: HomeAssistant,
|
||||
hass_client_no_auth: Callable[[], Awaitable[TestClient]],
|
||||
hass_client_no_auth: ClientSessionGenerator,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
current_request_with_host: None,
|
||||
mock_setup_entry: MagicMock,
|
||||
|
@ -125,7 +124,7 @@ async def test_full_cloud_import_flow_multiple_devices(
|
|||
|
||||
async def test_full_cloud_import_flow_single_device(
|
||||
hass: HomeAssistant,
|
||||
hass_client_no_auth: Callable[[], Awaitable[TestClient]],
|
||||
hass_client_no_auth: ClientSessionGenerator,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
current_request_with_host: None,
|
||||
mock_setup_entry: MagicMock,
|
||||
|
@ -244,7 +243,7 @@ async def test_full_manual(
|
|||
|
||||
async def test_full_ssdp_with_cloud_import(
|
||||
hass: HomeAssistant,
|
||||
hass_client_no_auth: Callable[[], Awaitable[TestClient]],
|
||||
hass_client_no_auth: ClientSessionGenerator,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
current_request_with_host: None,
|
||||
mock_setup_entry: MagicMock,
|
||||
|
@ -389,7 +388,7 @@ async def test_ssdp_abort_invalid_discovery(
|
|||
|
||||
async def test_cloud_import_updates_existing_entry(
|
||||
hass: HomeAssistant,
|
||||
hass_client_no_auth: Callable[[], Awaitable[TestClient]],
|
||||
hass_client_no_auth: ClientSessionGenerator,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
current_request_with_host: None,
|
||||
mock_lametric_cloud_config_flow: MagicMock,
|
||||
|
@ -499,7 +498,7 @@ async def test_discovery_updates_existing_entry(
|
|||
|
||||
async def test_cloud_abort_no_devices(
|
||||
hass: HomeAssistant,
|
||||
hass_client_no_auth: Callable[[], Awaitable[TestClient]],
|
||||
hass_client_no_auth: ClientSessionGenerator,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
current_request_with_host: None,
|
||||
mock_lametric_cloud_config_flow: MagicMock,
|
||||
|
@ -613,7 +612,7 @@ async def test_manual_errors(
|
|||
)
|
||||
async def test_cloud_errors(
|
||||
hass: HomeAssistant,
|
||||
hass_client_no_auth: Callable[[], Awaitable[TestClient]],
|
||||
hass_client_no_auth: ClientSessionGenerator,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
current_request_with_host: None,
|
||||
mock_setup_entry: MagicMock,
|
||||
|
@ -736,7 +735,7 @@ async def test_dhcp_unknown_device(
|
|||
|
||||
async def test_reauth_cloud_import(
|
||||
hass: HomeAssistant,
|
||||
hass_client_no_auth: Callable[[], Awaitable[TestClient]],
|
||||
hass_client_no_auth: ClientSessionGenerator,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
current_request_with_host: None,
|
||||
mock_setup_entry: MagicMock,
|
||||
|
@ -800,7 +799,7 @@ async def test_reauth_cloud_import(
|
|||
|
||||
async def test_reauth_cloud_abort_device_not_found(
|
||||
hass: HomeAssistant,
|
||||
hass_client_no_auth: Callable[[], Awaitable[TestClient]],
|
||||
hass_client_no_auth: ClientSessionGenerator,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
current_request_with_host: None,
|
||||
mock_setup_entry: MagicMock,
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
"""Tests for the diagnostics data provided by the LaMetric integration."""
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
init_integration: MockConfigEntry,
|
||||
) -> None:
|
||||
"""Test diagnostics."""
|
||||
|
|
|
@ -8,7 +8,7 @@ from typing import Any
|
|||
from unittest.mock import patch
|
||||
import urllib
|
||||
|
||||
from aiohttp import ClientSession, ClientWebSocketResponse
|
||||
from aiohttp import ClientWebSocketResponse
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.local_calendar import LocalCalendarStore
|
||||
|
@ -20,6 +20,7 @@ from homeassistant.setup import async_setup_component
|
|||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
CALENDAR_NAME = "Light Schedule"
|
||||
FRIENDLY_NAME = "Light schedule"
|
||||
|
@ -90,9 +91,7 @@ GetEventsFn = Callable[[str, str], Awaitable[dict[str, Any]]]
|
|||
|
||||
|
||||
@pytest.fixture(name="get_events")
|
||||
def get_events_fixture(
|
||||
hass_client: Callable[..., Awaitable[ClientSession]]
|
||||
) -> GetEventsFn:
|
||||
def get_events_fixture(hass_client: ClientSessionGenerator) -> GetEventsFn:
|
||||
"""Fetch calendar events from the HTTP API."""
|
||||
|
||||
async def _fetch(start: str, end: str) -> None:
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
"""Tests for the diagnostics data provided by the Sensor.Community integration."""
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
init_integration: MockConfigEntry,
|
||||
):
|
||||
"""Test diagnostics."""
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
"""Test the Matter diagnostics platform."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Awaitable, Callable
|
||||
import json
|
||||
from typing import Any
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from aiohttp import ClientSession
|
||||
from matter_server.common.helpers.util import dataclass_from_dict
|
||||
from matter_server.common.models.server_information import ServerDiagnostics
|
||||
import pytest
|
||||
|
@ -23,6 +21,7 @@ from tests.components.diagnostics import (
|
|||
get_diagnostics_for_config_entry,
|
||||
get_diagnostics_for_device,
|
||||
)
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
@pytest.fixture(name="config_entry_diagnostics")
|
||||
|
@ -61,7 +60,7 @@ async def test_matter_attribute_redact(device_diagnostics: dict[str, Any]) -> No
|
|||
|
||||
async def test_config_entry_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: Callable[..., Awaitable[ClientSession]],
|
||||
hass_client: ClientSessionGenerator,
|
||||
matter_client: MagicMock,
|
||||
integration: MockConfigEntry,
|
||||
config_entry_diagnostics: dict[str, Any],
|
||||
|
@ -79,7 +78,7 @@ async def test_config_entry_diagnostics(
|
|||
|
||||
async def test_device_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: Callable[..., Awaitable[ClientSession]],
|
||||
hass_client: ClientSessionGenerator,
|
||||
matter_client: MagicMock,
|
||||
config_entry_diagnostics: dict[str, Any],
|
||||
device_diagnostics: dict[str, Any],
|
||||
|
|
|
@ -47,6 +47,7 @@ from . import (
|
|||
)
|
||||
|
||||
from tests.common import async_capture_events, async_fire_time_changed
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
WEB_HOOK_MOTION_DETECTED_QUERY_STRING = (
|
||||
"camera_id=%t&changed_pixels=%D&despeckle_labels=%Q&event=%v&fps=%{fps}"
|
||||
|
@ -277,7 +278,9 @@ async def test_setup_camera_with_no_home_assistant_urls(
|
|||
assert entity_state
|
||||
|
||||
|
||||
async def test_good_query(hass: HomeAssistant, hass_client_no_auth: Any) -> None:
|
||||
async def test_good_query(
|
||||
hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator
|
||||
) -> None:
|
||||
"""Test good callbacks."""
|
||||
await async_setup_component(hass, "http", {"http": {}})
|
||||
|
||||
|
@ -320,7 +323,7 @@ async def test_good_query(hass: HomeAssistant, hass_client_no_auth: Any) -> None
|
|||
|
||||
|
||||
async def test_bad_query_missing_parameters(
|
||||
hass: HomeAssistant, hass_client_no_auth: Any
|
||||
hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator
|
||||
) -> None:
|
||||
"""Test a query with missing parameters."""
|
||||
await async_setup_component(hass, "http", {"http": {}})
|
||||
|
@ -335,7 +338,7 @@ async def test_bad_query_missing_parameters(
|
|||
|
||||
|
||||
async def test_bad_query_no_such_device(
|
||||
hass: HomeAssistant, hass_client_no_auth: Any
|
||||
hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator
|
||||
) -> None:
|
||||
"""Test a correct query with incorrect device."""
|
||||
await async_setup_component(hass, "http", {"http": {}})
|
||||
|
@ -354,7 +357,7 @@ async def test_bad_query_no_such_device(
|
|||
|
||||
|
||||
async def test_bad_query_cannot_decode(
|
||||
hass: HomeAssistant, hass_client_no_auth: Any
|
||||
hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator
|
||||
) -> None:
|
||||
"""Test a correct query with incorrect device."""
|
||||
await async_setup_component(hass, "http", {"http": {}})
|
||||
|
@ -374,7 +377,9 @@ async def test_bad_query_cannot_decode(
|
|||
assert not storage_events
|
||||
|
||||
|
||||
async def test_event_media_data(hass: HomeAssistant, hass_client_no_auth: Any) -> None:
|
||||
async def test_event_media_data(
|
||||
hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator
|
||||
) -> None:
|
||||
"""Test an event with a file path generates media data."""
|
||||
await async_setup_component(hass, "http", {"http": {}})
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
"""Test NextDNS diagnostics."""
|
||||
from collections.abc import Awaitable, Callable
|
||||
import json
|
||||
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
|
@ -11,10 +8,11 @@ from . import init_integration
|
|||
|
||||
from tests.common import load_fixture
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_entry_diagnostics(
|
||||
hass: HomeAssistant, hass_client: Callable[..., Awaitable[ClientSession]]
|
||||
hass: HomeAssistant, hass_client: ClientSessionGenerator
|
||||
) -> None:
|
||||
"""Test config entry diagnostics."""
|
||||
settings = json.loads(load_fixture("settings.json", "nextdns"))
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
"""Tests for the diagnostics data provided by the P1 Monitor integration."""
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
init_integration: MockConfigEntry,
|
||||
):
|
||||
"""Test diagnostics."""
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
"""Tests for the diagnostics data provided by the Plugwise integration."""
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
mock_smile_adam: MagicMock,
|
||||
init_integration: MockConfigEntry,
|
||||
) -> None:
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
"""Tests for the diagnostics data provided by the Pure Energie integration."""
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
init_integration: MockConfigEntry,
|
||||
) -> None:
|
||||
"""Test diagnostics."""
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
"""Tests for the diagnostics data provided by the PVOutput integration."""
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
init_integration: MockConfigEntry,
|
||||
):
|
||||
"""Test diagnostics."""
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""The diagnostics tests for the QNAP QSW platform."""
|
||||
|
||||
from aiohttp import ClientSession
|
||||
from aioqsw.const import (
|
||||
API_ANOMALY,
|
||||
API_BUILD_NUMBER,
|
||||
|
@ -46,10 +45,11 @@ from .util import (
|
|||
)
|
||||
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_config_entry_diagnostics(
|
||||
hass: HomeAssistant, hass_client: ClientSession
|
||||
hass: HomeAssistant, hass_client: ClientSessionGenerator
|
||||
) -> None:
|
||||
"""Test config entry diagnostics."""
|
||||
await async_init_integration(hass)
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
"""Tests for the diagnostics data provided by the RDW integration."""
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
init_integration: MockConfigEntry,
|
||||
):
|
||||
"""Test diagnostics."""
|
||||
|
|
|
@ -5,7 +5,7 @@ from collections.abc import Awaitable, Callable
|
|||
from http import HTTPStatus
|
||||
from unittest.mock import ANY, AsyncMock, Mock
|
||||
|
||||
from aiohttp import ClientSession, ClientWebSocketResponse
|
||||
from aiohttp import ClientWebSocketResponse
|
||||
from freezegun import freeze_time
|
||||
import pytest
|
||||
import voluptuous as vol
|
||||
|
@ -19,6 +19,7 @@ from homeassistant.helpers import issue_registry
|
|||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import mock_platform
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
DEFAULT_ISSUES = [
|
||||
{
|
||||
|
@ -509,7 +510,7 @@ async def test_list_issues(hass: HomeAssistant, hass_storage, hass_ws_client) ->
|
|||
|
||||
async def test_fix_issue_aborted(
|
||||
hass: HomeAssistant,
|
||||
hass_client: Callable[..., Awaitable[ClientSession]],
|
||||
hass_client: ClientSessionGenerator,
|
||||
hass_ws_client: Callable[[HomeAssistant], Awaitable[ClientWebSocketResponse]],
|
||||
) -> None:
|
||||
"""Test we can fix an issue."""
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
"""Tests for the diagnostics data provided by the Roku integration."""
|
||||
import json
|
||||
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry, load_fixture
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
init_integration: MockConfigEntry,
|
||||
):
|
||||
"""Test diagnostics for config entry."""
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"""Test samsungtv diagnostics."""
|
||||
from unittest.mock import Mock
|
||||
|
||||
from aiohttp import ClientSession
|
||||
import pytest
|
||||
from samsungtvws.exceptions import HttpApiError
|
||||
|
||||
|
@ -17,11 +16,12 @@ from .const import (
|
|||
from .test_media_player import MOCK_ENTRY_WS_WITH_MAC
|
||||
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("remotews", "rest_api")
|
||||
async def test_entry_diagnostics(
|
||||
hass: HomeAssistant, hass_client: ClientSession
|
||||
hass: HomeAssistant, hass_client: ClientSessionGenerator
|
||||
) -> None:
|
||||
"""Test config entry diagnostics."""
|
||||
config_entry = await setup_samsungtv_entry(hass, MOCK_ENTRY_WS_WITH_MAC)
|
||||
|
@ -55,7 +55,7 @@ async def test_entry_diagnostics(
|
|||
|
||||
@pytest.mark.usefixtures("remoteencws")
|
||||
async def test_entry_diagnostics_encrypted(
|
||||
hass: HomeAssistant, rest_api: Mock, hass_client: ClientSession
|
||||
hass: HomeAssistant, rest_api: Mock, hass_client: ClientSessionGenerator
|
||||
) -> None:
|
||||
"""Test config entry diagnostics."""
|
||||
rest_api.rest_device_info.return_value = SAMPLE_DEVICE_INFO_UE48JU6400
|
||||
|
@ -91,7 +91,7 @@ async def test_entry_diagnostics_encrypted(
|
|||
|
||||
@pytest.mark.usefixtures("remoteencws")
|
||||
async def test_entry_diagnostics_encrypte_offline(
|
||||
hass: HomeAssistant, rest_api: Mock, hass_client: ClientSession
|
||||
hass: HomeAssistant, rest_api: Mock, hass_client: ClientSessionGenerator
|
||||
) -> None:
|
||||
"""Test config entry diagnostics."""
|
||||
rest_api.rest_device_info.side_effect = HttpApiError
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
"""Test Sensibo diagnostics."""
|
||||
from __future__ import annotations
|
||||
|
||||
import aiohttp
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant, hass_client: aiohttp.client, load_int: ConfigEntry
|
||||
hass: HomeAssistant, hass_client: ClientSessionGenerator, load_int: ConfigEntry
|
||||
):
|
||||
"""Test generating diagnostics for a config entry."""
|
||||
entry = load_int
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"""Tests for Shelly diagnostics platform."""
|
||||
from unittest.mock import ANY
|
||||
|
||||
from aiohttp import ClientSession
|
||||
from aioshelly.ble.const import BLE_SCAN_RESULT_EVENT
|
||||
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
|
@ -17,12 +16,13 @@ from . import init_integration, inject_rpc_device_event
|
|||
from .conftest import MOCK_STATUS_COAP
|
||||
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
RELAY_BLOCK_ID = 0
|
||||
|
||||
|
||||
async def test_block_config_entry_diagnostics(
|
||||
hass: HomeAssistant, hass_client: ClientSession, mock_block_device
|
||||
hass: HomeAssistant, hass_client: ClientSessionGenerator, mock_block_device
|
||||
):
|
||||
"""Test config entry diagnostics for block device."""
|
||||
await init_integration(hass, 1)
|
||||
|
@ -50,7 +50,7 @@ async def test_block_config_entry_diagnostics(
|
|||
|
||||
async def test_rpc_config_entry_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
mock_rpc_device,
|
||||
monkeypatch,
|
||||
):
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
"""Tests for the diagnostics data provided by Switcher."""
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
@ -8,10 +7,11 @@ from . import init_integration
|
|||
from .consts import DUMMY_WATER_HEATER_DEVICE
|
||||
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant, hass_client: ClientSession, mock_bridge, monkeypatch
|
||||
hass: HomeAssistant, hass_client: ClientSessionGenerator, mock_bridge, monkeypatch
|
||||
) -> None:
|
||||
"""Test diagnostics."""
|
||||
entry = await init_integration(hass)
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
"""Tests for the diagnostics data provided by the Tailscale integration."""
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
init_integration: MockConfigEntry,
|
||||
):
|
||||
"""Test diagnostics."""
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"""Tests for the diagnostics data provided by the TP-Link integration."""
|
||||
import json
|
||||
|
||||
from aiohttp import ClientSession
|
||||
from kasa import SmartDevice
|
||||
import pytest
|
||||
|
||||
|
@ -11,6 +10,7 @@ from . import _mocked_bulb, _mocked_plug, initialize_config_entry_for_device
|
|||
|
||||
from tests.common import load_fixture
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
@ -30,7 +30,7 @@ from tests.components.diagnostics import get_diagnostics_for_config_entry
|
|||
)
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
mocked_dev: SmartDevice,
|
||||
fixture_file: str,
|
||||
sysinfo_vars: list[str],
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
"""Tests for Tradfri diagnostics."""
|
||||
from unittest.mock import MagicMock, Mock
|
||||
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .common import setup_integration
|
||||
from .test_fan import mock_fan
|
||||
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
mock_gateway: Mock,
|
||||
mock_api_factory: MagicMock,
|
||||
) -> None:
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
"""Tests for the diagnostics data provided by the TwenteMilieu integration."""
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
init_integration: MockConfigEntry,
|
||||
):
|
||||
"""Test diagnostics."""
|
||||
|
|
|
@ -17,12 +17,12 @@ from homeassistant.core import HomeAssistant
|
|||
|
||||
from .utils import MockUFPFixture, init_entry
|
||||
|
||||
from tests.test_util.aiohttp import mock_aiohttp_client
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_thumbnail_bad_nvr_id(
|
||||
hass: HomeAssistant,
|
||||
hass_client: mock_aiohttp_client,
|
||||
hass_client: ClientSessionGenerator,
|
||||
ufp: MockUFPFixture,
|
||||
camera: Camera,
|
||||
) -> None:
|
||||
|
@ -43,7 +43,7 @@ async def test_thumbnail_bad_nvr_id(
|
|||
@pytest.mark.parametrize("width,height", [("test", None), (None, "test")])
|
||||
async def test_thumbnail_bad_params(
|
||||
hass: HomeAssistant,
|
||||
hass_client: mock_aiohttp_client,
|
||||
hass_client: ClientSessionGenerator,
|
||||
ufp: MockUFPFixture,
|
||||
camera: Camera,
|
||||
width: Any,
|
||||
|
@ -67,7 +67,7 @@ async def test_thumbnail_bad_params(
|
|||
|
||||
async def test_thumbnail_bad_event(
|
||||
hass: HomeAssistant,
|
||||
hass_client: mock_aiohttp_client,
|
||||
hass_client: ClientSessionGenerator,
|
||||
ufp: MockUFPFixture,
|
||||
camera: Camera,
|
||||
) -> None:
|
||||
|
@ -87,7 +87,7 @@ async def test_thumbnail_bad_event(
|
|||
|
||||
async def test_thumbnail_no_data(
|
||||
hass: HomeAssistant,
|
||||
hass_client: mock_aiohttp_client,
|
||||
hass_client: ClientSessionGenerator,
|
||||
ufp: MockUFPFixture,
|
||||
camera: Camera,
|
||||
) -> None:
|
||||
|
@ -107,7 +107,7 @@ async def test_thumbnail_no_data(
|
|||
|
||||
async def test_thumbnail(
|
||||
hass: HomeAssistant,
|
||||
hass_client: mock_aiohttp_client,
|
||||
hass_client: ClientSessionGenerator,
|
||||
ufp: MockUFPFixture,
|
||||
camera: Camera,
|
||||
) -> None:
|
||||
|
@ -129,7 +129,7 @@ async def test_thumbnail(
|
|||
|
||||
async def test_thumbnail_entry_id(
|
||||
hass: HomeAssistant,
|
||||
hass_client: mock_aiohttp_client,
|
||||
hass_client: ClientSessionGenerator,
|
||||
ufp: MockUFPFixture,
|
||||
camera: Camera,
|
||||
) -> None:
|
||||
|
@ -230,7 +230,7 @@ async def test_video_bad_perms(
|
|||
|
||||
async def test_video_bad_nvr_id(
|
||||
hass: HomeAssistant,
|
||||
hass_client: mock_aiohttp_client,
|
||||
hass_client: ClientSessionGenerator,
|
||||
ufp: MockUFPFixture,
|
||||
camera: Camera,
|
||||
fixed_now: datetime,
|
||||
|
@ -264,7 +264,7 @@ async def test_video_bad_nvr_id(
|
|||
|
||||
async def test_video_bad_camera_id(
|
||||
hass: HomeAssistant,
|
||||
hass_client: mock_aiohttp_client,
|
||||
hass_client: ClientSessionGenerator,
|
||||
ufp: MockUFPFixture,
|
||||
camera: Camera,
|
||||
fixed_now: datetime,
|
||||
|
@ -298,7 +298,7 @@ async def test_video_bad_camera_id(
|
|||
|
||||
async def test_video_bad_camera_perms(
|
||||
hass: HomeAssistant,
|
||||
hass_client: mock_aiohttp_client,
|
||||
hass_client: ClientSessionGenerator,
|
||||
ufp: MockUFPFixture,
|
||||
camera: Camera,
|
||||
fixed_now: datetime,
|
||||
|
@ -335,7 +335,7 @@ async def test_video_bad_camera_perms(
|
|||
@pytest.mark.parametrize("start,end", [("test", None), (None, "test")])
|
||||
async def test_video_bad_params(
|
||||
hass: HomeAssistant,
|
||||
hass_client: mock_aiohttp_client,
|
||||
hass_client: ClientSessionGenerator,
|
||||
ufp: MockUFPFixture,
|
||||
camera: Camera,
|
||||
fixed_now: datetime,
|
||||
|
@ -374,7 +374,7 @@ async def test_video_bad_params(
|
|||
|
||||
async def test_video_bad_video(
|
||||
hass: HomeAssistant,
|
||||
hass_client: mock_aiohttp_client,
|
||||
hass_client: ClientSessionGenerator,
|
||||
ufp: MockUFPFixture,
|
||||
camera: Camera,
|
||||
fixed_now: datetime,
|
||||
|
@ -408,7 +408,7 @@ async def test_video_bad_video(
|
|||
|
||||
async def test_video(
|
||||
hass: HomeAssistant,
|
||||
hass_client: mock_aiohttp_client,
|
||||
hass_client: ClientSessionGenerator,
|
||||
ufp: MockUFPFixture,
|
||||
camera: Camera,
|
||||
fixed_now: datetime,
|
||||
|
@ -451,7 +451,7 @@ async def test_video(
|
|||
|
||||
async def test_video_entity_id(
|
||||
hass: HomeAssistant,
|
||||
hass_client: mock_aiohttp_client,
|
||||
hass_client: ClientSessionGenerator,
|
||||
ufp: MockUFPFixture,
|
||||
camera: Camera,
|
||||
fixed_now: datetime,
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
import json
|
||||
from unittest.mock import patch
|
||||
|
||||
from aiohttp import ClientSession
|
||||
from pyuptimerobot import UptimeRobotException
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
@ -17,11 +16,12 @@ from .common import (
|
|||
)
|
||||
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_entry_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
) -> None:
|
||||
"""Test config entry diagnostics."""
|
||||
entry = await setup_uptimerobot_integration(hass)
|
||||
|
@ -58,7 +58,7 @@ async def test_entry_diagnostics(
|
|||
|
||||
async def test_entry_diagnostics_exception(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
) -> None:
|
||||
"""Test config entry diagnostics with exception."""
|
||||
entry = await setup_uptimerobot_integration(hass)
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
"""Test version diagnostics."""
|
||||
|
||||
|
||||
from aioaseko import ClientSession
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .common import MOCK_VERSION, setup_version_integration
|
||||
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
) -> None:
|
||||
"""Test diagnostic information."""
|
||||
config_entry = await setup_version_integration(hass)
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
"""Tests for the diagnostics data provided by LG webOS Smart TV."""
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import setup_webostv
|
||||
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant, hass_client: ClientSession, client
|
||||
hass: HomeAssistant, hass_client: ClientSessionGenerator, client
|
||||
) -> None:
|
||||
"""Test diagnostics."""
|
||||
entry = await setup_webostv(hass)
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
"""Tests for the diagnostics data provided by the Whois integration."""
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
init_integration: MockConfigEntry,
|
||||
):
|
||||
"""Test diagnostics."""
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
"""Tests for the diagnostics data provided by the WLED integration."""
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
hass_client: ClientSessionGenerator,
|
||||
init_integration: MockConfigEntry,
|
||||
):
|
||||
"""Test diagnostics."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue