mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 02:07:09 +00:00
Add per-file-ignore to pylint (#86289)
This commit is contained in:
parent
a0810053f1
commit
30bf0634fe
@ -117,6 +117,7 @@ load-plugins = [
|
|||||||
"hass_enforce_type_hints",
|
"hass_enforce_type_hints",
|
||||||
"hass_imports",
|
"hass_imports",
|
||||||
"hass_logger",
|
"hass_logger",
|
||||||
|
"pylint_per_file_ignores",
|
||||||
]
|
]
|
||||||
persistent = false
|
persistent = false
|
||||||
extension-pkg-allow-list = [
|
extension-pkg-allow-list = [
|
||||||
@ -219,6 +220,9 @@ runtime-typing = false
|
|||||||
[tool.pylint.CODE_STYLE]
|
[tool.pylint.CODE_STYLE]
|
||||||
max-line-length-suggestions = 72
|
max-line-length-suggestions = 72
|
||||||
|
|
||||||
|
[tool.pylint-per-file-ignores]
|
||||||
|
"/tests/"="protected-access,redefined-outer-name"
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
testpaths = [
|
testpaths = [
|
||||||
"tests",
|
"tests",
|
||||||
|
@ -15,6 +15,7 @@ mock-open==1.4.0
|
|||||||
mypy==0.991
|
mypy==0.991
|
||||||
pre-commit==2.21.0
|
pre-commit==2.21.0
|
||||||
pylint==2.15.10
|
pylint==2.15.10
|
||||||
|
pylint-per-file-ignores==1.1.0
|
||||||
pipdeptree==2.3.1
|
pipdeptree==2.3.1
|
||||||
pytest-asyncio==0.20.2
|
pytest-asyncio==0.20.2
|
||||||
pytest-aiohttp==1.0.4
|
pytest-aiohttp==1.0.4
|
||||||
|
@ -140,7 +140,7 @@ def get_test_home_assistant():
|
|||||||
|
|
||||||
def run_loop():
|
def run_loop():
|
||||||
"""Run event loop."""
|
"""Run event loop."""
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
loop._thread_ident = threading.get_ident()
|
loop._thread_ident = threading.get_ident()
|
||||||
loop.run_forever()
|
loop.run_forever()
|
||||||
loop_stop_event.set()
|
loop_stop_event.set()
|
||||||
@ -166,7 +166,6 @@ def get_test_home_assistant():
|
|||||||
return hass
|
return hass
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=protected-access
|
|
||||||
async def async_test_home_assistant(event_loop, load_registries=True):
|
async def async_test_home_assistant(event_loop, load_registries=True):
|
||||||
"""Return a Home Assistant object pointing at test config dir."""
|
"""Return a Home Assistant object pointing at test config dir."""
|
||||||
hass = HomeAssistant()
|
hass = HomeAssistant()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The tests for the Alert component."""
|
"""The tests for the Alert component."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The tests for the Alexa component."""
|
"""The tests for the Alexa component."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
import datetime
|
import datetime
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The tests for the Alexa component."""
|
"""The tests for the Alexa component."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The tests for the Home Assistant API component."""
|
"""The tests for the Home Assistant API component."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import json
|
import json
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
@ -10,8 +10,6 @@ from homeassistant.const import STATE_OFF, STATE_ON
|
|||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
from homeassistant.util import dt
|
from homeassistant.util import dt
|
||||||
|
|
||||||
# pylint: disable=redefined-outer-name
|
|
||||||
|
|
||||||
DEVICE_DATA = {"name": "Private Calendar", "device_id": "Private Calendar"}
|
DEVICE_DATA = {"name": "Private Calendar", "device_id": "Private Calendar"}
|
||||||
|
|
||||||
EVENTS = [
|
EVENTS = [
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Test fixtures for the cast integration."""
|
"""Test fixtures for the cast integration."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from unittest.mock import AsyncMock, MagicMock, patch
|
from unittest.mock import AsyncMock, MagicMock, patch
|
||||||
|
|
||||||
import pychromecast
|
import pychromecast
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The tests for the Cast Media player platform."""
|
"""The tests for the Cast Media player platform."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
@ -312,7 +312,6 @@ async def test_ws_api(hass, hass_ws_client, payload):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=protected-access
|
|
||||||
async def test_ws_prepare(hass, hass_ws_client):
|
async def test_ws_prepare(hass, hass_ws_client):
|
||||||
"""Test the Websocket prepare conversation API."""
|
"""Test the Websocket prepare conversation API."""
|
||||||
assert await async_setup_component(hass, "conversation", {})
|
assert await async_setup_component(hass, "conversation", {})
|
||||||
@ -429,7 +428,6 @@ async def test_custom_sentences_config(hass, hass_client, hass_admin_user):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=protected-access
|
|
||||||
async def test_prepare_reload(hass):
|
async def test_prepare_reload(hass):
|
||||||
"""Test calling the reload service."""
|
"""Test calling the reload service."""
|
||||||
language = hass.config.language
|
language = hass.config.language
|
||||||
@ -451,7 +449,6 @@ async def test_prepare_reload(hass):
|
|||||||
assert not agent._lang_intents.get(language)
|
assert not agent._lang_intents.get(language)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=protected-access
|
|
||||||
async def test_prepare_fail(hass):
|
async def test_prepare_fail(hass):
|
||||||
"""Test calling prepare with a non-existent language."""
|
"""Test calling prepare with a non-existent language."""
|
||||||
assert await async_setup_component(hass, "conversation", {})
|
assert await async_setup_component(hass, "conversation", {})
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The tests for the counter component."""
|
"""The tests for the counter component."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# pylint: disable=redefined-outer-name
|
|
||||||
"""Tests for the Daikin config flow."""
|
"""Tests for the Daikin config flow."""
|
||||||
import asyncio
|
import asyncio
|
||||||
from unittest.mock import PropertyMock, patch
|
from unittest.mock import PropertyMock, patch
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The tests device sun light trigger component."""
|
"""The tests device sun light trigger component."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
@ -7,8 +7,6 @@ from . import setup_integration
|
|||||||
|
|
||||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||||
|
|
||||||
# pylint: disable=redefined-outer-name
|
|
||||||
|
|
||||||
|
|
||||||
async def test_config_entry_not_ready(
|
async def test_config_entry_not_ready(
|
||||||
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
|
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
|
||||||
|
@ -61,8 +61,6 @@ RESTRICTED_ENTITY_ID = f"{MP_DOMAIN}.restricted_client"
|
|||||||
STANDBY_ENTITY_ID = f"{MP_DOMAIN}.standby_client"
|
STANDBY_ENTITY_ID = f"{MP_DOMAIN}.standby_client"
|
||||||
UNAVAILABLE_ENTITY_ID = f"{MP_DOMAIN}.unavailable_client"
|
UNAVAILABLE_ENTITY_ID = f"{MP_DOMAIN}.unavailable_client"
|
||||||
|
|
||||||
# pylint: disable=redefined-outer-name
|
|
||||||
|
|
||||||
|
|
||||||
@fixture
|
@fixture
|
||||||
def mock_now() -> datetime:
|
def mock_now() -> datetime:
|
||||||
|
@ -19,8 +19,6 @@ CLIENT_ENTITY_ID = f"{REMOTE_DOMAIN}.client"
|
|||||||
MAIN_ENTITY_ID = f"{REMOTE_DOMAIN}.host"
|
MAIN_ENTITY_ID = f"{REMOTE_DOMAIN}.host"
|
||||||
UNAVAILABLE_ENTITY_ID = f"{REMOTE_DOMAIN}.unavailable_client"
|
UNAVAILABLE_ENTITY_ID = f"{REMOTE_DOMAIN}.unavailable_client"
|
||||||
|
|
||||||
# pylint: disable=redefined-outer-name
|
|
||||||
|
|
||||||
|
|
||||||
async def test_setup(hass: HomeAssistant, aioclient_mock: AiohttpClientMocker) -> None:
|
async def test_setup(hass: HomeAssistant, aioclient_mock: AiohttpClientMocker) -> None:
|
||||||
"""Test setup with basic config."""
|
"""Test setup with basic config."""
|
||||||
|
@ -86,7 +86,7 @@ async def test_token_request_succeeds(hass):
|
|||||||
mock_ecobee.request_tokens.return_value = True
|
mock_ecobee.request_tokens.return_value = True
|
||||||
mock_ecobee.api_key = "test-api-key"
|
mock_ecobee.api_key = "test-api-key"
|
||||||
mock_ecobee.refresh_token = "test-token"
|
mock_ecobee.refresh_token = "test-token"
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
flow._ecobee = mock_ecobee
|
flow._ecobee = mock_ecobee
|
||||||
|
|
||||||
result = await flow.async_step_authorize(user_input={})
|
result = await flow.async_step_authorize(user_input={})
|
||||||
@ -109,7 +109,7 @@ async def test_token_request_fails(hass):
|
|||||||
mock_ecobee = mock_ecobee.return_value
|
mock_ecobee = mock_ecobee.return_value
|
||||||
mock_ecobee.request_tokens.return_value = False
|
mock_ecobee.request_tokens.return_value = False
|
||||||
mock_ecobee.pin = "test-pin"
|
mock_ecobee.pin = "test-pin"
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
flow._ecobee = mock_ecobee
|
flow._ecobee = mock_ecobee
|
||||||
|
|
||||||
result = await flow.async_step_authorize(user_input={})
|
result = await flow.async_step_authorize(user_input={})
|
||||||
|
@ -53,7 +53,6 @@ async def test_full_flow(
|
|||||||
DOMAIN, context={"source": SOURCE_USER}
|
DOMAIN, context={"source": SOURCE_USER}
|
||||||
)
|
)
|
||||||
|
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
@ -109,7 +108,7 @@ async def test_existing_entry(
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={"source": SOURCE_USER}
|
DOMAIN, context={"source": SOURCE_USER}
|
||||||
)
|
)
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
@ -150,7 +149,6 @@ async def test_oauth_error(
|
|||||||
DOMAIN, context={"source": SOURCE_USER}
|
DOMAIN, context={"source": SOURCE_USER}
|
||||||
)
|
)
|
||||||
|
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
@ -207,7 +205,6 @@ async def test_reauthentication(
|
|||||||
|
|
||||||
result = await hass.config_entries.flow.async_configure(flows[0]["flow_id"], {})
|
result = await hass.config_entries.flow.async_configure(flows[0]["flow_id"], {})
|
||||||
|
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
"""The tests for the Geofency device tracker platform."""
|
"""The tests for the Geofency device tracker platform."""
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
|
||||||
# pylint: disable=redefined-outer-name
|
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
"""The tests for the Google Assistant component."""
|
"""The tests for the Google Assistant component."""
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
|
||||||
# pylint: disable=protected-access
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from aiohttp.hdrs import AUTHORIZATION
|
from aiohttp.hdrs import AUTHORIZATION
|
||||||
@ -127,9 +125,6 @@ def hass_fixture(event_loop, hass):
|
|||||||
return hass
|
return hass
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=redefined-outer-name
|
|
||||||
|
|
||||||
|
|
||||||
async def test_sync_request(hass_fixture, assistant_client, auth_header):
|
async def test_sync_request(hass_fixture, assistant_client, auth_header):
|
||||||
"""Test a sync request."""
|
"""Test a sync request."""
|
||||||
|
|
||||||
|
@ -228,7 +228,6 @@ async def test_sync_message(hass, registries):
|
|||||||
assert events[0].data == {"request_id": REQ_ID, "source": "cloud"}
|
assert events[0].data == {"request_id": REQ_ID, "source": "cloud"}
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=redefined-outer-name
|
|
||||||
@pytest.mark.parametrize("area_on_device", [True, False])
|
@pytest.mark.parametrize("area_on_device", [True, False])
|
||||||
async def test_sync_in_area(area_on_device, hass, registries):
|
async def test_sync_in_area(area_on_device, hass, registries):
|
||||||
"""Test a sync message where room hint comes from area."""
|
"""Test a sync message where room hint comes from area."""
|
||||||
@ -921,7 +920,7 @@ async def test_unavailable_state_does_sync(hass):
|
|||||||
)
|
)
|
||||||
light.hass = hass
|
light.hass = hass
|
||||||
light.entity_id = "light.demo_light"
|
light.entity_id = "light.demo_light"
|
||||||
light._available = False # pylint: disable=protected-access
|
light._available = False
|
||||||
await light.async_update_ha_state()
|
await light.async_update_ha_state()
|
||||||
|
|
||||||
events = async_capture_events(hass, EVENT_SYNC_RECEIVED)
|
events = async_capture_events(hass, EVENT_SYNC_RECEIVED)
|
||||||
|
@ -17,8 +17,6 @@ from homeassistant.setup import async_setup_component
|
|||||||
HOME_LATITUDE = 37.239622
|
HOME_LATITUDE = 37.239622
|
||||||
HOME_LONGITUDE = -115.815811
|
HOME_LONGITUDE = -115.815811
|
||||||
|
|
||||||
# pylint: disable=redefined-outer-name
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
def mock_dev_track(mock_device_tracker_conf):
|
def mock_dev_track(mock_device_tracker_conf):
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The tests for the Group components."""
|
"""The tests for the Group components."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The tests the History component."""
|
"""The tests the History component."""
|
||||||
# pylint: disable=protected-access,invalid-name
|
# pylint: disable=invalid-name
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import json
|
import json
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""The tests the History component."""
|
"""The tests the History component."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
# pylint: disable=protected-access,invalid-name
|
# pylint: disable=invalid-name
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import importlib
|
import importlib
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The test for the History Statistics sensor platform."""
|
"""The test for the History Statistics sensor platform."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
@ -36,7 +36,7 @@ async def test_full_flow(
|
|||||||
"home_plus_control", context={"source": config_entries.SOURCE_USER}
|
"home_plus_control", context={"source": config_entries.SOURCE_USER}
|
||||||
)
|
)
|
||||||
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt( # pylint: disable=protected-access
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
"flow_id": result["flow_id"],
|
"flow_id": result["flow_id"],
|
||||||
@ -154,7 +154,7 @@ async def test_abort_if_invalid_token(
|
|||||||
"home_plus_control", context={"source": config_entries.SOURCE_USER}
|
"home_plus_control", context={"source": config_entries.SOURCE_USER}
|
||||||
)
|
)
|
||||||
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt( # pylint: disable=protected-access
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
"flow_id": result["flow_id"],
|
"flow_id": result["flow_id"],
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The tests for Core components."""
|
"""The tests for Core components."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import Mock, patch
|
from unittest.mock import Mock, patch
|
||||||
|
@ -20,7 +20,6 @@ from tests.common import (
|
|||||||
from tests.components.blueprint.conftest import stub_blueprint_populate # noqa: F401
|
from tests.components.blueprint.conftest import stub_blueprint_populate # noqa: F401
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=redefined-outer-name
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def calls(hass):
|
def calls(hass):
|
||||||
"""Track calls to a mock service."""
|
"""Track calls to a mock service."""
|
||||||
|
@ -37,9 +37,7 @@ def mock_connection_fixture() -> AsyncConnection:
|
|||||||
def _rest_call_side_effect(path, body=None):
|
def _rest_call_side_effect(path, body=None):
|
||||||
return path, body
|
return path, body
|
||||||
|
|
||||||
connection._restCall.side_effect = ( # pylint: disable=protected-access
|
connection._restCall.side_effect = _rest_call_side_effect
|
||||||
_rest_call_side_effect
|
|
||||||
)
|
|
||||||
connection.api_call = AsyncMock(return_value=True)
|
connection.api_call = AsyncMock(return_value=True)
|
||||||
connection.init = AsyncMock(side_effect=True)
|
connection.init = AsyncMock(side_effect=True)
|
||||||
|
|
||||||
|
@ -62,9 +62,7 @@ async def async_manipulate_test_data(
|
|||||||
fire_target = hmip_device if fire_device is None else fire_device
|
fire_target = hmip_device if fire_device is None else fire_device
|
||||||
|
|
||||||
if isinstance(fire_target, AsyncHome):
|
if isinstance(fire_target, AsyncHome):
|
||||||
fire_target.fire_update_event(
|
fire_target.fire_update_event(fire_target._rawJSONData)
|
||||||
fire_target._rawJSONData # pylint: disable=protected-access
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
fire_target.fire_update_event()
|
fire_target.fire_update_event()
|
||||||
|
|
||||||
@ -206,9 +204,7 @@ class HomeTemplate(Home):
|
|||||||
def _get_mock(instance):
|
def _get_mock(instance):
|
||||||
"""Create a mock and copy instance attributes over mock."""
|
"""Create a mock and copy instance attributes over mock."""
|
||||||
if isinstance(instance, Mock):
|
if isinstance(instance, Mock):
|
||||||
instance.__dict__.update(
|
instance.__dict__.update(instance._mock_wraps.__dict__)
|
||||||
instance._mock_wraps.__dict__ # pylint: disable=protected-access
|
|
||||||
)
|
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
mock = Mock(spec=instance, wraps=instance)
|
mock = Mock(spec=instance, wraps=instance)
|
||||||
|
@ -18,7 +18,7 @@ async def _async_manipulate_security_zones(
|
|||||||
hass, home, internal_active=False, external_active=False, alarm_triggered=False
|
hass, home, internal_active=False, external_active=False, alarm_triggered=False
|
||||||
):
|
):
|
||||||
"""Set new values on hmip security zones."""
|
"""Set new values on hmip security zones."""
|
||||||
json = home._rawJSONData # pylint: disable=protected-access
|
json = home._rawJSONData
|
||||||
json["functionalHomes"]["SECURITY_AND_ALARM"]["alarmActive"] = alarm_triggered
|
json["functionalHomes"]["SECURITY_AND_ALARM"]["alarmActive"] = alarm_triggered
|
||||||
external_zone_id = json["functionalHomes"]["SECURITY_AND_ALARM"]["securityZones"][
|
external_zone_id = json["functionalHomes"]["SECURITY_AND_ALARM"]["securityZones"][
|
||||||
"EXTERNAL"
|
"EXTERNAL"
|
||||||
|
@ -408,7 +408,7 @@ async def test_hmip_climate_services(hass, mock_hap_with_service):
|
|||||||
)
|
)
|
||||||
assert home.mock_calls[-1][0] == "activate_absence_with_duration"
|
assert home.mock_calls[-1][0] == "activate_absence_with_duration"
|
||||||
assert home.mock_calls[-1][1] == (60,)
|
assert home.mock_calls[-1][1] == (60,)
|
||||||
assert len(home._connection.mock_calls) == 1 # pylint: disable=protected-access
|
assert len(home._connection.mock_calls) == 1
|
||||||
|
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
"homematicip_cloud",
|
"homematicip_cloud",
|
||||||
@ -418,7 +418,7 @@ async def test_hmip_climate_services(hass, mock_hap_with_service):
|
|||||||
)
|
)
|
||||||
assert home.mock_calls[-1][0] == "activate_absence_with_duration"
|
assert home.mock_calls[-1][0] == "activate_absence_with_duration"
|
||||||
assert home.mock_calls[-1][1] == (60,)
|
assert home.mock_calls[-1][1] == (60,)
|
||||||
assert len(home._connection.mock_calls) == 2 # pylint: disable=protected-access
|
assert len(home._connection.mock_calls) == 2
|
||||||
|
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
"homematicip_cloud",
|
"homematicip_cloud",
|
||||||
@ -428,7 +428,7 @@ async def test_hmip_climate_services(hass, mock_hap_with_service):
|
|||||||
)
|
)
|
||||||
assert home.mock_calls[-1][0] == "activate_absence_with_period"
|
assert home.mock_calls[-1][0] == "activate_absence_with_period"
|
||||||
assert home.mock_calls[-1][1] == (datetime.datetime(2019, 2, 17, 14, 0),)
|
assert home.mock_calls[-1][1] == (datetime.datetime(2019, 2, 17, 14, 0),)
|
||||||
assert len(home._connection.mock_calls) == 3 # pylint: disable=protected-access
|
assert len(home._connection.mock_calls) == 3
|
||||||
|
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
"homematicip_cloud",
|
"homematicip_cloud",
|
||||||
@ -438,7 +438,7 @@ async def test_hmip_climate_services(hass, mock_hap_with_service):
|
|||||||
)
|
)
|
||||||
assert home.mock_calls[-1][0] == "activate_absence_with_period"
|
assert home.mock_calls[-1][0] == "activate_absence_with_period"
|
||||||
assert home.mock_calls[-1][1] == (datetime.datetime(2019, 2, 17, 14, 0),)
|
assert home.mock_calls[-1][1] == (datetime.datetime(2019, 2, 17, 14, 0),)
|
||||||
assert len(home._connection.mock_calls) == 4 # pylint: disable=protected-access
|
assert len(home._connection.mock_calls) == 4
|
||||||
|
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
"homematicip_cloud",
|
"homematicip_cloud",
|
||||||
@ -448,7 +448,7 @@ async def test_hmip_climate_services(hass, mock_hap_with_service):
|
|||||||
)
|
)
|
||||||
assert home.mock_calls[-1][0] == "activate_vacation"
|
assert home.mock_calls[-1][0] == "activate_vacation"
|
||||||
assert home.mock_calls[-1][1] == (datetime.datetime(2019, 2, 17, 14, 0), 18.5)
|
assert home.mock_calls[-1][1] == (datetime.datetime(2019, 2, 17, 14, 0), 18.5)
|
||||||
assert len(home._connection.mock_calls) == 5 # pylint: disable=protected-access
|
assert len(home._connection.mock_calls) == 5
|
||||||
|
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
"homematicip_cloud",
|
"homematicip_cloud",
|
||||||
@ -458,7 +458,7 @@ async def test_hmip_climate_services(hass, mock_hap_with_service):
|
|||||||
)
|
)
|
||||||
assert home.mock_calls[-1][0] == "activate_vacation"
|
assert home.mock_calls[-1][0] == "activate_vacation"
|
||||||
assert home.mock_calls[-1][1] == (datetime.datetime(2019, 2, 17, 14, 0), 18.5)
|
assert home.mock_calls[-1][1] == (datetime.datetime(2019, 2, 17, 14, 0), 18.5)
|
||||||
assert len(home._connection.mock_calls) == 6 # pylint: disable=protected-access
|
assert len(home._connection.mock_calls) == 6
|
||||||
|
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
"homematicip_cloud",
|
"homematicip_cloud",
|
||||||
@ -468,14 +468,14 @@ async def test_hmip_climate_services(hass, mock_hap_with_service):
|
|||||||
)
|
)
|
||||||
assert home.mock_calls[-1][0] == "deactivate_absence"
|
assert home.mock_calls[-1][0] == "deactivate_absence"
|
||||||
assert home.mock_calls[-1][1] == ()
|
assert home.mock_calls[-1][1] == ()
|
||||||
assert len(home._connection.mock_calls) == 7 # pylint: disable=protected-access
|
assert len(home._connection.mock_calls) == 7
|
||||||
|
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
"homematicip_cloud", "deactivate_eco_mode", blocking=True
|
"homematicip_cloud", "deactivate_eco_mode", blocking=True
|
||||||
)
|
)
|
||||||
assert home.mock_calls[-1][0] == "deactivate_absence"
|
assert home.mock_calls[-1][0] == "deactivate_absence"
|
||||||
assert home.mock_calls[-1][1] == ()
|
assert home.mock_calls[-1][1] == ()
|
||||||
assert len(home._connection.mock_calls) == 8 # pylint: disable=protected-access
|
assert len(home._connection.mock_calls) == 8
|
||||||
|
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
"homematicip_cloud",
|
"homematicip_cloud",
|
||||||
@ -485,14 +485,14 @@ async def test_hmip_climate_services(hass, mock_hap_with_service):
|
|||||||
)
|
)
|
||||||
assert home.mock_calls[-1][0] == "deactivate_vacation"
|
assert home.mock_calls[-1][0] == "deactivate_vacation"
|
||||||
assert home.mock_calls[-1][1] == ()
|
assert home.mock_calls[-1][1] == ()
|
||||||
assert len(home._connection.mock_calls) == 9 # pylint: disable=protected-access
|
assert len(home._connection.mock_calls) == 9
|
||||||
|
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
"homematicip_cloud", "deactivate_vacation", blocking=True
|
"homematicip_cloud", "deactivate_vacation", blocking=True
|
||||||
)
|
)
|
||||||
assert home.mock_calls[-1][0] == "deactivate_vacation"
|
assert home.mock_calls[-1][0] == "deactivate_vacation"
|
||||||
assert home.mock_calls[-1][1] == ()
|
assert home.mock_calls[-1][1] == ()
|
||||||
assert len(home._connection.mock_calls) == 10 # pylint: disable=protected-access
|
assert len(home._connection.mock_calls) == 10
|
||||||
|
|
||||||
not_existing_hap_id = "5555F7110000000000000001"
|
not_existing_hap_id = "5555F7110000000000000001"
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
@ -504,7 +504,7 @@ async def test_hmip_climate_services(hass, mock_hap_with_service):
|
|||||||
assert home.mock_calls[-1][0] == "deactivate_vacation"
|
assert home.mock_calls[-1][0] == "deactivate_vacation"
|
||||||
assert home.mock_calls[-1][1] == ()
|
assert home.mock_calls[-1][1] == ()
|
||||||
# There is no further call on connection.
|
# There is no further call on connection.
|
||||||
assert len(home._connection.mock_calls) == 10 # pylint: disable=protected-access
|
assert len(home._connection.mock_calls) == 10
|
||||||
|
|
||||||
|
|
||||||
async def test_hmip_heating_group_services(hass, default_mock_hap_factory):
|
async def test_hmip_heating_group_services(hass, default_mock_hap_factory):
|
||||||
@ -529,9 +529,7 @@ async def test_hmip_heating_group_services(hass, default_mock_hap_factory):
|
|||||||
)
|
)
|
||||||
assert hmip_device.mock_calls[-1][0] == "set_active_profile"
|
assert hmip_device.mock_calls[-1][0] == "set_active_profile"
|
||||||
assert hmip_device.mock_calls[-1][1] == (1,)
|
assert hmip_device.mock_calls[-1][1] == (1,)
|
||||||
assert (
|
assert len(hmip_device._connection.mock_calls) == 2
|
||||||
len(hmip_device._connection.mock_calls) == 2 # pylint: disable=protected-access
|
|
||||||
)
|
|
||||||
|
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
"homematicip_cloud",
|
"homematicip_cloud",
|
||||||
@ -541,6 +539,4 @@ async def test_hmip_heating_group_services(hass, default_mock_hap_factory):
|
|||||||
)
|
)
|
||||||
assert hmip_device.mock_calls[-1][0] == "set_active_profile"
|
assert hmip_device.mock_calls[-1][0] == "set_active_profile"
|
||||||
assert hmip_device.mock_calls[-1][1] == (1,)
|
assert hmip_device.mock_calls[-1][1] == (1,)
|
||||||
assert (
|
assert len(hmip_device._connection.mock_calls) == 4
|
||||||
len(hmip_device._connection.mock_calls) == 4 # pylint: disable=protected-access
|
|
||||||
)
|
|
||||||
|
@ -183,7 +183,7 @@ async def test_hap_reconnected(hass, default_mock_hap_factory):
|
|||||||
ha_state = hass.states.get(entity_id)
|
ha_state = hass.states.get(entity_id)
|
||||||
assert ha_state.state == STATE_UNAVAILABLE
|
assert ha_state.state == STATE_UNAVAILABLE
|
||||||
|
|
||||||
mock_hap._accesspoint_connected = False # pylint: disable=protected-access
|
mock_hap._accesspoint_connected = False
|
||||||
await async_manipulate_test_data(hass, mock_hap.home, "connected", True)
|
await async_manipulate_test_data(hass, mock_hap.home, "connected", True)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
ha_state = hass.states.get(entity_id)
|
ha_state = hass.states.get(entity_id)
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
"""The tests for the Home Assistant HTTP component."""
|
"""The tests for the Home Assistant HTTP component."""
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
|
||||||
# pylint: disable=protected-access
|
|
||||||
from ipaddress import ip_address
|
from ipaddress import ip_address
|
||||||
import os
|
import os
|
||||||
from unittest.mock import Mock, mock_open, patch
|
from unittest.mock import Mock, mock_open, patch
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The tests for the input_boolean component."""
|
"""The tests for the input_boolean component."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
import logging
|
import logging
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Tests for the Input slider component."""
|
"""Tests for the Input slider component."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
import datetime
|
import datetime
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The tests for the Input number component."""
|
"""The tests for the Input number component."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The tests for the Input select component."""
|
"""The tests for the Input select component."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The tests for the Input text component."""
|
"""The tests for the Input text component."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -66,7 +66,6 @@ async def test_full_cloud_import_flow_multiple_devices(
|
|||||||
flow_id, user_input={"next_step_id": "pick_implementation"}
|
flow_id, user_input={"next_step_id": "pick_implementation"}
|
||||||
)
|
)
|
||||||
|
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
@ -147,7 +146,6 @@ async def test_full_cloud_import_flow_single_device(
|
|||||||
flow_id, user_input={"next_step_id": "pick_implementation"}
|
flow_id, user_input={"next_step_id": "pick_implementation"}
|
||||||
)
|
)
|
||||||
|
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
@ -267,7 +265,6 @@ async def test_full_ssdp_with_cloud_import(
|
|||||||
flow_id, user_input={"next_step_id": "pick_implementation"}
|
flow_id, user_input={"next_step_id": "pick_implementation"}
|
||||||
)
|
)
|
||||||
|
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
@ -411,7 +408,6 @@ async def test_cloud_import_updates_existing_entry(
|
|||||||
flow_id, user_input={"next_step_id": "pick_implementation"}
|
flow_id, user_input={"next_step_id": "pick_implementation"}
|
||||||
)
|
)
|
||||||
|
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
@ -518,7 +514,6 @@ async def test_cloud_abort_no_devices(
|
|||||||
flow_id, user_input={"next_step_id": "pick_implementation"}
|
flow_id, user_input={"next_step_id": "pick_implementation"}
|
||||||
)
|
)
|
||||||
|
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
@ -637,7 +632,6 @@ async def test_cloud_errors(
|
|||||||
flow_id, user_input={"next_step_id": "pick_implementation"}
|
flow_id, user_input={"next_step_id": "pick_implementation"}
|
||||||
)
|
)
|
||||||
|
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
@ -769,7 +763,6 @@ async def test_reauth_cloud_import(
|
|||||||
flow_id, user_input={"next_step_id": "pick_implementation"}
|
flow_id, user_input={"next_step_id": "pick_implementation"}
|
||||||
)
|
)
|
||||||
|
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
@ -835,7 +828,6 @@ async def test_reauth_cloud_abort_device_not_found(
|
|||||||
flow_id, user_input={"next_step_id": "pick_implementation"}
|
flow_id, user_input={"next_step_id": "pick_implementation"}
|
||||||
)
|
)
|
||||||
|
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
|
@ -62,9 +62,7 @@ async def test_on_off_commands(
|
|||||||
for service, new_state, new_value in services:
|
for service, new_state, new_value in services:
|
||||||
count += 1
|
count += 1
|
||||||
await hass.services.async_call(PLATFORM_DOMAIN, service, data, blocking=True)
|
await hass.services.async_call(PLATFORM_DOMAIN, service, data, blocking=True)
|
||||||
robot._update_data( # pylint:disable=protected-access
|
robot._update_data({updated_field: new_value}, partial=True)
|
||||||
{updated_field: new_value}, partial=True
|
|
||||||
)
|
|
||||||
|
|
||||||
assert getattr(robot, robot_command).call_count == count
|
assert getattr(robot, robot_command).call_count == count
|
||||||
assert (state := hass.states.get(entity_id))
|
assert (state := hass.states.get(entity_id))
|
||||||
|
@ -93,9 +93,7 @@ async def test_robot_with_update_already_in_progress(
|
|||||||
):
|
):
|
||||||
"""Tests the update entity was set up."""
|
"""Tests the update entity was set up."""
|
||||||
robot: LitterRobot4 = mock_account_with_litterrobot_4.robots[0]
|
robot: LitterRobot4 = mock_account_with_litterrobot_4.robots[0]
|
||||||
robot._update_data( # pylint:disable=protected-access
|
robot._update_data({"isFirmwareUpdateTriggered": True}, partial=True)
|
||||||
{"isFirmwareUpdateTriggered": True}, partial=True
|
|
||||||
)
|
|
||||||
|
|
||||||
entry = await setup_integration(
|
entry = await setup_integration(
|
||||||
hass, mock_account_with_litterrobot_4, PLATFORM_DOMAIN
|
hass, mock_account_with_litterrobot_4, PLATFORM_DOMAIN
|
||||||
|
@ -12,8 +12,6 @@ from homeassistant.config import async_process_ha_core_config
|
|||||||
from homeassistant.helpers.dispatcher import DATA_DISPATCHER
|
from homeassistant.helpers.dispatcher import DATA_DISPATCHER
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
# pylint: disable=redefined-outer-name
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
def mock_dev_track(mock_device_tracker_conf):
|
def mock_dev_track(mock_device_tracker_conf):
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The tests for the logbook component."""
|
"""The tests for the logbook component."""
|
||||||
# pylint: disable=protected-access,invalid-name
|
# pylint: disable=invalid-name
|
||||||
import asyncio
|
import asyncio
|
||||||
import collections
|
import collections
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
@ -38,9 +38,7 @@ def init_config_flow(hass):
|
|||||||
sensors=None,
|
sensors=None,
|
||||||
)
|
)
|
||||||
flow = config_flow.LogiCircleFlowHandler()
|
flow = config_flow.LogiCircleFlowHandler()
|
||||||
flow._get_authorization_url = Mock( # pylint: disable=protected-access
|
flow._get_authorization_url = Mock(return_value="http://example.com")
|
||||||
return_value="http://example.com"
|
|
||||||
)
|
|
||||||
flow.hass = hass
|
flow.hass = hass
|
||||||
return flow
|
return flow
|
||||||
|
|
||||||
@ -59,9 +57,7 @@ def mock_logi_circle():
|
|||||||
yield LogiCircle
|
yield LogiCircle
|
||||||
|
|
||||||
|
|
||||||
async def test_step_import(
|
async def test_step_import(hass, mock_logi_circle):
|
||||||
hass, mock_logi_circle # pylint: disable=redefined-outer-name
|
|
||||||
):
|
|
||||||
"""Test that we trigger import when configuring with client."""
|
"""Test that we trigger import when configuring with client."""
|
||||||
flow = init_config_flow(hass)
|
flow = init_config_flow(hass)
|
||||||
|
|
||||||
@ -70,9 +66,7 @@ async def test_step_import(
|
|||||||
assert result["step_id"] == "auth"
|
assert result["step_id"] == "auth"
|
||||||
|
|
||||||
|
|
||||||
async def test_full_flow_implementation(
|
async def test_full_flow_implementation(hass, mock_logi_circle):
|
||||||
hass, mock_logi_circle # pylint: disable=redefined-outer-name
|
|
||||||
):
|
|
||||||
"""Test registering an implementation and finishing flow works."""
|
"""Test registering an implementation and finishing flow works."""
|
||||||
config_flow.register_flow_implementation(
|
config_flow.register_flow_implementation(
|
||||||
hass,
|
hass,
|
||||||
@ -153,9 +147,7 @@ async def test_abort_if_already_setup(hass):
|
|||||||
(AuthorizationFailed, "invalid_auth"),
|
(AuthorizationFailed, "invalid_auth"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_abort_if_authorize_fails(
|
async def test_abort_if_authorize_fails(hass, mock_logi_circle, side_effect, error):
|
||||||
hass, mock_logi_circle, side_effect, error
|
|
||||||
): # pylint: disable=redefined-outer-name
|
|
||||||
"""Test we abort if authorizing fails."""
|
"""Test we abort if authorizing fails."""
|
||||||
flow = init_config_flow(hass)
|
flow = init_config_flow(hass)
|
||||||
mock_logi_circle.authorize.side_effect = side_effect
|
mock_logi_circle.authorize.side_effect = side_effect
|
||||||
@ -177,9 +169,7 @@ async def test_not_pick_implementation_if_only_one(hass):
|
|||||||
assert result["step_id"] == "auth"
|
assert result["step_id"] == "auth"
|
||||||
|
|
||||||
|
|
||||||
async def test_gen_auth_url(
|
async def test_gen_auth_url(hass, mock_logi_circle):
|
||||||
hass, mock_logi_circle
|
|
||||||
): # pylint: disable=redefined-outer-name
|
|
||||||
"""Test generating authorize URL from Logi Circle API."""
|
"""Test generating authorize URL from Logi Circle API."""
|
||||||
config_flow.register_flow_implementation(
|
config_flow.register_flow_implementation(
|
||||||
hass,
|
hass,
|
||||||
@ -195,7 +185,7 @@ async def test_gen_auth_url(
|
|||||||
flow.flow_impl = "test-auth-url"
|
flow.flow_impl = "test-auth-url"
|
||||||
await async_setup_component(hass, "http", {})
|
await async_setup_component(hass, "http", {})
|
||||||
|
|
||||||
result = flow._get_authorization_url() # pylint: disable=protected-access
|
result = flow._get_authorization_url()
|
||||||
assert result == "http://authorize.url"
|
assert result == "http://authorize.url"
|
||||||
|
|
||||||
|
|
||||||
@ -207,9 +197,7 @@ async def test_callback_view_rejects_missing_code(hass):
|
|||||||
assert resp.status == HTTPStatus.BAD_REQUEST
|
assert resp.status == HTTPStatus.BAD_REQUEST
|
||||||
|
|
||||||
|
|
||||||
async def test_callback_view_accepts_code(
|
async def test_callback_view_accepts_code(hass, mock_logi_circle):
|
||||||
hass, mock_logi_circle
|
|
||||||
): # pylint: disable=redefined-outer-name
|
|
||||||
"""Test the auth callback view handles requests with auth code."""
|
"""Test the auth callback view handles requests with auth code."""
|
||||||
init_config_flow(hass)
|
init_config_flow(hass)
|
||||||
view = LogiCircleAuthCallbackView()
|
view = LogiCircleAuthCallbackView()
|
||||||
|
@ -120,7 +120,6 @@ async def test_reauthentication_flow(
|
|||||||
|
|
||||||
result = await hass.config_entries.flow.async_configure(flows[0]["flow_id"], {})
|
result = await hass.config_entries.flow.async_configure(flows[0]["flow_id"], {})
|
||||||
|
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@ async def test_minutes_remaining_sensor(hass):
|
|||||||
end_time = now + dt_util.dt.timedelta(minutes=10)
|
end_time = now + dt_util.dt.timedelta(minutes=10)
|
||||||
|
|
||||||
# we control this mock
|
# we control this mock
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
device.zone1._end_time = (end_time).timestamp()
|
device.zone1._end_time = (end_time).timestamp()
|
||||||
|
|
||||||
with freeze_time(now), patch_async_ble_device_from_address(), patch_melnor_device(
|
with freeze_time(now), patch_async_ble_device_from_address(), patch_melnor_device(
|
||||||
|
@ -74,13 +74,13 @@ async def test_update(port, switch):
|
|||||||
|
|
||||||
async def test_update_with_target_state(port, switch):
|
async def test_update_with_target_state(port, switch):
|
||||||
"""Test update with target state."""
|
"""Test update with target state."""
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
switch._target_state = True
|
switch._target_state = True
|
||||||
port.data = {}
|
port.data = {}
|
||||||
port.data["output"] = "stale"
|
port.data["output"] = "stale"
|
||||||
switch.update()
|
switch.update()
|
||||||
assert port.data["output"] == 1.0
|
assert port.data["output"] == 1.0
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
assert switch._target_state is None
|
assert switch._target_state is None
|
||||||
port.data["output"] = "untouched"
|
port.data["output"] = "untouched"
|
||||||
switch.update()
|
switch.update()
|
||||||
@ -92,7 +92,7 @@ async def test_turn_on(port, switch):
|
|||||||
switch.turn_on()
|
switch.turn_on()
|
||||||
assert port.control.call_count == 1
|
assert port.control.call_count == 1
|
||||||
assert port.control.call_args == mock.call(True)
|
assert port.control.call_args == mock.call(True)
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
assert switch._target_state
|
assert switch._target_state
|
||||||
|
|
||||||
|
|
||||||
@ -101,5 +101,5 @@ async def test_turn_off(port, switch):
|
|||||||
switch.turn_off()
|
switch.turn_off()
|
||||||
assert port.control.call_count == 1
|
assert port.control.call_count == 1
|
||||||
assert port.control.call_args == mock.call(False)
|
assert port.control.call_args == mock.call(False)
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
assert not switch._target_state
|
assert not switch._target_state
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""Tests for mobile_app component."""
|
"""Tests for mobile_app component."""
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
|
||||||
# pylint: disable=redefined-outer-name,unused-import
|
# pylint: disable=unused-import
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from homeassistant.components.mobile_app.const import DOMAIN
|
from homeassistant.components.mobile_app.const import DOMAIN
|
||||||
|
@ -277,7 +277,7 @@ BAD_MESSAGE = {"_type": "unsupported", "tst": 1}
|
|||||||
BAD_JSON_PREFIX = "--$this is bad json#--"
|
BAD_JSON_PREFIX = "--$this is bad json#--"
|
||||||
BAD_JSON_SUFFIX = "** and it ends here ^^"
|
BAD_JSON_SUFFIX = "** and it ends here ^^"
|
||||||
|
|
||||||
# pylint: disable=invalid-name, len-as-condition, redefined-outer-name
|
# pylint: disable=invalid-name, len-as-condition
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
@ -13,7 +13,7 @@ def init_config_flow(hass, side_effect=None):
|
|||||||
"""Init a configuration flow."""
|
"""Init a configuration flow."""
|
||||||
config_flow.register_flow_implementation(hass, DOMAIN, "id", "secret")
|
config_flow.register_flow_implementation(hass, DOMAIN, "id", "secret")
|
||||||
flow = config_flow.PointFlowHandler()
|
flow = config_flow.PointFlowHandler()
|
||||||
flow._get_authorization_url = AsyncMock( # pylint: disable=protected-access
|
flow._get_authorization_url = AsyncMock(
|
||||||
return_value="https://example.com", side_effect=side_effect
|
return_value="https://example.com", side_effect=side_effect
|
||||||
)
|
)
|
||||||
flow.hass = hass
|
flow.hass = hass
|
||||||
@ -27,7 +27,7 @@ def is_authorized():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mock_pypoint(is_authorized): # pylint: disable=redefined-outer-name
|
def mock_pypoint(is_authorized):
|
||||||
"""Mock pypoint."""
|
"""Mock pypoint."""
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.point.config_flow.PointSession"
|
"homeassistant.components.point.config_flow.PointSession"
|
||||||
@ -67,9 +67,7 @@ async def test_abort_if_already_setup(hass):
|
|||||||
assert result["reason"] == "already_setup"
|
assert result["reason"] == "already_setup"
|
||||||
|
|
||||||
|
|
||||||
async def test_full_flow_implementation(
|
async def test_full_flow_implementation(hass, mock_pypoint):
|
||||||
hass, mock_pypoint # pylint: disable=redefined-outer-name
|
|
||||||
):
|
|
||||||
"""Test registering an implementation and finishing flow works."""
|
"""Test registering an implementation and finishing flow works."""
|
||||||
config_flow.register_flow_implementation(hass, "test-other", None, None)
|
config_flow.register_flow_implementation(hass, "test-other", None, None)
|
||||||
flow = init_config_flow(hass)
|
flow = init_config_flow(hass)
|
||||||
@ -95,7 +93,7 @@ async def test_full_flow_implementation(
|
|||||||
assert result["data"]["token"] == {"access_token": "boo"}
|
assert result["data"]["token"] == {"access_token": "boo"}
|
||||||
|
|
||||||
|
|
||||||
async def test_step_import(hass, mock_pypoint): # pylint: disable=redefined-outer-name
|
async def test_step_import(hass, mock_pypoint):
|
||||||
"""Test that we trigger import when configuring with client."""
|
"""Test that we trigger import when configuring with client."""
|
||||||
flow = init_config_flow(hass)
|
flow = init_config_flow(hass)
|
||||||
|
|
||||||
@ -105,9 +103,7 @@ async def test_step_import(hass, mock_pypoint): # pylint: disable=redefined-out
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("is_authorized", [False])
|
@pytest.mark.parametrize("is_authorized", [False])
|
||||||
async def test_wrong_code_flow_implementation(
|
async def test_wrong_code_flow_implementation(hass, mock_pypoint):
|
||||||
hass, mock_pypoint
|
|
||||||
): # pylint: disable=redefined-outer-name
|
|
||||||
"""Test wrong code."""
|
"""Test wrong code."""
|
||||||
flow = init_config_flow(hass)
|
flow = init_config_flow(hass)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""The tests the History component."""
|
"""The tests the History component."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
# pylint: disable=protected-access,invalid-name
|
# pylint: disable=invalid-name
|
||||||
from copy import copy
|
from copy import copy
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import json
|
import json
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""The tests the History component."""
|
"""The tests the History component."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
# pylint: disable=protected-access,invalid-name
|
# pylint: disable=invalid-name
|
||||||
from copy import copy
|
from copy import copy
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import importlib
|
import importlib
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""The tests for the Recorder component."""
|
"""The tests for the Recorder component."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
# pylint: disable=protected-access
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import sqlite3
|
import sqlite3
|
||||||
@ -505,7 +504,7 @@ def test_setup_without_migration(hass_recorder):
|
|||||||
assert recorder.get_instance(hass).schema_version == SCHEMA_VERSION
|
assert recorder.get_instance(hass).schema_version == SCHEMA_VERSION
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=redefined-outer-name,invalid-name
|
# pylint: disable=invalid-name
|
||||||
def test_saving_state_include_domains(hass_recorder):
|
def test_saving_state_include_domains(hass_recorder):
|
||||||
"""Test saving and restoring a state."""
|
"""Test saving and restoring a state."""
|
||||||
hass = hass_recorder({"include": {"domains": "test2"}})
|
hass = hass_recorder({"include": {"domains": "test2"}})
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The tests for the Recorder component."""
|
"""The tests for the Recorder component."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
import datetime
|
import datetime
|
||||||
import importlib
|
import importlib
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The tests for sensor recorder platform."""
|
"""The tests for sensor recorder platform."""
|
||||||
# pylint: disable=protected-access,invalid-name
|
# pylint: disable=invalid-name
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import importlib
|
import importlib
|
||||||
import sys
|
import sys
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
The v23 schema used for these tests has been slightly modified to add the
|
The v23 schema used for these tests has been slightly modified to add the
|
||||||
EventData table to allow the recorder to startup successfully.
|
EventData table to allow the recorder to startup successfully.
|
||||||
"""
|
"""
|
||||||
# pylint: disable=protected-access,invalid-name
|
# pylint: disable=invalid-name
|
||||||
import importlib
|
import importlib
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The tests for recorder platform migrating data from v30."""
|
"""The tests for recorder platform migrating data from v30."""
|
||||||
# pylint: disable=protected-access,invalid-name
|
# pylint: disable=invalid-name
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import importlib
|
import importlib
|
||||||
import sys
|
import sys
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The tests for sensor recorder platform."""
|
"""The tests for sensor recorder platform."""
|
||||||
# pylint: disable=protected-access,invalid-name
|
# pylint: disable=invalid-name
|
||||||
import datetime
|
import datetime
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from statistics import fmean
|
from statistics import fmean
|
||||||
|
@ -16,8 +16,6 @@ from tests.common import MockConfigEntry
|
|||||||
|
|
||||||
MAIN_ENTITY_ID = f"{REMOTE_DOMAIN}.my_roku_3"
|
MAIN_ENTITY_ID = f"{REMOTE_DOMAIN}.my_roku_3"
|
||||||
|
|
||||||
# pylint: disable=redefined-outer-name
|
|
||||||
|
|
||||||
|
|
||||||
async def test_setup(hass: HomeAssistant, init_integration: MockConfigEntry) -> None:
|
async def test_setup(hass: HomeAssistant, init_integration: MockConfigEntry) -> None:
|
||||||
"""Test setup with basic config."""
|
"""Test setup with basic config."""
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The tests for the Script component."""
|
"""The tests for the Script component."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from unittest.mock import Mock, patch
|
from unittest.mock import Mock, patch
|
||||||
|
@ -58,7 +58,7 @@ async def get_data_from_library(
|
|||||||
client = SensiboClient("123467890", aioclient_mock.create_session(hass.loop))
|
client = SensiboClient("123467890", aioclient_mock.create_session(hass.loop))
|
||||||
with patch("pysensibo.SensiboClient.async_get_devices", return_value=load_json):
|
with patch("pysensibo.SensiboClient.async_get_devices", return_value=load_json):
|
||||||
output = await client.async_get_devices_data()
|
output = await client.async_get_devices_data()
|
||||||
await client._session.close() # pylint: disable=protected-access
|
await client._session.close()
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The tests for sensor recorder platform."""
|
"""The tests for sensor recorder platform."""
|
||||||
# pylint: disable=protected-access,invalid-name
|
# pylint: disable=invalid-name
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import math
|
import math
|
||||||
from statistics import mean
|
from statistics import mean
|
||||||
|
@ -83,7 +83,7 @@ class MockAyla(AylaApi):
|
|||||||
"""Get the list of devices."""
|
"""Get the list of devices."""
|
||||||
shark = MockShark(self, SHARK_DEVICE_DICT)
|
shark = MockShark(self, SHARK_DEVICE_DICT)
|
||||||
shark.properties_full = deepcopy(SHARK_PROPERTIES_DICT)
|
shark.properties_full = deepcopy(SHARK_PROPERTIES_DICT)
|
||||||
shark._update_metadata(SHARK_METADATA_DICT) # pylint: disable=protected-access
|
shark._update_metadata(SHARK_METADATA_DICT)
|
||||||
return [shark]
|
return [shark]
|
||||||
|
|
||||||
async def async_request(self, http_method: str, url: str, **kwargs):
|
async def async_request(self, http_method: str, url: str, **kwargs):
|
||||||
|
@ -124,7 +124,7 @@ async def test_set_cover_position(hass, device_factory):
|
|||||||
assert state.attributes[ATTR_BATTERY_LEVEL] == 95
|
assert state.attributes[ATTR_BATTERY_LEVEL] == 95
|
||||||
assert state.attributes[ATTR_CURRENT_POSITION] == 10
|
assert state.attributes[ATTR_CURRENT_POSITION] == 10
|
||||||
# Ensure API called
|
# Ensure API called
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
assert device._api.post_device_command.call_count == 1 # type: ignore
|
assert device._api.post_device_command.call_count == 1 # type: ignore
|
||||||
|
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ async def test_set_cover_position_unsupported(hass, device_factory):
|
|||||||
assert ATTR_CURRENT_POSITION not in state.attributes
|
assert ATTR_CURRENT_POSITION not in state.attributes
|
||||||
|
|
||||||
# Ensure API was not called
|
# Ensure API was not called
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
assert device._api.post_device_command.call_count == 0 # type: ignore
|
assert device._api.post_device_command.call_count == 0 # type: ignore
|
||||||
|
|
||||||
|
|
||||||
|
@ -451,7 +451,6 @@ async def test_event_handler_dispatches_updated_devices(
|
|||||||
broker = smartthings.DeviceBroker(hass, config_entry, Mock(), Mock(), devices, [])
|
broker = smartthings.DeviceBroker(hass, config_entry, Mock(), Mock(), devices, [])
|
||||||
broker.connect()
|
broker.connect()
|
||||||
|
|
||||||
# pylint:disable=protected-access
|
|
||||||
await broker._event_handler(request, None, None)
|
await broker._event_handler(request, None, None)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
@ -478,7 +477,6 @@ async def test_event_handler_ignores_other_installed_app(
|
|||||||
broker = smartthings.DeviceBroker(hass, config_entry, Mock(), Mock(), [device], [])
|
broker = smartthings.DeviceBroker(hass, config_entry, Mock(), Mock(), [device], [])
|
||||||
broker.connect()
|
broker.connect()
|
||||||
|
|
||||||
# pylint:disable=protected-access
|
|
||||||
await broker._event_handler(request, None, None)
|
await broker._event_handler(request, None, None)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
@ -516,7 +514,6 @@ async def test_event_handler_fires_button_events(
|
|||||||
broker = smartthings.DeviceBroker(hass, config_entry, Mock(), Mock(), [device], [])
|
broker = smartthings.DeviceBroker(hass, config_entry, Mock(), Mock(), [device], [])
|
||||||
broker.connect()
|
broker.connect()
|
||||||
|
|
||||||
# pylint:disable=protected-access
|
|
||||||
await broker._event_handler(request, None, None)
|
await broker._event_handler(request, None, None)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
@ -20,9 +20,6 @@ DEVICE_1_ENTITY_ID = f"{MEDIA_PLAYER_DOMAIN}.my_soundtouch_1"
|
|||||||
DEVICE_2_ENTITY_ID = f"{MEDIA_PLAYER_DOMAIN}.my_soundtouch_2"
|
DEVICE_2_ENTITY_ID = f"{MEDIA_PLAYER_DOMAIN}.my_soundtouch_2"
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=redefined-outer-name
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def device1_config() -> MockConfigEntry:
|
def device1_config() -> MockConfigEntry:
|
||||||
"""Mock SoundTouch device 1 config entry."""
|
"""Mock SoundTouch device 1 config entry."""
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
"""The tests for the Home Assistant SpaceAPI component."""
|
"""The tests for the Home Assistant SpaceAPI component."""
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
|
||||||
# pylint: disable=protected-access
|
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -84,7 +84,6 @@ async def test_full_flow(
|
|||||||
DOMAIN, context={"source": SOURCE_USER}
|
DOMAIN, context={"source": SOURCE_USER}
|
||||||
)
|
)
|
||||||
|
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
@ -151,7 +150,6 @@ async def test_abort_if_spotify_error(
|
|||||||
DOMAIN, context={"source": SOURCE_USER}
|
DOMAIN, context={"source": SOURCE_USER}
|
||||||
)
|
)
|
||||||
|
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
@ -213,7 +211,6 @@ async def test_reauthentication(
|
|||||||
|
|
||||||
result = await hass.config_entries.flow.async_configure(flows[0]["flow_id"], {})
|
result = await hass.config_entries.flow.async_configure(flows[0]["flow_id"], {})
|
||||||
|
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
@ -279,7 +276,6 @@ async def test_reauth_account_mismatch(
|
|||||||
flows = hass.config_entries.flow.async_progress()
|
flows = hass.config_entries.flow.async_progress()
|
||||||
result = await hass.config_entries.flow.async_configure(flows[0]["flow_id"], {})
|
result = await hass.config_entries.flow.async_configure(flows[0]["flow_id"], {})
|
||||||
|
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Test the SSDP integration."""
|
"""Test the SSDP integration."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from ipaddress import IPv4Address
|
from ipaddress import IPv4Address
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Tests for the Subaru component config flow."""
|
"""Tests for the Subaru component config flow."""
|
||||||
# pylint: disable=redefined-outer-name
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
from unittest.mock import PropertyMock, patch
|
from unittest.mock import PropertyMock, patch
|
||||||
|
@ -5,7 +5,6 @@ import homeassistant.components.time_date.sensor as time_date
|
|||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=protected-access
|
|
||||||
async def test_intervals(hass):
|
async def test_intervals(hass):
|
||||||
"""Test timing intervals of sensors."""
|
"""Test timing intervals of sensors."""
|
||||||
device = time_date.TimeDateSensor(hass, "time")
|
device = time_date.TimeDateSensor(hass, "time")
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The tests for the timer component."""
|
"""The tests for the timer component."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
@ -54,7 +54,6 @@ async def test_full_flow_implementation(
|
|||||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||||
assert result["step_id"] == "pick_implementation"
|
assert result["step_id"] == "pick_implementation"
|
||||||
|
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
@ -114,7 +113,6 @@ async def test_no_agreements(
|
|||||||
DOMAIN, context={"source": SOURCE_USER}
|
DOMAIN, context={"source": SOURCE_USER}
|
||||||
)
|
)
|
||||||
|
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
@ -154,7 +152,6 @@ async def test_multiple_agreements(
|
|||||||
DOMAIN, context={"source": SOURCE_USER}
|
DOMAIN, context={"source": SOURCE_USER}
|
||||||
)
|
)
|
||||||
|
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
@ -205,7 +202,6 @@ async def test_agreement_already_set_up(
|
|||||||
DOMAIN, context={"source": SOURCE_USER}
|
DOMAIN, context={"source": SOURCE_USER}
|
||||||
)
|
)
|
||||||
|
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
@ -244,7 +240,7 @@ async def test_toon_abort(
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={"source": SOURCE_USER}
|
DOMAIN, context={"source": SOURCE_USER}
|
||||||
)
|
)
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
@ -306,7 +302,6 @@ async def test_import_migration(
|
|||||||
assert len(flows) == 1
|
assert len(flows) == 1
|
||||||
assert flows[0]["context"][CONF_MIGRATE] == old_entry.entry_id
|
assert flows[0]["context"][CONF_MIGRATE] == old_entry.entry_id
|
||||||
|
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
|
@ -5,8 +5,6 @@ import pytest
|
|||||||
|
|
||||||
from . import GATEWAY_ID, TRADFRI_PATH
|
from . import GATEWAY_ID, TRADFRI_PATH
|
||||||
|
|
||||||
# pylint: disable=protected-access
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mock_gateway_info():
|
def mock_gateway_info():
|
||||||
|
@ -126,7 +126,7 @@ async def test_to_get_update(mock_sendline, mock_prompt, mock_login, mock_logout
|
|||||||
scanner = get_scanner(hass, conf_dict)
|
scanner = get_scanner(hass, conf_dict)
|
||||||
# mock_sendline.side_effect = AssertionError("Test")
|
# mock_sendline.side_effect = AssertionError("Test")
|
||||||
mock_prompt.side_effect = AssertionError("Test")
|
mock_prompt.side_effect = AssertionError("Test")
|
||||||
devices = scanner._get_update() # pylint: disable=protected-access
|
devices = scanner._get_update()
|
||||||
assert devices is None
|
assert devices is None
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Fixtures and test data for UniFi Protect methods."""
|
"""Fixtures and test data for UniFi Protect methods."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Test the UniFi Protect binary_sensor platform."""
|
"""Test the UniFi Protect binary_sensor platform."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Test the UniFi Protect button platform."""
|
"""Test the UniFi Protect button platform."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from unittest.mock import AsyncMock, Mock
|
from unittest.mock import AsyncMock, Mock
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Test the UniFi Protect camera platform."""
|
"""Test the UniFi Protect camera platform."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from unittest.mock import AsyncMock, Mock
|
from unittest.mock import AsyncMock, Mock
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Test the UniFi Protect setup flow."""
|
"""Test the UniFi Protect setup flow."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import Awaitable, Callable
|
from collections.abc import Awaitable, Callable
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Test the UniFi Protect light platform."""
|
"""Test the UniFi Protect light platform."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from unittest.mock import AsyncMock, Mock
|
from unittest.mock import AsyncMock, Mock
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Test the UniFi Protect lock platform."""
|
"""Test the UniFi Protect lock platform."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from unittest.mock import AsyncMock, Mock
|
from unittest.mock import AsyncMock, Mock
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Test the UniFi Protect media_player platform."""
|
"""Test the UniFi Protect media_player platform."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from unittest.mock import AsyncMock, Mock, patch
|
from unittest.mock import AsyncMock, Mock, patch
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Test the UniFi Protect setup flow."""
|
"""Test the UniFi Protect setup flow."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from unittest.mock import AsyncMock
|
from unittest.mock import AsyncMock
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Test the UniFi Protect number platform."""
|
"""Test the UniFi Protect number platform."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Test the UniFi Protect select platform."""
|
"""Test the UniFi Protect select platform."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from copy import copy
|
from copy import copy
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Test the UniFi Protect sensor platform."""
|
"""Test the UniFi Protect sensor platform."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Test the UniFi Protect global services."""
|
"""Test the UniFi Protect global services."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from unittest.mock import AsyncMock, Mock
|
from unittest.mock import AsyncMock, Mock
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Test the UniFi Protect switch platform."""
|
"""Test the UniFi Protect switch platform."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from unittest.mock import AsyncMock, Mock
|
from unittest.mock import AsyncMock, Mock
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Test the UniFi Protect text platform."""
|
"""Test the UniFi Protect text platform."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from unittest.mock import AsyncMock, Mock
|
from unittest.mock import AsyncMock, Mock
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Test helpers for UniFi Protect."""
|
"""Test helpers for UniFi Protect."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import Sequence
|
from collections.abc import Sequence
|
||||||
|
@ -198,7 +198,7 @@ class ComponentFactory:
|
|||||||
const.DOMAIN, context={"source": SOURCE_USER}
|
const.DOMAIN, context={"source": SOURCE_USER}
|
||||||
)
|
)
|
||||||
assert result
|
assert result
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
self._hass,
|
self._hass,
|
||||||
{
|
{
|
||||||
|
@ -163,10 +163,8 @@ async def test_data_manager_webhook_subscription(
|
|||||||
WebhookConfig(id="1234", url="http://localhost/api/webhook/1234", enabled=True),
|
WebhookConfig(id="1234", url="http://localhost/api/webhook/1234", enabled=True),
|
||||||
)
|
)
|
||||||
|
|
||||||
# pylint: disable=protected-access
|
|
||||||
data_manager._notify_subscribe_delay = datetime.timedelta(seconds=0)
|
data_manager._notify_subscribe_delay = datetime.timedelta(seconds=0)
|
||||||
data_manager._notify_unsubscribe_delay = datetime.timedelta(seconds=0)
|
data_manager._notify_unsubscribe_delay = datetime.timedelta(seconds=0)
|
||||||
# pylint: enable=protected-access
|
|
||||||
|
|
||||||
api.notify_list.return_value = NotifyListResponse(
|
api.notify_list.return_value = NotifyListResponse(
|
||||||
profiles=(
|
profiles=(
|
||||||
|
@ -80,7 +80,6 @@ async def test_config_reauth_profile(
|
|||||||
{},
|
{},
|
||||||
)
|
)
|
||||||
|
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
|
@ -172,7 +172,6 @@ async def test_reauthentication(
|
|||||||
|
|
||||||
result = await hass.config_entries.flow.async_configure(flows[0]["flow_id"], {})
|
result = await hass.config_entries.flow.async_configure(flows[0]["flow_id"], {})
|
||||||
|
|
||||||
# pylint: disable-next=protected-access
|
|
||||||
state = config_entry_oauth2_flow._encode_jwt(
|
state = config_entry_oauth2_flow._encode_jwt(
|
||||||
hass,
|
hass,
|
||||||
{
|
{
|
||||||
|
@ -245,7 +245,7 @@ def verify_cleanup(event_loop: asyncio.AbstractEventLoop):
|
|||||||
if tasks:
|
if tasks:
|
||||||
event_loop.run_until_complete(asyncio.wait(tasks))
|
event_loop.run_until_complete(asyncio.wait(tasks))
|
||||||
|
|
||||||
for handle in event_loop._scheduled: # pylint: disable=protected-access
|
for handle in event_loop._scheduled:
|
||||||
if not handle.cancelled():
|
if not handle.cancelled():
|
||||||
_LOGGER.warning("Lingering timer after test %r", handle)
|
_LOGGER.warning("Lingering timer after test %r", handle)
|
||||||
handle.cancel()
|
handle.cancel()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Test the entity helper."""
|
"""Test the entity helper."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import dataclasses
|
import dataclasses
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user