Use asynctest-mock in most places (#35109)
* Use asynctest-mock in most places * Fix broken patch in pilight
This commit is contained in:
parent
e7fc886992
commit
2af984917e
319 changed files with 456 additions and 522 deletions
|
@ -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,5 @@
|
|||
"""Tests for the Home Assistant auth module."""
|
||||
from datetime import timedelta
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import jwt
|
||||
import pytest
|
||||
|
@ -12,6 +11,7 @@ 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
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
"""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,6 +1,4 @@
|
|||
"""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
|
||||
|
@ -19,6 +17,8 @@ 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,12 +1,11 @@
|
|||
"""Tests for the Abode config flow."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from abodepy.exceptions import AbodeAuthenticationException
|
||||
|
||||
from homeassistant import data_entry_flow
|
||||
from homeassistant.components.abode import config_flow
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, HTTP_INTERNAL_SERVER_ERROR
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
CONF_POLLING = "polling"
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
"""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 (
|
||||
|
@ -13,6 +11,8 @@ from homeassistant.const import (
|
|||
|
||||
from .common import setup_platform
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
DEVICE_ID = "cover.garage_door"
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
"""Tests for the Abode module."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.abode import (
|
||||
DOMAIN as ABODE_DOMAIN,
|
||||
SERVICE_CAPTURE_IMAGE,
|
||||
|
@ -11,6 +9,8 @@ from homeassistant.components.alarm_control_panel import DOMAIN as ALARM_DOMAIN
|
|||
|
||||
from .common import setup_platform
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
|
||||
async def test_change_settings(hass):
|
||||
"""Test change_setting service."""
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
"""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,
|
||||
|
@ -19,6 +17,8 @@ from homeassistant.const import (
|
|||
|
||||
from .common import setup_platform
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
DEVICE_ID = "light.living_room_lamp"
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
"""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 (
|
||||
|
@ -13,6 +11,8 @@ from homeassistant.const import (
|
|||
|
||||
from .common import setup_platform
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
DEVICE_ID = "lock.test_lock"
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
"""Tests for the Abode switch device."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.abode import (
|
||||
DOMAIN as ABODE_DOMAIN,
|
||||
SERVICE_TRIGGER_AUTOMATION,
|
||||
|
@ -16,6 +14,8 @@ 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,6 +1,6 @@
|
|||
"""Define patches used for androidtv tests."""
|
||||
|
||||
from unittest.mock import mock_open, patch
|
||||
from tests.async_mock import mock_open, patch
|
||||
|
||||
|
||||
class AdbDeviceTcpFake:
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"""The tests for the androidtv platform."""
|
||||
import base64
|
||||
import logging
|
||||
from unittest.mock import patch
|
||||
|
||||
from androidtv.exceptions import LockNotAcquiredException
|
||||
|
||||
|
@ -41,6 +40,8 @@ from homeassistant.setup import async_setup_component
|
|||
|
||||
from . import patchers
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
# Android TV device with Python ADB implementation
|
||||
CONFIG_ANDROIDTV_PYTHON_ADB = {
|
||||
DOMAIN: {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"""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
|
||||
|
@ -12,6 +11,7 @@ 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,7 +1,6 @@
|
|||
"""The tests for the APNS component."""
|
||||
import io
|
||||
import unittest
|
||||
from unittest.mock import Mock, mock_open, patch
|
||||
|
||||
from apns2.errors import Unregistered
|
||||
import yaml
|
||||
|
@ -11,6 +10,7 @@ import homeassistant.components.notify as notify
|
|||
from homeassistant.core import State
|
||||
from homeassistant.setup import setup_component
|
||||
|
||||
from tests.async_mock import Mock, mock_open, patch
|
||||
from tests.common import assert_setup_component, get_test_home_assistant
|
||||
|
||||
CONFIG = {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""The tests for the apprise notification platform."""
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import MagicMock, patch
|
||||
|
||||
BASE_COMPONENT = "notify"
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
"""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,6 +1,5 @@
|
|||
"""The tests for the Netgear Arlo sensors."""
|
||||
from collections import namedtuple
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -12,6 +11,8 @@ from homeassistant.const import (
|
|||
UNIT_PERCENTAGE,
|
||||
)
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
|
||||
def _get_named_tuple(input_dict):
|
||||
return namedtuple("Struct", input_dict.keys())(*input_dict.values())
|
||||
|
@ -94,7 +95,7 @@ def sensor_with_hass_data(default_sensor, hass):
|
|||
def mock_dispatch():
|
||||
"""Mock the dispatcher connect method."""
|
||||
target = "homeassistant.components.arlo.sensor.async_dispatcher_connect"
|
||||
with patch(target, MagicMock()) as _mock:
|
||||
with patch(target) as _mock:
|
||||
yield _mock
|
||||
|
||||
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
"""Tests for the Atag config flow."""
|
||||
from unittest.mock import PropertyMock
|
||||
|
||||
from pyatag import AtagException
|
||||
|
||||
from homeassistant import config_entries, data_entry_flow
|
||||
from homeassistant.components.atag import DOMAIN
|
||||
from homeassistant.const import CONF_DEVICE, CONF_HOST, CONF_PORT
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.async_mock import PropertyMock, patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
FIXTURE_USER_INPUT = {
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
"""The gateway tests for the august platform."""
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from homeassistant.components.august.const import DOMAIN
|
||||
from homeassistant.components.august.gateway import AugustGateway
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.async_mock import MagicMock, patch
|
||||
from tests.components.august.mocks import _mock_august_authentication, _mock_get_config
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""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
|
||||
|
@ -10,6 +9,7 @@ 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,8 +1,7 @@
|
|||
"""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
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
"""The tests for the Event automation."""
|
||||
from unittest.mock import patch
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.core import CoreState
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import AsyncMock
|
||||
from tests.async_mock import AsyncMock, patch
|
||||
from tests.common import async_mock_service
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""The tests for the automation component."""
|
||||
from datetime import timedelta
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -19,6 +18,7 @@ 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_fire_time_changed,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""The tests for numeric state automation."""
|
||||
from datetime import timedelta
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
import voluptuous as vol
|
||||
|
@ -11,6 +10,7 @@ from homeassistant.core import Context
|
|||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import (
|
||||
assert_setup_component,
|
||||
async_fire_time_changed,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""The test for state automation."""
|
||||
from datetime import timedelta
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -9,6 +8,7 @@ from homeassistant.core import Context
|
|||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import (
|
||||
assert_setup_component,
|
||||
async_fire_time_changed,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""The tests for the sun automation."""
|
||||
from datetime import datetime
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -10,6 +9,7 @@ from homeassistant.const import SUN_EVENT_SUNRISE, SUN_EVENT_SUNSET
|
|||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import async_fire_time_changed, async_mock_service, mock_component
|
||||
from tests.components.automation import common
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""The tests for the time automation."""
|
||||
from datetime import timedelta
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -8,6 +7,7 @@ import homeassistant.components.automation as automation
|
|||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import (
|
||||
assert_setup_component,
|
||||
async_fire_time_changed,
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
"""Test Axis component setup process."""
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from homeassistant.components import axis
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from .test_device import MAC, setup_axis_integration
|
||||
|
||||
from tests.async_mock import AsyncMock
|
||||
from tests.async_mock import AsyncMock, Mock, patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
"""Axis switch platform tests."""
|
||||
|
||||
from unittest.mock import Mock, call as mock_call
|
||||
|
||||
from homeassistant.components import axis
|
||||
import homeassistant.components.switch as switch
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from .test_device import NAME, setup_axis_integration
|
||||
|
||||
from tests.async_mock import Mock, call as mock_call
|
||||
|
||||
EVENTS = [
|
||||
{
|
||||
"operation": "Initialized",
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""The test for binary_sensor device automation."""
|
||||
from datetime import timedelta
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -12,6 +11,7 @@ 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,7 +1,6 @@
|
|||
"""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 (
|
||||
|
@ -13,6 +12,7 @@ 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
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
import json
|
||||
import re
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
from urllib.parse import urlparse
|
||||
|
||||
import requests
|
||||
|
@ -11,6 +10,7 @@ from homeassistant.components import sensor
|
|||
from homeassistant.components.bom.sensor import BOMCurrentData
|
||||
from homeassistant.setup import setup_component
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import assert_setup_component, get_test_home_assistant, load_fixture
|
||||
|
||||
VALID_CONFIG = {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"""The tests for the broadlink component."""
|
||||
from base64 import b64decode
|
||||
from datetime import timedelta
|
||||
from unittest.mock import MagicMock, call, patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -9,6 +8,8 @@ from homeassistant.components.broadlink import async_setup_service, data_packet
|
|||
from homeassistant.components.broadlink.const import DOMAIN, SERVICE_LEARN, SERVICE_SEND
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
from tests.async_mock import MagicMock, call, patch
|
||||
|
||||
DUMMY_IR_PACKET = (
|
||||
"JgBGAJKVETkRORA6ERQRFBEUERQRFBE5ETkQOhAVEBUQFREUEBUQ"
|
||||
"OhEUERQRORE5EBURFBA6EBUQOhE5EBUQFRA6EDoRFBEADQUAAA=="
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""The tests for the webdav calendar component."""
|
||||
import datetime
|
||||
from unittest.mock import MagicMock, Mock
|
||||
|
||||
from caldav.objects import Event
|
||||
import pytest
|
||||
|
@ -9,7 +8,7 @@ from homeassistant.const import STATE_OFF, STATE_ON
|
|||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util import dt
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.async_mock import MagicMock, Mock, patch
|
||||
|
||||
# pylint: disable=redefined-outer-name
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
import asyncio
|
||||
import base64
|
||||
import io
|
||||
from unittest.mock import PropertyMock, mock_open
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -14,7 +13,7 @@ from homeassistant.const import ATTR_ENTITY_ID, EVENT_HOMEASSISTANT_START
|
|||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.async_mock import PropertyMock, mock_open, patch
|
||||
from tests.components.camera import common
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
"""The tests for the Canary component."""
|
||||
import unittest
|
||||
from unittest.mock import MagicMock, PropertyMock, patch
|
||||
|
||||
from homeassistant import setup
|
||||
import homeassistant.components.canary as canary
|
||||
|
||||
from tests.async_mock import MagicMock, PropertyMock, patch
|
||||
from tests.common import get_test_home_assistant
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"""The tests for the Canary sensor platform."""
|
||||
import copy
|
||||
import unittest
|
||||
from unittest.mock import Mock
|
||||
|
||||
from homeassistant.components.canary import DATA_CANARY, sensor as canary
|
||||
from homeassistant.components.canary.sensor import (
|
||||
|
@ -14,6 +13,7 @@ from homeassistant.components.canary.sensor import (
|
|||
)
|
||||
from homeassistant.const import TEMP_CELSIUS, UNIT_PERCENTAGE
|
||||
|
||||
from tests.async_mock import Mock
|
||||
from tests.common import get_test_home_assistant
|
||||
from tests.components.canary.test_init import mock_device, mock_location
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
"""Test Home Assistant Cast."""
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from homeassistant.components.cast import home_assistant_cast
|
||||
|
||||
from tests.async_mock import Mock, patch
|
||||
from tests.common import MockConfigEntry, async_mock_signal
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""The tests for the climate component."""
|
||||
from typing import List
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
import voluptuous as vol
|
||||
|
@ -13,6 +12,7 @@ from homeassistant.components.climate import (
|
|||
ClimateEntity,
|
||||
)
|
||||
|
||||
from tests.async_mock import MagicMock
|
||||
from tests.common import async_mock_service
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
"""Fixtures for cloud tests."""
|
||||
from unittest.mock import patch
|
||||
|
||||
import jwt
|
||||
import pytest
|
||||
|
||||
|
@ -8,6 +6,8 @@ from homeassistant.components.cloud import const, prefs
|
|||
|
||||
from . import mock_cloud, mock_cloud_prefs
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_user_data():
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
"""Tests for the cloud binary sensor."""
|
||||
from unittest.mock import Mock
|
||||
|
||||
from homeassistant.components.cloud.const import DISPATCHER_REMOTE_UPDATE
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.async_mock import Mock, patch
|
||||
|
||||
|
||||
async def test_remote_connection_sensor(hass):
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
"""Test the Cloud Google Config."""
|
||||
from unittest.mock import Mock
|
||||
|
||||
from homeassistant.components.cloud import GACTIONS_SCHEMA
|
||||
from homeassistant.components.cloud.google_config import CloudGoogleConfig
|
||||
from homeassistant.components.google_assistant import helpers as ga_helpers
|
||||
|
@ -9,7 +7,7 @@ from homeassistant.core import CoreState
|
|||
from homeassistant.helpers.entity_registry import EVENT_ENTITY_REGISTRY_UPDATED
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
from tests.async_mock import AsyncMock, patch
|
||||
from tests.async_mock import AsyncMock, Mock, patch
|
||||
from tests.common import async_fire_time_changed
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
"""Test Cloud preferences."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.auth.const import GROUP_ID_ADMIN
|
||||
from homeassistant.components.cloud.prefs import STORAGE_KEY, CloudPreferences
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
|
||||
async def test_set_username(hass):
|
||||
"""Test we clear config if we set different username."""
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
"""Tests for the CoinMarketCap sensor platform."""
|
||||
import json
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
import homeassistant.components.sensor as sensor
|
||||
from homeassistant.setup import setup_component
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import assert_setup_component, get_test_home_assistant, load_fixture
|
||||
|
||||
VALID_CONFIG = {
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
import os
|
||||
import tempfile
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
import homeassistant.components.notify as notify
|
||||
from homeassistant.setup import setup_component
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import assert_setup_component, get_test_home_assistant
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
"""The tests for the Command line sensor platform."""
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.command_line import sensor as command_line
|
||||
from homeassistant.helpers.template import Template
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import get_test_home_assistant
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
"""Test Group config panel."""
|
||||
import json
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.bootstrap import async_setup_component
|
||||
from homeassistant.components import config
|
||||
|
||||
from tests.async_mock import AsyncMock
|
||||
from tests.async_mock import AsyncMock, patch
|
||||
|
||||
VIEW_NAME = "api:config:group:config"
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
"""Tests for config/script."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.bootstrap import async_setup_component
|
||||
from homeassistant.components import config
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
|
||||
async def test_delete_script(hass, hass_client):
|
||||
"""Test deleting a script."""
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""Test Z-Wave config panel."""
|
||||
import json
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -9,6 +8,7 @@ from homeassistant.components import config
|
|||
from homeassistant.components.zwave import DATA_NETWORK, const
|
||||
from homeassistant.const import HTTP_NOT_FOUND
|
||||
|
||||
from tests.async_mock import MagicMock, patch
|
||||
from tests.mock.zwave import MockEntityValues, MockNode, MockValue
|
||||
|
||||
VIEW_NAME = "api:config:zwave:device_config"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# pylint: disable=redefined-outer-name
|
||||
"""Tests for the Daikin config flow."""
|
||||
import asyncio
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -10,6 +9,7 @@ from homeassistant.components.daikin import config_flow
|
|||
from homeassistant.components.daikin.const import KEY_IP, KEY_MAC
|
||||
from homeassistant.const import CONF_HOST
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
MAC = "AABBCCDDEEFF"
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
from datetime import timedelta
|
||||
import re
|
||||
import unittest
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import forecastio
|
||||
from requests.exceptions import HTTPError
|
||||
|
@ -11,6 +10,7 @@ import requests_mock
|
|||
from homeassistant.components.darksky import sensor as darksky
|
||||
from homeassistant.setup import setup_component
|
||||
|
||||
from tests.async_mock import MagicMock, patch
|
||||
from tests.common import get_test_home_assistant, load_fixture
|
||||
|
||||
VALID_CONFIG_MINIMAL = {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"""The tests for the Dark Sky weather component."""
|
||||
import re
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
import forecastio
|
||||
from requests.exceptions import ConnectionError
|
||||
|
@ -11,6 +10,7 @@ from homeassistant.components import weather
|
|||
from homeassistant.setup import setup_component
|
||||
from homeassistant.util.unit_system import METRIC_SYSTEM
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import get_test_home_assistant, load_fixture
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
"""Test the default_config init."""
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def recorder_url_mock():
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
"""The tests for local file camera component."""
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.camera import (
|
||||
|
@ -18,6 +16,8 @@ from homeassistant.const import ATTR_ENTITY_ID
|
|||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
ENTITY_CAMERA = "camera.demo_camera"
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""The tests for the demo platform."""
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components import geo_location
|
||||
from homeassistant.components.demo.geo_location import (
|
||||
|
@ -11,6 +10,7 @@ from homeassistant.const import LENGTH_KILOMETERS
|
|||
from homeassistant.setup import setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import (
|
||||
assert_setup_component,
|
||||
fire_time_changed,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""The tests for the notify demo platform."""
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
import voluptuous as vol
|
||||
|
@ -11,6 +10,7 @@ from homeassistant.core import callback
|
|||
from homeassistant.helpers import discovery
|
||||
from homeassistant.setup import setup_component
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import assert_setup_component, get_test_home_assistant
|
||||
from tests.components.notify import common
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
"""The tests for the denonavr media player platform."""
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import media_player
|
||||
|
@ -8,6 +6,8 @@ from homeassistant.components.denonavr import ATTR_COMMAND, DOMAIN, SERVICE_GET_
|
|||
from homeassistant.const import ATTR_ENTITY_ID, CONF_HOST, CONF_NAME, CONF_PLATFORM
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
NAME = "fake"
|
||||
ENTITY_ID = f"{media_player.DOMAIN}.{NAME}"
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
"""The tests for the derivative sensor platform."""
|
||||
from datetime import timedelta
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.const import POWER_WATT, TIME_HOURS, TIME_MINUTES, TIME_SECONDS
|
||||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
|
||||
async def test_state(hass):
|
||||
"""Test derivative sensor state."""
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"""The tests for the Dialogflow component."""
|
||||
import copy
|
||||
import json
|
||||
from unittest.mock import Mock
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -10,6 +9,8 @@ from homeassistant.components import dialogflow, intent_script
|
|||
from homeassistant.core import callback
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import Mock
|
||||
|
||||
SESSION_ID = "a9b84cec-46b6-484e-8f31-f65dba03ae6d"
|
||||
INTENT_ID = "c6a74079-a8f0-46cd-b372-5a934d23591c"
|
||||
INTENT_NAME = "tests"
|
||||
|
|
|
@ -9,7 +9,6 @@ import asyncio
|
|||
import datetime
|
||||
from decimal import Decimal
|
||||
from itertools import chain, repeat
|
||||
from unittest.mock import DEFAULT, Mock
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -18,6 +17,7 @@ from homeassistant.components.dsmr.sensor import DerivativeDSMREntity
|
|||
from homeassistant.const import ENERGY_KILO_WATT_HOUR, TIME_HOURS, VOLUME_CUBIC_METERS
|
||||
|
||||
import tests.async_mock
|
||||
from tests.async_mock import DEFAULT, Mock
|
||||
from tests.common import assert_setup_component
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
from datetime import timedelta
|
||||
from ipaddress import ip_address
|
||||
import json
|
||||
from unittest.mock import patch
|
||||
|
||||
from aiohttp.hdrs import CONTENT_TYPE
|
||||
import pytest
|
||||
|
@ -42,6 +41,7 @@ from homeassistant.const import (
|
|||
)
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import (
|
||||
async_fire_time_changed,
|
||||
async_mock_service,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""Test the Emulated Hue component."""
|
||||
from unittest.mock import MagicMock, Mock, patch
|
||||
|
||||
from homeassistant.components.emulated_hue import Config
|
||||
|
||||
from tests.async_mock import MagicMock, Mock, patch
|
||||
|
||||
|
||||
def test_config_google_home_entity_id_to_number():
|
||||
"""Test config adheres to the type."""
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"""The tests for the emulated Hue component."""
|
||||
import json
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
from aiohttp.hdrs import CONTENT_TYPE
|
||||
import defusedxml.ElementTree as ET
|
||||
|
@ -10,6 +9,7 @@ import requests
|
|||
from homeassistant import const, setup
|
||||
from homeassistant.components import emulated_hue
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import get_test_home_assistant, get_test_instance_port
|
||||
|
||||
HTTP_SERVER_PORT = get_test_instance_port()
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
"""Tests for emulated_roku library bindings."""
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from homeassistant.components.emulated_roku.binding import (
|
||||
ATTR_APP_ID,
|
||||
ATTR_COMMAND_TYPE,
|
||||
|
@ -14,7 +12,7 @@ from homeassistant.components.emulated_roku.binding import (
|
|||
EmulatedRoku,
|
||||
)
|
||||
|
||||
from tests.async_mock import AsyncMock
|
||||
from tests.async_mock import AsyncMock, Mock, patch
|
||||
|
||||
|
||||
async def test_events_fired_properly(hass):
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
"""Test emulated_roku component setup process."""
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from homeassistant.components import emulated_roku
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import AsyncMock
|
||||
from tests.async_mock import AsyncMock, Mock, patch
|
||||
|
||||
|
||||
async def test_config_required_fields(hass):
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
"""The tests for the facebox component."""
|
||||
from unittest.mock import Mock, mock_open, patch
|
||||
|
||||
import pytest
|
||||
import requests
|
||||
import requests_mock
|
||||
|
@ -23,6 +21,8 @@ from homeassistant.const import (
|
|||
from homeassistant.core import callback
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import Mock, mock_open, patch
|
||||
|
||||
MOCK_IP = "192.168.0.1"
|
||||
MOCK_PORT = "8080"
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""The tests for local file sensor platform."""
|
||||
import unittest
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from mock_open import MockOpen
|
||||
|
||||
|
@ -12,6 +11,7 @@ from homeassistant.components.fail2ban.sensor import (
|
|||
)
|
||||
from homeassistant.setup import setup_component
|
||||
|
||||
from tests.async_mock import Mock, patch
|
||||
from tests.common import assert_setup_component, get_test_home_assistant
|
||||
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ from os.path import exists
|
|||
import time
|
||||
import unittest
|
||||
from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components import feedreader
|
||||
from homeassistant.components.feedreader import (
|
||||
|
@ -22,6 +21,7 @@ from homeassistant.const import CONF_SCAN_INTERVAL, EVENT_HOMEASSISTANT_START
|
|||
from homeassistant.core import callback
|
||||
from homeassistant.setup import setup_component
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import get_test_home_assistant, load_fixture
|
||||
|
||||
_LOGGER = getLogger(__name__)
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
"""The tests for Home Assistant ffmpeg."""
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
import homeassistant.components.ffmpeg as ffmpeg
|
||||
from homeassistant.components.ffmpeg import (
|
||||
DOMAIN,
|
||||
|
@ -12,6 +10,7 @@ from homeassistant.const import ATTR_ENTITY_ID
|
|||
from homeassistant.core import callback
|
||||
from homeassistant.setup import async_setup_component, setup_component
|
||||
|
||||
from tests.async_mock import MagicMock
|
||||
from tests.common import assert_setup_component, get_test_home_assistant
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
"""The test for the fido sensor platform."""
|
||||
import logging
|
||||
import sys
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from homeassistant.bootstrap import async_setup_component
|
||||
from homeassistant.components.fido import sensor as fido
|
||||
|
||||
from tests.async_mock import MagicMock, patch
|
||||
from tests.common import assert_setup_component
|
||||
|
||||
CONTRACT = "123456789"
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
"""The tests for the notify file platform."""
|
||||
import os
|
||||
import unittest
|
||||
from unittest.mock import call, mock_open, patch
|
||||
|
||||
import homeassistant.components.notify as notify
|
||||
from homeassistant.components.notify import ATTR_TITLE_DEFAULT
|
||||
from homeassistant.setup import setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from tests.async_mock import call, mock_open, patch
|
||||
from tests.common import assert_setup_component, get_test_home_assistant
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""The tests for local file sensor platform."""
|
||||
import unittest
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
# Using third party package because of a bug reading binary data in Python 3.4
|
||||
# https://bugs.python.org/issue23004
|
||||
|
@ -9,6 +8,7 @@ from mock_open import MockOpen
|
|||
from homeassistant.const import STATE_UNKNOWN
|
||||
from homeassistant.setup import setup_component
|
||||
|
||||
from tests.async_mock import Mock, patch
|
||||
from tests.common import get_test_home_assistant, mock_registry
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"""The test for the data filter sensor platform."""
|
||||
from datetime import timedelta
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.filter.sensor import (
|
||||
LowPassFilter,
|
||||
|
@ -15,6 +14,7 @@ import homeassistant.core as ha
|
|||
from homeassistant.setup import setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import (
|
||||
assert_setup_component,
|
||||
get_test_home_assistant,
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
"""The tests for the folder_watcher component."""
|
||||
import os
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from homeassistant.components import folder_watcher
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import Mock, patch
|
||||
|
||||
|
||||
async def test_invalid_path_setup(hass):
|
||||
"""Test that an invalid path is not set up."""
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
import asyncio
|
||||
import re
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -20,6 +19,7 @@ from homeassistant.const import (
|
|||
from homeassistant.exceptions import PlatformNotReady
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import MagicMock
|
||||
from tests.common import load_fixture
|
||||
|
||||
VALID_CONFIG = {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""Test helpers for Freebox."""
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_path():
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
"""Tests for the AVM Fritz!Box integration."""
|
||||
from unittest.mock import Mock
|
||||
|
||||
from homeassistant.components.fritzbox.const import DOMAIN
|
||||
from homeassistant.const import CONF_DEVICES, CONF_HOST, CONF_PASSWORD, CONF_USERNAME
|
||||
|
||||
from tests.async_mock import Mock
|
||||
|
||||
MOCK_CONFIG = {
|
||||
DOMAIN: {
|
||||
CONF_DEVICES: [
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""Fixtures for the AVM Fritz!Box integration."""
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.async_mock import Mock, patch
|
||||
|
||||
|
||||
@pytest.fixture(name="fritz")
|
||||
def fritz_fixture() -> Mock:
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"""Tests for AVM Fritz!Box binary sensor component."""
|
||||
from datetime import timedelta
|
||||
from unittest import mock
|
||||
from unittest.mock import Mock
|
||||
|
||||
from requests.exceptions import HTTPError
|
||||
|
||||
|
@ -19,6 +18,7 @@ import homeassistant.util.dt as dt_util
|
|||
|
||||
from . import MOCK_CONFIG, FritzDeviceBinarySensorMock
|
||||
|
||||
from tests.async_mock import Mock
|
||||
from tests.common import async_fire_time_changed
|
||||
|
||||
ENTITY_ID = f"{DOMAIN}.fake_name"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""Tests for AVM Fritz!Box climate component."""
|
||||
from datetime import timedelta
|
||||
from unittest.mock import Mock, call
|
||||
|
||||
from requests.exceptions import HTTPError
|
||||
|
||||
|
@ -42,6 +41,7 @@ import homeassistant.util.dt as dt_util
|
|||
|
||||
from . import MOCK_CONFIG, FritzDeviceClimateMock
|
||||
|
||||
from tests.async_mock import Mock, call
|
||||
from tests.common import async_fire_time_changed
|
||||
|
||||
ENTITY_ID = f"{DOMAIN}.fake_name"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""Tests for AVM Fritz!Box config flow."""
|
||||
from unittest import mock
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from pyfritzhome import LoginError
|
||||
import pytest
|
||||
|
@ -17,6 +16,8 @@ from homeassistant.helpers.typing import HomeAssistantType
|
|||
|
||||
from . import MOCK_CONFIG
|
||||
|
||||
from tests.async_mock import Mock, patch
|
||||
|
||||
MOCK_USER_DATA = MOCK_CONFIG[DOMAIN][CONF_DEVICES][0]
|
||||
MOCK_SSDP_DATA = {
|
||||
ATTR_SSDP_LOCATION: "https://fake_host:12345/test",
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
"""Tests for the AVM Fritz!Box integration."""
|
||||
from unittest.mock import Mock, call
|
||||
|
||||
from homeassistant.components.fritzbox.const import DOMAIN as FB_DOMAIN
|
||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
|
||||
from homeassistant.config_entries import ENTRY_STATE_LOADED, ENTRY_STATE_NOT_LOADED
|
||||
|
@ -10,6 +8,7 @@ from homeassistant.setup import async_setup_component
|
|||
|
||||
from . import MOCK_CONFIG, FritzDeviceSwitchMock
|
||||
|
||||
from tests.async_mock import Mock, call
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""Tests for AVM Fritz!Box sensor component."""
|
||||
from datetime import timedelta
|
||||
from unittest.mock import Mock
|
||||
|
||||
from requests.exceptions import HTTPError
|
||||
|
||||
|
@ -21,6 +20,7 @@ import homeassistant.util.dt as dt_util
|
|||
|
||||
from . import MOCK_CONFIG, FritzDeviceSensorMock
|
||||
|
||||
from tests.async_mock import Mock
|
||||
from tests.common import async_fire_time_changed
|
||||
|
||||
ENTITY_ID = f"{DOMAIN}.fake_name"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""Tests for AVM Fritz!Box switch component."""
|
||||
from datetime import timedelta
|
||||
from unittest.mock import Mock
|
||||
|
||||
from requests.exceptions import HTTPError
|
||||
|
||||
|
@ -29,6 +28,7 @@ import homeassistant.util.dt as dt_util
|
|||
|
||||
from . import MOCK_CONFIG, FritzDeviceSwitchMock
|
||||
|
||||
from tests.async_mock import Mock
|
||||
from tests.common import async_fire_time_changed
|
||||
|
||||
ENTITY_ID = f"{DOMAIN}.fake_name"
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
"""Test the Garmin Connect config flow."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from garminconnect import (
|
||||
GarminConnectAuthenticationError,
|
||||
GarminConnectConnectionError,
|
||||
|
@ -12,6 +10,7 @@ from homeassistant import data_entry_flow
|
|||
from homeassistant.components.garmin_connect.const import DOMAIN
|
||||
from homeassistant.const import CONF_ID, CONF_PASSWORD, CONF_USERNAME
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
MOCK_CONF = {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""Tests for the GDACS component."""
|
||||
from unittest.mock import MagicMock
|
||||
from tests.async_mock import MagicMock
|
||||
|
||||
|
||||
def _generate_mock_feed_entry(
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"""The test for the geo rss events sensor platform."""
|
||||
import unittest
|
||||
from unittest import mock
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from homeassistant.components import sensor
|
||||
import homeassistant.components.geo_rss_events.sensor as geo_rss_events
|
||||
|
@ -14,6 +13,7 @@ from homeassistant.const import (
|
|||
from homeassistant.setup import setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from tests.async_mock import MagicMock, patch
|
||||
from tests.common import (
|
||||
assert_setup_component,
|
||||
fire_time_changed,
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
"""The tests for the Geofency device tracker platform."""
|
||||
# pylint: disable=redefined-outer-name
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant import data_entry_flow
|
||||
|
@ -16,6 +13,9 @@ from homeassistant.const import (
|
|||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util import slugify
|
||||
|
||||
# pylint: disable=redefined-outer-name
|
||||
from tests.async_mock import Mock, patch
|
||||
|
||||
HOME_LATITUDE = 37.239622
|
||||
HOME_LONGITUDE = -115.815811
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""Tests for the geonetnz_quakes component."""
|
||||
from unittest.mock import MagicMock
|
||||
from tests.async_mock import MagicMock
|
||||
|
||||
|
||||
def _generate_mock_feed_entry(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""The tests for the GeoNet NZ Volcano Feed integration."""
|
||||
from unittest.mock import MagicMock
|
||||
from tests.async_mock import MagicMock
|
||||
|
||||
|
||||
def _generate_mock_feed_entry(
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""Test configuration and mocks for the google integration."""
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
TEST_CALENDAR = {
|
||||
"id": "qwertyuiopasdfghjklzxcvbnm@import.calendar.google.com",
|
||||
"etag": '"3584134138943410"',
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""The tests for the google calendar platform."""
|
||||
import copy
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import httplib2
|
||||
import pytest
|
||||
|
@ -23,6 +22,7 @@ from homeassistant.setup import async_setup_component
|
|||
from homeassistant.util import slugify
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from tests.async_mock import Mock, patch
|
||||
from tests.common import async_mock_service
|
||||
|
||||
GOOGLE_CONFIG = {CONF_CLIENT_ID: "client_id", CONF_CLIENT_SECRET: "client_secret"}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
"""The tests for the Google Calendar component."""
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.google as google
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
|
||||
@pytest.fixture(name="google_setup")
|
||||
def mock_google_setup(hass):
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""Tests for the Google Assistant traits."""
|
||||
import logging
|
||||
from unittest.mock import Mock
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -45,7 +44,7 @@ from homeassistant.util import color
|
|||
|
||||
from . import BASIC_CONFIG, MockConfig
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.async_mock import Mock, patch
|
||||
from tests.common import async_mock_service
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
import asyncio
|
||||
import os
|
||||
import shutil
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.media_player.const import (
|
||||
ATTR_MEDIA_CONTENT_ID,
|
||||
|
@ -12,6 +11,7 @@ from homeassistant.components.media_player.const import (
|
|||
import homeassistant.components.tts as tts
|
||||
from homeassistant.setup import setup_component
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import assert_setup_component, get_test_home_assistant, mock_service
|
||||
from tests.components.tts.test_init import mutagen_mock # noqa: F401
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"""The tests for the Google Wifi platform."""
|
||||
from datetime import datetime, timedelta
|
||||
import unittest
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import requests_mock
|
||||
|
||||
|
@ -11,6 +10,7 @@ from homeassistant.const import STATE_UNKNOWN
|
|||
from homeassistant.setup import setup_component
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from tests.async_mock import Mock, patch
|
||||
from tests.common import assert_setup_component, get_test_home_assistant
|
||||
|
||||
NAME = "foo"
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
"""The tests the for GPSLogger device tracker platform."""
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant import data_entry_flow
|
||||
|
@ -16,6 +14,8 @@ from homeassistant.const import (
|
|||
from homeassistant.helpers.dispatcher import DATA_DISPATCHER
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import Mock, patch
|
||||
|
||||
HOME_LATITUDE = 37.239622
|
||||
HOME_LONGITUDE = -115.815811
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
import socket
|
||||
import unittest
|
||||
from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
||||
import homeassistant.components.graphite as graphite
|
||||
from homeassistant.const import (
|
||||
|
@ -15,6 +14,7 @@ from homeassistant.const import (
|
|||
import homeassistant.core as ha
|
||||
from homeassistant.setup import setup_component
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import get_test_home_assistant
|
||||
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue