Drop asynctest (#44746)
This commit is contained in:
parent
2b0556520b
commit
65cf2fcb6f
906 changed files with 1360 additions and 1254 deletions
|
@ -4,7 +4,6 @@
|
|||
|
||||
-c homeassistant/package_constraints.txt
|
||||
-r requirements_test_pre_commit.txt
|
||||
asynctest==0.13.0
|
||||
codecov==2.1.10
|
||||
coverage==5.3
|
||||
jsonpickle==1.4.1
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
"""Test the NEW_NAME config flow."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant import config_entries, setup
|
||||
from homeassistant.components.NEW_DOMAIN.config_flow import CannotConnect, InvalidAuth
|
||||
from homeassistant.components.NEW_DOMAIN.const import DOMAIN
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
|
||||
async def test_form(hass):
|
||||
"""Test we get the form."""
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Test the NEW_NAME config flow."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant import config_entries, setup
|
||||
from homeassistant.components.NEW_DOMAIN.const import (
|
||||
DOMAIN,
|
||||
|
@ -7,8 +9,6 @@ from homeassistant.components.NEW_DOMAIN.const import (
|
|||
)
|
||||
from homeassistant.helpers import config_entry_oauth2_flow
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
CLIENT_ID = "1234"
|
||||
CLIENT_SECRET = "5678"
|
||||
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
"""Mock utilities that are async aware."""
|
||||
import sys
|
||||
|
||||
if sys.version_info[:2] < (3, 8):
|
||||
from asynctest.mock import * # noqa
|
||||
|
||||
AsyncMock = CoroutineMock # noqa: F405
|
||||
else:
|
||||
from unittest.mock import * # noqa
|
|
@ -1,12 +1,12 @@
|
|||
"""Test the HMAC-based One Time Password (MFA) auth module."""
|
||||
import asyncio
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant import data_entry_flow
|
||||
from homeassistant.auth import auth_manager_from_config, models as auth_models
|
||||
from homeassistant.auth.mfa_modules import auth_mfa_module_from_config
|
||||
from homeassistant.components.notify import NOTIFY_SERVICE_SCHEMA
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockUser, async_mock_service
|
||||
|
||||
MOCK_CODE = "123456"
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
"""Test the Time-based One Time Password (MFA) auth module."""
|
||||
import asyncio
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant import data_entry_flow
|
||||
from homeassistant.auth import auth_manager_from_config, models as auth_models
|
||||
from homeassistant.auth.mfa_modules import auth_mfa_module_from_config
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockUser
|
||||
|
||||
MOCK_CODE = "123456"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Tests for the command_line auth provider."""
|
||||
|
||||
import os
|
||||
from unittest.mock import AsyncMock
|
||||
import uuid
|
||||
|
||||
import pytest
|
||||
|
@ -10,8 +11,6 @@ from homeassistant.auth import AuthManager, auth_store, models as auth_models
|
|||
from homeassistant.auth.providers import command_line
|
||||
from homeassistant.const import CONF_TYPE
|
||||
|
||||
from tests.async_mock import AsyncMock
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def store(hass):
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""Test the Home Assistant local auth provider."""
|
||||
import asyncio
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import pytest
|
||||
import voluptuous as vol
|
||||
|
@ -11,8 +12,6 @@ from homeassistant.auth.providers import (
|
|||
homeassistant as hass_auth,
|
||||
)
|
||||
|
||||
from tests.async_mock import Mock, patch
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def data(hass):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tests for the insecure example auth provider."""
|
||||
from unittest.mock import AsyncMock
|
||||
import uuid
|
||||
|
||||
import pytest
|
||||
|
@ -6,8 +7,6 @@ import pytest
|
|||
from homeassistant.auth import AuthManager, auth_store, models as auth_models
|
||||
from homeassistant.auth.providers import insecure_example
|
||||
|
||||
from tests.async_mock import AsyncMock
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def store(hass):
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
"""Tests for the auth store."""
|
||||
import asyncio
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.auth import auth_store
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
|
||||
async def test_loading_no_group_data_format(hass, hass_storage):
|
||||
"""Test we correctly load old data without any groups."""
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""Tests for the Home Assistant auth module."""
|
||||
from datetime import timedelta
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import jwt
|
||||
import pytest
|
||||
|
@ -11,7 +12,6 @@ from homeassistant.auth.const import MFA_SESSION_EXPIRATION
|
|||
from homeassistant.core import callback
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from tests.async_mock import Mock, patch
|
||||
from tests.common import CLIENT_ID, MockUser, ensure_auth_manager_loaded, flush_store
|
||||
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import os
|
|||
import pathlib
|
||||
import threading
|
||||
import time
|
||||
from unittest.mock import AsyncMock, Mock, patch
|
||||
import uuid
|
||||
|
||||
from aiohttp.test_utils import unused_port as get_test_instance_port # noqa
|
||||
|
@ -60,8 +61,6 @@ import homeassistant.util.dt as date_util
|
|||
from homeassistant.util.unit_system import METRIC_SYSTEM
|
||||
import homeassistant.util.yaml.loader as yaml_loader
|
||||
|
||||
from tests.async_mock import AsyncMock, Mock, patch
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
INSTANCES = []
|
||||
CLIENT_ID = "https://example.com/app"
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
"""Common methods used across tests for Abode."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.abode import DOMAIN as ABODE_DOMAIN
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Tests for the Abode alarm control panel device."""
|
||||
from unittest.mock import PropertyMock, patch
|
||||
|
||||
import abodepy.helpers.constants as CONST
|
||||
|
||||
from homeassistant.components.abode import ATTR_DEVICE_ID
|
||||
|
@ -17,8 +19,6 @@ from homeassistant.const import (
|
|||
|
||||
from .common import setup_platform
|
||||
|
||||
from tests.async_mock import PropertyMock, patch
|
||||
|
||||
DEVICE_ID = "alarm_control_panel.abode_alarm"
|
||||
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
"""Tests for the Abode camera device."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.abode.const import DOMAIN as ABODE_DOMAIN
|
||||
from homeassistant.components.camera import DOMAIN as CAMERA_DOMAIN
|
||||
from homeassistant.const import ATTR_ENTITY_ID, STATE_IDLE
|
||||
|
||||
from .common import setup_platform
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
|
||||
async def test_entity_registry(hass):
|
||||
"""Tests that the devices are registered in the entity registry."""
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Tests for the Abode config flow."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from abodepy.exceptions import AbodeAuthenticationException
|
||||
from abodepy.helpers.errors import MFA_CODE_REQUIRED
|
||||
|
||||
|
@ -13,7 +15,6 @@ from homeassistant.const import (
|
|||
HTTP_INTERNAL_SERVER_ERROR,
|
||||
)
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
CONF_POLLING = "polling"
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Tests for the Abode cover device."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.abode import ATTR_DEVICE_ID
|
||||
from homeassistant.components.cover import DOMAIN as COVER_DOMAIN
|
||||
from homeassistant.const import (
|
||||
|
@ -11,8 +13,6 @@ from homeassistant.const import (
|
|||
|
||||
from .common import setup_platform
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
DEVICE_ID = "cover.garage_door"
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Tests for the Abode module."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from abodepy.exceptions import AbodeAuthenticationException
|
||||
|
||||
from homeassistant.components.abode import (
|
||||
|
@ -12,8 +14,6 @@ from homeassistant.const import CONF_USERNAME, HTTP_BAD_REQUEST
|
|||
|
||||
from .common import setup_platform
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
|
||||
async def test_change_settings(hass):
|
||||
"""Test change_setting service."""
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Tests for the Abode light device."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.abode import ATTR_DEVICE_ID
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS,
|
||||
|
@ -17,8 +19,6 @@ from homeassistant.const import (
|
|||
|
||||
from .common import setup_platform
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
DEVICE_ID = "light.living_room_lamp"
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Tests for the Abode lock device."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.abode import ATTR_DEVICE_ID
|
||||
from homeassistant.components.lock import DOMAIN as LOCK_DOMAIN
|
||||
from homeassistant.const import (
|
||||
|
@ -11,8 +13,6 @@ from homeassistant.const import (
|
|||
|
||||
from .common import setup_platform
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
DEVICE_ID = "lock.test_lock"
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Tests for the Abode switch device."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.abode import (
|
||||
DOMAIN as ABODE_DOMAIN,
|
||||
SERVICE_TRIGGER_AUTOMATION,
|
||||
|
@ -14,8 +16,6 @@ from homeassistant.const import (
|
|||
|
||||
from .common import setup_platform
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
AUTOMATION_ID = "switch.test_automation"
|
||||
AUTOMATION_UID = "47fae27488f74f55b964a81a066c3a01"
|
||||
DEVICE_ID = "switch.test_switch"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
"""Tests for AccuWeather."""
|
||||
import json
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.accuweather.const import DOMAIN
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry, load_fixture
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""Define tests for the AccuWeather config flow."""
|
||||
import json
|
||||
from unittest.mock import patch
|
||||
|
||||
from accuweather import ApiError, InvalidApiKeyError, RequestsExceededError
|
||||
|
||||
|
@ -8,7 +9,6 @@ from homeassistant.components.accuweather.const import CONF_FORECAST, DOMAIN
|
|||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry, load_fixture
|
||||
|
||||
VALID_CONFIG = {
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Test init of AccuWeather integration."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.accuweather.const import DOMAIN
|
||||
from homeassistant.config_entries import (
|
||||
ENTRY_STATE_LOADED,
|
||||
|
@ -7,7 +9,6 @@ from homeassistant.config_entries import (
|
|||
)
|
||||
from homeassistant.const import STATE_UNAVAILABLE
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.accuweather import init_integration
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Test sensor of AccuWeather integration."""
|
||||
from datetime import timedelta
|
||||
import json
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.accuweather.const import ATTRIBUTION, DOMAIN
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||
|
@ -24,7 +25,6 @@ from homeassistant.const import (
|
|||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import async_fire_time_changed, load_fixture
|
||||
from tests.components.accuweather import init_integration
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
"""Test AccuWeather system health."""
|
||||
import asyncio
|
||||
from unittest.mock import Mock
|
||||
|
||||
from aiohttp import ClientError
|
||||
|
||||
from homeassistant.components.accuweather.const import COORDINATOR, DOMAIN
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import Mock
|
||||
from tests.common import get_system_health_info
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Test weather of AccuWeather integration."""
|
||||
from datetime import timedelta
|
||||
import json
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.accuweather.const import ATTRIBUTION
|
||||
from homeassistant.components.weather import (
|
||||
|
@ -25,7 +26,6 @@ from homeassistant.const import ATTR_ATTRIBUTION, ATTR_ENTITY_ID, STATE_UNAVAILA
|
|||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import async_fire_time_changed, load_fixture
|
||||
from tests.components.accuweather import init_integration
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Define tests for the Acmeda config flow."""
|
||||
from unittest.mock import patch
|
||||
|
||||
import aiopulse
|
||||
import pytest
|
||||
|
||||
|
@ -7,7 +9,6 @@ from homeassistant.components.acmeda.const import DOMAIN
|
|||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.const import CONF_HOST
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
DUMMY_HOST1 = "127.0.0.1"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
"""Tests for the AdGuard Home config flow."""
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
import aiohttp
|
||||
|
||||
from homeassistant import config_entries, data_entry_flow
|
||||
|
@ -15,7 +17,6 @@ from homeassistant.const import (
|
|||
CONTENT_TYPE_JSON,
|
||||
)
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
FIXTURE_USER_INPUT = {
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
"""Test the Advantage Air config flow."""
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant import config_entries, data_entry_flow
|
||||
from homeassistant.components.advantage_air.const import DOMAIN
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.components.advantage_air import TEST_SYSTEM_DATA, TEST_SYSTEM_URL, USER_INPUT
|
||||
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
"""Test Airly system health."""
|
||||
import asyncio
|
||||
from unittest.mock import Mock
|
||||
|
||||
from aiohttp import ClientError
|
||||
|
||||
from homeassistant.components.airly.const import DOMAIN
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import Mock
|
||||
from tests.common import get_system_health_info
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
"""Test the AirNow config flow."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from pyairnow.errors import AirNowError, InvalidKeyError
|
||||
|
||||
from homeassistant import config_entries, data_entry_flow, setup
|
||||
from homeassistant.components.airnow.const import DOMAIN
|
||||
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, CONF_RADIUS
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
CONFIG = {
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Define tests for the AirVisual config flow."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from pyairvisual.errors import InvalidKeyError, NodeProError
|
||||
|
||||
from homeassistant import data_entry_flow
|
||||
|
@ -20,7 +22,6 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Test the AlarmDecoder config flow."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from alarmdecoder.util import NoDeviceError
|
||||
import pytest
|
||||
|
||||
|
@ -29,7 +31,6 @@ from homeassistant.components.binary_sensor import DEVICE_CLASS_WINDOW
|
|||
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_PROTOCOL
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Test Alexa capabilities."""
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.alexa import smart_home
|
||||
|
@ -33,7 +35,6 @@ from . import (
|
|||
reported_properties,
|
||||
)
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import async_mock_service
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
"""Test Alexa entity representation."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.alexa import smart_home
|
||||
|
||||
from . import DEFAULT_CONFIG, get_new_request
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
|
||||
async def test_unsupported_domain(hass):
|
||||
"""Discovery ignores entities of unknown domains."""
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
"""Test for smart home alexa support."""
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.alexa import messages, smart_home
|
||||
|
@ -40,7 +42,6 @@ from . import (
|
|||
reported_properties,
|
||||
)
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import async_mock_service
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""Test the Almond config flow."""
|
||||
import asyncio
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant import config_entries, data_entry_flow, setup
|
||||
from homeassistant.components.almond import config_flow
|
||||
|
@ -7,7 +8,6 @@ from homeassistant.components.almond.const import DOMAIN
|
|||
from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET
|
||||
from homeassistant.helpers import config_entry_oauth2_flow
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
CLIENT_ID_VALUE = "1234"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""Tests for Almond set up."""
|
||||
from time import time
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -10,7 +11,6 @@ from homeassistant.const import EVENT_HOMEASSISTANT_START
|
|||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry, async_fire_time_changed
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Tests for the Ambiclimate config flow."""
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
import ambiclimate
|
||||
|
||||
from homeassistant import data_entry_flow
|
||||
|
@ -7,8 +9,6 @@ from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET
|
|||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util import aiohttp
|
||||
|
||||
from tests.async_mock import AsyncMock, patch
|
||||
|
||||
|
||||
async def init_config_flow(hass):
|
||||
"""Init a configuration flow."""
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""Define patches used for androidtv tests."""
|
||||
|
||||
from tests.async_mock import mock_open, patch
|
||||
from unittest.mock import mock_open, patch
|
||||
|
||||
KEY_PYTHON = "python"
|
||||
KEY_SERVER = "server"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import base64
|
||||
import copy
|
||||
import logging
|
||||
from unittest.mock import patch
|
||||
|
||||
from androidtv.constants import APPS as ANDROIDTV_APPS
|
||||
from androidtv.exceptions import LockNotAcquiredException
|
||||
|
@ -58,7 +59,6 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.components.androidtv import patchers
|
||||
|
||||
SHELL_RESPONSE_OFF = ""
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
from asyncio import AbstractEventLoop
|
||||
from dataclasses import dataclass
|
||||
from typing import Callable, Type
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -9,8 +10,6 @@ import homeassistant.components.apache_kafka as apache_kafka
|
|||
from homeassistant.const import STATE_ON
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
APACHE_KAFKA_PATH = "homeassistant.components.apache_kafka"
|
||||
PRODUCER_PATH = f"{APACHE_KAFKA_PATH}.AIOKafkaProducer"
|
||||
MIN_CONFIG = {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""The tests for the Home Assistant API component."""
|
||||
# pylint: disable=protected-access
|
||||
import json
|
||||
from unittest.mock import patch
|
||||
|
||||
from aiohttp import web
|
||||
import pytest
|
||||
|
@ -11,7 +12,6 @@ from homeassistant.bootstrap import DATA_LOGGING
|
|||
import homeassistant.core as ha
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import async_mock_service
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""The tests for the APNS component."""
|
||||
import io
|
||||
from unittest.mock import Mock, mock_open, patch
|
||||
|
||||
from apns2.errors import Unregistered
|
||||
import pytest
|
||||
|
@ -10,7 +11,6 @@ import homeassistant.components.notify as notify
|
|||
from homeassistant.core import State
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import Mock, mock_open, patch
|
||||
from tests.common import assert_setup_component
|
||||
|
||||
CONFIG = {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
"""Fixtures for component."""
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from pyatv import conf, net
|
||||
import pytest
|
||||
|
||||
from .common import MockPairingHandler, create_conf
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True, name="mock_scan")
|
||||
def mock_scan_fixture():
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
"""Test config flow."""
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from pyatv import exceptions
|
||||
from pyatv.const import Protocol
|
||||
import pytest
|
||||
|
@ -7,7 +9,6 @@ import pytest
|
|||
from homeassistant import config_entries, data_entry_flow
|
||||
from homeassistant.components.apple_tv.const import CONF_START_OFF, DOMAIN
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
DMAP_SERVICE = {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""The tests for the apprise notification platform."""
|
||||
from homeassistant.setup import async_setup_component
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from tests.async_mock import MagicMock, patch
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
BASE_COMPONENT = "notify"
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
"""Test APRS device tracker."""
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import aprslib
|
||||
|
||||
import homeassistant.components.aprs.device_tracker as device_tracker
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_START
|
||||
|
||||
from tests.async_mock import Mock, patch
|
||||
from tests.common import get_test_home_assistant
|
||||
|
||||
DEFAULT_PORT = 14580
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Tests for the arcam_fmj component."""
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from arcam.fmj.client import Client
|
||||
from arcam.fmj.state import State
|
||||
import pytest
|
||||
|
@ -7,7 +9,6 @@ from homeassistant.components.arcam_fmj.const import DEFAULT_NAME
|
|||
from homeassistant.components.arcam_fmj.media_player import ArcamFmj
|
||||
from homeassistant.const import CONF_HOST, CONF_PORT
|
||||
|
||||
from tests.async_mock import Mock, patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
MOCK_HOST = "127.0.0.1"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
"""Tests for the Arcam FMJ config flow module."""
|
||||
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
from arcam.fmj.client import ConnectionFailed
|
||||
import pytest
|
||||
|
||||
|
@ -19,7 +21,6 @@ from .conftest import (
|
|||
MOCK_UUID,
|
||||
)
|
||||
|
||||
from tests.async_mock import AsyncMock, patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
MOCK_UPNP_DEVICE = f"""
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""Tests for arcam fmj receivers."""
|
||||
from math import isclose
|
||||
from unittest.mock import ANY, MagicMock, Mock, PropertyMock, patch
|
||||
|
||||
from arcam.fmj import DecodeMode2CH, DecodeModeMCH, IncomingAudioFormat, SourceCodes
|
||||
import pytest
|
||||
|
@ -13,8 +14,6 @@ from homeassistant.const import ATTR_ENTITY_ID
|
|||
|
||||
from .conftest import MOCK_HOST, MOCK_NAME, MOCK_PORT, MOCK_UUID
|
||||
|
||||
from tests.async_mock import ANY, MagicMock, Mock, PropertyMock, patch
|
||||
|
||||
MOCK_TURN_ON = {
|
||||
"service": "switch.turn_on",
|
||||
"data": {"entity_id": "switch.test"},
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""The tests for the Netgear Arlo sensors."""
|
||||
from collections import namedtuple
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -11,8 +12,6 @@ from homeassistant.const import (
|
|||
PERCENTAGE,
|
||||
)
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
|
||||
def _get_named_tuple(input_dict):
|
||||
return namedtuple("Struct", input_dict.keys())(*input_dict.values())
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
"""The tests for the ASUSWRT device tracker platform."""
|
||||
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
from homeassistant.components.asuswrt import (
|
||||
CONF_DNSMASQ,
|
||||
CONF_INTERFACE,
|
||||
|
@ -9,8 +11,6 @@ from homeassistant.components.asuswrt import (
|
|||
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import AsyncMock, patch
|
||||
|
||||
|
||||
async def test_password_or_pub_key_required(hass):
|
||||
"""Test creating an AsusWRT scanner without a pass or pubkey."""
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
"""The tests for the AsusWrt sensor platform."""
|
||||
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
from aioasuswrt.asuswrt import Device
|
||||
|
||||
from homeassistant.components import sensor
|
||||
|
@ -16,8 +18,6 @@ from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import AsyncMock, patch
|
||||
|
||||
VALID_CONFIG_ROUTER_SSH = {
|
||||
DOMAIN: {
|
||||
CONF_DNSMASQ: "/",
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
"""Tests for the Atag climate platform."""
|
||||
|
||||
from unittest.mock import PropertyMock, patch
|
||||
|
||||
from homeassistant.components.atag import CLIMATE, DOMAIN
|
||||
from homeassistant.components.climate import (
|
||||
ATTR_HVAC_ACTION,
|
||||
|
@ -19,7 +21,6 @@ from homeassistant.const import ATTR_ENTITY_ID, ATTR_TEMPERATURE, STATE_UNKNOWN
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import PropertyMock, patch
|
||||
from tests.components.atag import UID, init_integration
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
"""Tests for the Atag config flow."""
|
||||
from unittest.mock import PropertyMock, patch
|
||||
|
||||
from pyatag import errors
|
||||
|
||||
from homeassistant import config_entries, data_entry_flow
|
||||
from homeassistant.components.atag import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.async_mock import PropertyMock, patch
|
||||
from tests.components.atag import (
|
||||
PAIR_REPLY,
|
||||
RECEIVE_REPLY,
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
"""Tests for the ATAG integration."""
|
||||
from unittest.mock import patch
|
||||
|
||||
import aiohttp
|
||||
|
||||
from homeassistant.components.atag import DOMAIN
|
||||
from homeassistant.config_entries import ENTRY_STATE_SETUP_RETRY
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.components.atag import init_integration
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
"""Tests for the Atag water heater platform."""
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.atag import DOMAIN, WATER_HEATER
|
||||
from homeassistant.components.water_heater import SERVICE_SET_TEMPERATURE
|
||||
from homeassistant.const import ATTR_ENTITY_ID, ATTR_TEMPERATURE
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.components.atag import UID, init_integration
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@ import json
|
|||
import os
|
||||
import time
|
||||
|
||||
# from unittest.mock import AsyncMock
|
||||
from unittest.mock import AsyncMock, MagicMock, PropertyMock, patch
|
||||
|
||||
from august.activity import (
|
||||
ACTIVITY_ACTIONS_DOOR_OPERATION,
|
||||
ACTIVITY_ACTIONS_DOORBELL_DING,
|
||||
|
@ -27,8 +30,6 @@ from homeassistant.components.august import (
|
|||
)
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
# from tests.async_mock import AsyncMock
|
||||
from tests.async_mock import AsyncMock, MagicMock, PropertyMock, patch
|
||||
from tests.common import load_fixture
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
"""The camera tests for the august platform."""
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.const import STATE_IDLE
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.components.august.mocks import (
|
||||
_create_august_with_devices,
|
||||
_mock_doorbell_from_fixture,
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Test the August config flow."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from august.authenticator import ValidationResult
|
||||
|
||||
from homeassistant import config_entries, setup
|
||||
|
@ -16,7 +18,6 @@ from homeassistant.components.august.exceptions import (
|
|||
)
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_TIMEOUT, CONF_USERNAME
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
"""The gateway tests for the august platform."""
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from august.authenticator_common import AuthenticationState
|
||||
|
||||
from homeassistant.components.august.const import DOMAIN
|
||||
from homeassistant.components.august.gateway import AugustGateway
|
||||
|
||||
from tests.async_mock import MagicMock, patch
|
||||
from tests.components.august.mocks import _mock_august_authentication, _mock_get_config
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""The tests for the august platform."""
|
||||
import asyncio
|
||||
from unittest.mock import patch
|
||||
|
||||
from aiohttp import ClientResponseError
|
||||
from august.authenticator_common import AuthenticationState
|
||||
|
@ -31,7 +32,6 @@ from homeassistant.const import (
|
|||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.august.mocks import (
|
||||
_create_august_with_devices,
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
"""Test the Aurora config flow."""
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant import config_entries, data_entry_flow, setup
|
||||
from homeassistant.components.aurora.const import DOMAIN
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
DATA = {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
"""Tests for the client validator."""
|
||||
import asyncio
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.auth import indieauth
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""Integration tests for the auth component."""
|
||||
from datetime import timedelta
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.auth.models import Credentials
|
||||
from homeassistant.components import auth
|
||||
|
@ -9,7 +10,6 @@ from homeassistant.util.dt import utcnow
|
|||
|
||||
from . import async_setup_auth
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import CLIENT_ID, CLIENT_REDIRECT_URI, MockUser
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
"""Tests for the login flow."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from . import async_setup_auth
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import CLIENT_ID, CLIENT_REDIRECT_URI
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ import asyncio
|
|||
import contextlib
|
||||
from datetime import timedelta
|
||||
import pathlib
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.blueprint import models
|
||||
|
@ -10,7 +11,6 @@ from homeassistant.core import callback
|
|||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util import dt as dt_util, yaml
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import async_fire_time_changed, async_mock_service
|
||||
|
||||
BUILTIN_BLUEPRINT_FOLDER = pathlib.Path(automation.__file__).parent / "blueprints"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""The tests for the automation component."""
|
||||
import asyncio
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -28,7 +29,6 @@ from homeassistant.exceptions import HomeAssistantError, Unauthorized
|
|||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from tests.async_mock import Mock, patch
|
||||
from tests.common import assert_setup_component, async_mock_service, mock_restore_cache
|
||||
from tests.components.logbook.test_init import MockLazyEventPartialState
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
"""Define tests for the Awair config flow."""
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from python_awair.exceptions import AuthError, AwairError
|
||||
|
||||
from homeassistant import data_entry_flow
|
||||
|
@ -9,7 +11,6 @@ from homeassistant.const import CONF_ACCESS_TOKEN
|
|||
|
||||
from .const import CONFIG, DEVICES_FIXTURE, NO_DEVICES_FIXTURE, UNIQUE_ID, USER_FIXTURE
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
"""Tests for the Awair sensor platform."""
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.awair.const import (
|
||||
API_CO2,
|
||||
API_HUMID,
|
||||
|
@ -40,7 +42,6 @@ from .const import (
|
|||
USER_FIXTURE,
|
||||
)
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
"""Tests for the aws component config and setup."""
|
||||
from unittest.mock import AsyncMock, MagicMock, patch as async_patch
|
||||
|
||||
from homeassistant.components import aws
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import AsyncMock, MagicMock, patch as async_patch
|
||||
|
||||
|
||||
class MockAioSession:
|
||||
"""Mock AioSession."""
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
"""Axis camera platform tests."""
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components import camera
|
||||
from homeassistant.components.axis.const import (
|
||||
CONF_STREAM_PROFILE,
|
||||
|
@ -11,8 +13,6 @@ from homeassistant.setup import async_setup_component
|
|||
|
||||
from .test_device import ENTRY_OPTIONS, NAME, setup_axis_integration
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
|
||||
async def test_platform_manually_configured(hass):
|
||||
"""Test that nothing happens when platform is manually configured."""
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Test Axis config flow."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant import data_entry_flow
|
||||
from homeassistant.components.axis import config_flow
|
||||
from homeassistant.components.axis.const import (
|
||||
|
@ -25,7 +27,6 @@ from homeassistant.data_entry_flow import (
|
|||
|
||||
from .test_device import MAC, MODEL, NAME, setup_axis_integration, vapix_request
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Test Axis device."""
|
||||
from copy import deepcopy
|
||||
from unittest import mock
|
||||
from unittest.mock import AsyncMock, Mock, patch
|
||||
|
||||
import axis as axislib
|
||||
from axis.api_discovery import URL as API_DISCOVERY_URL
|
||||
|
@ -40,7 +41,6 @@ from homeassistant.const import (
|
|||
STATE_ON,
|
||||
)
|
||||
|
||||
from tests.async_mock import AsyncMock, Mock, patch
|
||||
from tests.common import MockConfigEntry, async_fire_mqtt_message
|
||||
|
||||
MAC = "00408C12345"
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Test Axis component setup process."""
|
||||
from unittest.mock import AsyncMock, Mock, patch
|
||||
|
||||
from homeassistant.components import axis
|
||||
from homeassistant.components.axis.const import CONF_MODEL, DOMAIN as AXIS_DOMAIN
|
||||
from homeassistant.const import (
|
||||
|
@ -14,7 +16,6 @@ from homeassistant.setup import async_setup_component
|
|||
|
||||
from .test_device import MAC, setup_axis_integration
|
||||
|
||||
from tests.async_mock import AsyncMock, Mock, patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Axis light platform tests."""
|
||||
|
||||
from copy import deepcopy
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.axis.const import DOMAIN as AXIS_DOMAIN
|
||||
from homeassistant.components.light import ATTR_BRIGHTNESS, DOMAIN as LIGHT_DOMAIN
|
||||
|
@ -15,8 +16,6 @@ from homeassistant.setup import async_setup_component
|
|||
|
||||
from .test_device import API_DISCOVERY_RESPONSE, NAME, setup_axis_integration
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
API_DISCOVERY_LIGHT_CONTROL = {
|
||||
"id": "light-control",
|
||||
"version": "1.1",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Axis switch platform tests."""
|
||||
|
||||
from copy import deepcopy
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
from homeassistant.components.axis.const import DOMAIN as AXIS_DOMAIN
|
||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
|
||||
|
@ -20,8 +21,6 @@ from .test_device import (
|
|||
setup_axis_integration,
|
||||
)
|
||||
|
||||
from tests.async_mock import AsyncMock, patch
|
||||
|
||||
EVENTS = [
|
||||
{
|
||||
"operation": "Initialized",
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Test the Azure DevOps config flow."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from aioazuredevops.core import DevOpsProject
|
||||
import aiohttp
|
||||
|
||||
|
@ -11,7 +13,6 @@ from homeassistant.components.azure_devops.const import (
|
|||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
FIXTURE_REAUTH_INPUT = {CONF_PAT: "abc123"}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""The tests for the Azure Event Hub component."""
|
||||
from dataclasses import dataclass
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -7,8 +8,6 @@ import homeassistant.components.azure_event_hub as azure_event_hub
|
|||
from homeassistant.const import STATE_ON
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import MagicMock, patch
|
||||
|
||||
AZURE_EVENT_HUB_PATH = "homeassistant.components.azure_event_hub"
|
||||
PRODUCER_PATH = f"{AZURE_EVENT_HUB_PATH}.EventHubProducerClient"
|
||||
MIN_CONFIG = {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""The test for the bayesian sensor platform."""
|
||||
import json
|
||||
from os import path
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant import config as hass_config
|
||||
from homeassistant.components.bayesian import DOMAIN, binary_sensor as bayesian
|
||||
|
@ -18,8 +19,6 @@ from homeassistant.const import (
|
|||
from homeassistant.core import Context, callback
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
|
||||
async def test_load_values_when_added_to_hass(hass):
|
||||
"""Test that sensor initializes with observations of relevant entities."""
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""The test for binary_sensor device automation."""
|
||||
from datetime import timedelta
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -11,7 +12,6 @@ from homeassistant.helpers import device_registry
|
|||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import (
|
||||
MockConfigEntry,
|
||||
async_get_device_automation_capabilities,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""PyTest fixtures and test helpers."""
|
||||
from unittest import mock
|
||||
from unittest.mock import AsyncMock, PropertyMock, patch
|
||||
|
||||
import blebox_uniapi
|
||||
import pytest
|
||||
|
@ -8,7 +9,6 @@ from homeassistant.components.blebox.const import DOMAIN
|
|||
from homeassistant.const import CONF_HOST, CONF_PORT
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import AsyncMock, PropertyMock, patch
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.light.conftest import mock_light_profiles # noqa
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Blebox air_quality tests."""
|
||||
|
||||
import logging
|
||||
from unittest.mock import AsyncMock, PropertyMock
|
||||
|
||||
import blebox_uniapi
|
||||
import pytest
|
||||
|
@ -10,8 +11,6 @@ from homeassistant.const import ATTR_ICON, STATE_UNKNOWN
|
|||
|
||||
from .conftest import async_setup_entity, mock_feature
|
||||
|
||||
from tests.async_mock import AsyncMock, PropertyMock
|
||||
|
||||
|
||||
@pytest.fixture(name="airsensor")
|
||||
def airsensor_fixture():
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""BleBox climate entities tests."""
|
||||
|
||||
import logging
|
||||
from unittest.mock import AsyncMock, PropertyMock
|
||||
|
||||
import blebox_uniapi
|
||||
import pytest
|
||||
|
@ -30,8 +31,6 @@ from homeassistant.const import (
|
|||
|
||||
from .conftest import async_setup_entity, mock_feature
|
||||
|
||||
from tests.async_mock import AsyncMock, PropertyMock
|
||||
|
||||
|
||||
@pytest.fixture(name="saunabox")
|
||||
def saunabox_fixture():
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
"""Test Home Assistant config flow for BleBox devices."""
|
||||
|
||||
from unittest.mock import DEFAULT, AsyncMock, PropertyMock, patch
|
||||
|
||||
import blebox_uniapi
|
||||
import pytest
|
||||
|
||||
|
@ -9,8 +11,6 @@ from homeassistant.setup import async_setup_component
|
|||
|
||||
from .conftest import mock_config, mock_only_feature, setup_product_mock
|
||||
|
||||
from tests.async_mock import DEFAULT, AsyncMock, PropertyMock, patch
|
||||
|
||||
|
||||
def create_valid_feature_mock(path="homeassistant.components.blebox.Products"):
|
||||
"""Return a valid, complete BleBox feature mock."""
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""BleBox cover entities tests."""
|
||||
|
||||
import logging
|
||||
from unittest.mock import AsyncMock, PropertyMock
|
||||
|
||||
import blebox_uniapi
|
||||
import pytest
|
||||
|
@ -32,8 +33,6 @@ from homeassistant.const import (
|
|||
|
||||
from .conftest import async_setup_entity, mock_feature
|
||||
|
||||
from tests.async_mock import AsyncMock, PropertyMock
|
||||
|
||||
ALL_COVER_FIXTURES = ["gatecontroller", "shutterbox", "gatebox"]
|
||||
FIXTURES_SUPPORTING_STOP = ["gatecontroller", "shutterbox"]
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""BleBox light entities tests."""
|
||||
|
||||
import logging
|
||||
from unittest.mock import AsyncMock, PropertyMock
|
||||
|
||||
import blebox_uniapi
|
||||
import pytest
|
||||
|
@ -24,8 +25,6 @@ from homeassistant.util import color
|
|||
|
||||
from .conftest import async_setup_entity, mock_feature
|
||||
|
||||
from tests.async_mock import AsyncMock, PropertyMock
|
||||
|
||||
ALL_LIGHT_FIXTURES = ["dimmer", "wlightbox_s", "wlightbox"]
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Blebox sensors tests."""
|
||||
|
||||
import logging
|
||||
from unittest.mock import AsyncMock, PropertyMock
|
||||
|
||||
import blebox_uniapi
|
||||
import pytest
|
||||
|
@ -15,8 +16,6 @@ from homeassistant.const import (
|
|||
|
||||
from .conftest import async_setup_entity, mock_feature
|
||||
|
||||
from tests.async_mock import AsyncMock, PropertyMock
|
||||
|
||||
|
||||
@pytest.fixture(name="tempsensor")
|
||||
def tempsensor_fixture():
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Blebox switch tests."""
|
||||
|
||||
import logging
|
||||
from unittest.mock import AsyncMock, PropertyMock
|
||||
|
||||
import blebox_uniapi
|
||||
import pytest
|
||||
|
@ -22,8 +23,6 @@ from .conftest import (
|
|||
setup_product_mock,
|
||||
)
|
||||
|
||||
from tests.async_mock import AsyncMock, PropertyMock
|
||||
|
||||
|
||||
@pytest.fixture(name="switchbox")
|
||||
def switchbox_fixture():
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
"""Test the Blink config flow."""
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from blinkpy.auth import LoginError
|
||||
from blinkpy.blinkpy import BlinkSetupError
|
||||
|
||||
from homeassistant import config_entries, data_entry_flow, setup
|
||||
from homeassistant.components.blink import DOMAIN
|
||||
|
||||
from tests.async_mock import Mock, patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""Blueprints conftest."""
|
||||
|
||||
import pytest
|
||||
from unittest.mock import patch
|
||||
|
||||
from tests.async_mock import patch
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
"""Test blueprint models."""
|
||||
import logging
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.blueprint import errors, models
|
||||
from homeassistant.util.yaml import Input
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def blueprint_1():
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
"""Test websocket API."""
|
||||
from pathlib import Path
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import Mock, patch
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
async def setup_bp(hass):
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Test Bluetooth LE device tracker."""
|
||||
|
||||
from datetime import timedelta
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.bluetooth_le_tracker import device_tracker
|
||||
from homeassistant.components.device_tracker.const import (
|
||||
|
@ -12,7 +13,6 @@ from homeassistant.const import CONF_PLATFORM
|
|||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util import dt as dt_util, slugify
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import async_fire_time_changed
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Test the for the BMW Connected Drive config flow."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant import config_entries, data_entry_flow
|
||||
from homeassistant.components.bmw_connected_drive.config_flow import DOMAIN
|
||||
from homeassistant.components.bmw_connected_drive.const import (
|
||||
|
@ -8,7 +10,6 @@ from homeassistant.components.bmw_connected_drive.const import (
|
|||
)
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
FIXTURE_USER_INPUT = {
|
||||
|
|
|
@ -3,6 +3,7 @@ from asyncio import TimeoutError as AsyncIOTimeoutError
|
|||
from contextlib import nullcontext
|
||||
from datetime import timedelta
|
||||
from typing import Any, Dict, Optional
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant import core
|
||||
from homeassistant.components.bond.const import DOMAIN as BOND_DOMAIN
|
||||
|
@ -10,7 +11,6 @@ from homeassistant.const import CONF_ACCESS_TOKEN, CONF_HOST, STATE_UNAVAILABLE
|
|||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util import utcnow
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry, async_fire_time_changed
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""Test the Bond config flow."""
|
||||
from typing import Any, Dict
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from aiohttp import ClientConnectionError, ClientResponseError
|
||||
|
||||
|
@ -9,7 +10,6 @@ from homeassistant.const import CONF_ACCESS_TOKEN, CONF_HOST
|
|||
|
||||
from .common import patch_bond_device_ids, patch_bond_version
|
||||
|
||||
from tests.async_mock import Mock, patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Define tests for the Bravia TV config flow."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from bravia_tv.braviarc import NoIPControl
|
||||
|
||||
from homeassistant import data_entry_flow
|
||||
|
@ -6,7 +8,6 @@ from homeassistant.components.braviatv.const import CONF_IGNORED_SOURCES, DOMAIN
|
|||
from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_USER
|
||||
from homeassistant.const import CONF_HOST, CONF_MAC, CONF_PIN
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
BRAVIA_SYSTEM_INFO = {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue