mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Move entity_registry_enabled_by_default to decorator [a-p] (#118794)
This commit is contained in:
parent
089874f818
commit
3d31af3eb4
@ -31,9 +31,9 @@ from . import init_integration
|
||||
from tests.common import async_fire_time_changed, snapshot_platform
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_sensor(
|
||||
hass: HomeAssistant,
|
||||
entity_registry_enabled_by_default: None,
|
||||
entity_registry: er.EntityRegistry,
|
||||
mock_accuweather_client: AsyncMock,
|
||||
snapshot: SnapshotAssertion,
|
||||
|
@ -4,6 +4,7 @@ import copy
|
||||
from unittest.mock import patch
|
||||
|
||||
from aioairzone.const import API_DATA, API_SYSTEMS
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.airzone.coordinator import SCAN_INTERVAL
|
||||
from homeassistant.const import STATE_UNAVAILABLE
|
||||
@ -22,9 +23,8 @@ from .util import (
|
||||
from tests.common import async_fire_time_changed
|
||||
|
||||
|
||||
async def test_airzone_create_sensors(
|
||||
hass: HomeAssistant, entity_registry_enabled_by_default: None
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_airzone_create_sensors(hass: HomeAssistant) -> None:
|
||||
"""Test creation of sensors."""
|
||||
|
||||
await async_init_integration(hass)
|
||||
@ -81,9 +81,8 @@ async def test_airzone_create_sensors(
|
||||
assert state is None
|
||||
|
||||
|
||||
async def test_airzone_sensors_availability(
|
||||
hass: HomeAssistant, entity_registry_enabled_by_default: None
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_airzone_sensors_availability(hass: HomeAssistant) -> None:
|
||||
"""Test sensors availability."""
|
||||
|
||||
await async_init_integration(hass)
|
||||
|
@ -12,9 +12,8 @@ from homeassistant.exceptions import ServiceValidationError
|
||||
from .util import async_init_integration
|
||||
|
||||
|
||||
async def test_airzone_create_selects(
|
||||
hass: HomeAssistant, entity_registry_enabled_by_default: None
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_airzone_create_selects(hass: HomeAssistant) -> None:
|
||||
"""Test creation of selects."""
|
||||
|
||||
await async_init_integration(hass)
|
||||
|
@ -1,13 +1,14 @@
|
||||
"""The sensor tests for the Airzone Cloud platform."""
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .util import async_init_integration
|
||||
|
||||
|
||||
async def test_airzone_create_sensors(
|
||||
hass: HomeAssistant, entity_registry_enabled_by_default: None
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_airzone_create_sensors(hass: HomeAssistant) -> None:
|
||||
"""Test creation of sensors."""
|
||||
|
||||
await async_init_integration(hass)
|
||||
|
@ -1,5 +1,7 @@
|
||||
"""Test the Aranet sensors."""
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.aranet.const import DOMAIN
|
||||
from homeassistant.components.sensor import ATTR_STATE_CLASS
|
||||
from homeassistant.const import ATTR_FRIENDLY_NAME, ATTR_UNIT_OF_MEASUREMENT
|
||||
@ -16,9 +18,8 @@ from tests.common import MockConfigEntry
|
||||
from tests.components.bluetooth import inject_bluetooth_service_info
|
||||
|
||||
|
||||
async def test_sensors_aranet_radiation(
|
||||
hass: HomeAssistant, entity_registry_enabled_by_default: None
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_sensors_aranet_radiation(hass: HomeAssistant) -> None:
|
||||
"""Test setting up creates the sensors for Aranet Radiation device."""
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
@ -75,9 +76,8 @@ async def test_sensors_aranet_radiation(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
||||
async def test_sensors_aranet2(
|
||||
hass: HomeAssistant, entity_registry_enabled_by_default: None
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_sensors_aranet2(hass: HomeAssistant) -> None:
|
||||
"""Test setting up creates the sensors for Aranet2 device."""
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
@ -125,9 +125,8 @@ async def test_sensors_aranet2(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
||||
async def test_sensors_aranet4(
|
||||
hass: HomeAssistant, entity_registry_enabled_by_default: None
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_sensors_aranet4(hass: HomeAssistant) -> None:
|
||||
"""Test setting up creates the sensors for Aranet4 device."""
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
@ -189,9 +188,8 @@ async def test_sensors_aranet4(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
||||
async def test_smart_home_integration_disabled(
|
||||
hass: HomeAssistant, entity_registry_enabled_by_default: None
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_smart_home_integration_disabled(hass: HomeAssistant) -> None:
|
||||
"""Test disabling smart home integration marks entities as unavailable."""
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
|
@ -3,6 +3,7 @@
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
from freezegun.api import FrozenDateTimeFactory
|
||||
import pytest
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.brother.const import DOMAIN, UPDATE_INTERVAL
|
||||
@ -16,10 +17,10 @@ from . import init_integration
|
||||
from tests.common import MockConfigEntry, async_fire_time_changed, snapshot_platform
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_sensors(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
entity_registry_enabled_by_default: None,
|
||||
snapshot: SnapshotAssertion,
|
||||
mock_brother_client: AsyncMock,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
|
@ -28,7 +28,7 @@ from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def enable_all_entities(entity_registry_enabled_by_default):
|
||||
def enable_all_entities(entity_registry_enabled_by_default: None) -> None:
|
||||
"""Make sure all entities are enabled."""
|
||||
|
||||
|
||||
|
@ -77,9 +77,9 @@ async def test_buttons(
|
||||
assert button.state != STATE_UNKNOWN
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_wol_button(
|
||||
hass: HomeAssistant,
|
||||
entity_registry_enabled_by_default: None,
|
||||
fc_class_mock,
|
||||
fh_class_mock,
|
||||
) -> None:
|
||||
@ -110,9 +110,9 @@ async def test_wol_button(
|
||||
assert button.state != STATE_UNKNOWN
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_wol_button_new_device(
|
||||
hass: HomeAssistant,
|
||||
entity_registry_enabled_by_default: None,
|
||||
fc_class_mock,
|
||||
fh_class_mock,
|
||||
) -> None:
|
||||
@ -138,9 +138,9 @@ async def test_wol_button_new_device(
|
||||
assert hass.states.get("button.server_wake_on_lan")
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_wol_button_absent_for_mesh_slave(
|
||||
hass: HomeAssistant,
|
||||
entity_registry_enabled_by_default: None,
|
||||
fc_class_mock,
|
||||
fh_class_mock,
|
||||
) -> None:
|
||||
@ -160,9 +160,9 @@ async def test_wol_button_absent_for_mesh_slave(
|
||||
assert button is None
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_wol_button_absent_for_non_lan_device(
|
||||
hass: HomeAssistant,
|
||||
entity_registry_enabled_by_default: None,
|
||||
fc_class_mock,
|
||||
fh_class_mock,
|
||||
) -> None:
|
||||
|
@ -1,5 +1,7 @@
|
||||
"""Sensor tests for the Goalzero integration."""
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.goalzero.const import DEFAULT_NAME
|
||||
from homeassistant.components.sensor import (
|
||||
ATTR_STATE_CLASS,
|
||||
@ -25,10 +27,9 @@ from . import async_init_integration
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_sensors(
|
||||
hass: HomeAssistant,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
entity_registry_enabled_by_default: None,
|
||||
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
|
||||
) -> None:
|
||||
"""Test we get sensor data."""
|
||||
await async_init_integration(hass, aioclient_mock)
|
||||
|
@ -61,9 +61,8 @@ async def test_registry_settings(
|
||||
ENTITY_ID_XFAN,
|
||||
],
|
||||
)
|
||||
async def test_send_switch_on(
|
||||
hass: HomeAssistant, entity, entity_registry_enabled_by_default: None
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_send_switch_on(hass: HomeAssistant, entity: str) -> None:
|
||||
"""Test for sending power on command to the device."""
|
||||
await async_setup_gree(hass)
|
||||
|
||||
@ -89,8 +88,9 @@ async def test_send_switch_on(
|
||||
ENTITY_ID_XFAN,
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_send_switch_on_device_timeout(
|
||||
hass: HomeAssistant, device, entity, entity_registry_enabled_by_default: None
|
||||
hass: HomeAssistant, device, entity: str
|
||||
) -> None:
|
||||
"""Test for sending power on command to the device with a device timeout."""
|
||||
device().push_state_update.side_effect = DeviceTimeoutError
|
||||
@ -119,9 +119,8 @@ async def test_send_switch_on_device_timeout(
|
||||
ENTITY_ID_XFAN,
|
||||
],
|
||||
)
|
||||
async def test_send_switch_off(
|
||||
hass: HomeAssistant, entity, entity_registry_enabled_by_default: None
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_send_switch_off(hass: HomeAssistant, entity: str) -> None:
|
||||
"""Test for sending power on command to the device."""
|
||||
await async_setup_gree(hass)
|
||||
|
||||
@ -147,9 +146,8 @@ async def test_send_switch_off(
|
||||
ENTITY_ID_XFAN,
|
||||
],
|
||||
)
|
||||
async def test_send_switch_toggle(
|
||||
hass: HomeAssistant, entity, entity_registry_enabled_by_default: None
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_send_switch_toggle(hass: HomeAssistant, entity: str) -> None:
|
||||
"""Test for sending power on command to the device."""
|
||||
await async_setup_gree(hass)
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import automation, script
|
||||
from homeassistant.components.automation import automations_with_entity
|
||||
from homeassistant.components.harmony.const import DOMAIN
|
||||
@ -142,12 +144,12 @@ async def _toggle_switch_and_wait(hass, service_name, entity):
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_create_issue(
|
||||
harmony_client,
|
||||
mock_hc,
|
||||
hass: HomeAssistant,
|
||||
mock_write_config,
|
||||
entity_registry_enabled_by_default: None,
|
||||
issue_registry: ir.IssueRegistry,
|
||||
) -> None:
|
||||
"""Test we create an issue when an automation or script is using a deprecated entity."""
|
||||
|
@ -999,10 +999,10 @@ async def test_coordinator_updates(
|
||||
assert "Error on Supervisor API: Unknown" in caplog.text
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_coordinator_updates_stats_entities_enabled(
|
||||
hass: HomeAssistant,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
entity_registry_enabled_by_default: None,
|
||||
) -> None:
|
||||
"""Test coordinator updates with stats entities enabled."""
|
||||
await async_setup_component(hass, "homeassistant", {})
|
||||
|
@ -8,6 +8,7 @@ from aiohomekit.model.characteristics.const import ThreadNodeCapabilities, Threa
|
||||
from aiohomekit.model.services import ServicesTypes
|
||||
from aiohomekit.protocol.statuscodes import HapStatusCode
|
||||
from aiohomekit.testing import FakePairing
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.homekit_controller.sensor import (
|
||||
thread_node_capability_to_str,
|
||||
@ -381,11 +382,8 @@ def test_thread_status_to_str() -> None:
|
||||
assert thread_status_to_str(ThreadStatus.DISABLED) == "disabled"
|
||||
|
||||
|
||||
async def test_rssi_sensor(
|
||||
hass: HomeAssistant,
|
||||
entity_registry_enabled_by_default: None,
|
||||
enable_bluetooth: None,
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("enable_bluetooth", "entity_registry_enabled_by_default")
|
||||
async def test_rssi_sensor(hass: HomeAssistant) -> None:
|
||||
"""Test an rssi sensor."""
|
||||
inject_bluetooth_service_info(hass, TEST_DEVICE_SERVICE_INFO)
|
||||
|
||||
@ -405,11 +403,9 @@ async def test_rssi_sensor(
|
||||
assert hass.states.get("sensor.testdevice_signal_strength").state == "-56"
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("enable_bluetooth", "entity_registry_enabled_by_default")
|
||||
async def test_migrate_rssi_sensor_unique_id(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
entity_registry_enabled_by_default: None,
|
||||
enable_bluetooth: None,
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
||||
) -> None:
|
||||
"""Test an rssi sensor unique id migration."""
|
||||
rssi_sensor = entity_registry.async_get_or_create(
|
||||
|
@ -2,16 +2,15 @@
|
||||
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import init_integration
|
||||
|
||||
|
||||
async def test_height_sensor(
|
||||
hass: HomeAssistant,
|
||||
mock_desk_api: MagicMock,
|
||||
entity_registry_enabled_by_default: None,
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_height_sensor(hass: HomeAssistant, mock_desk_api: MagicMock) -> None:
|
||||
"""Test height sensor."""
|
||||
await init_integration(hass)
|
||||
|
||||
|
@ -4,6 +4,7 @@ from unittest.mock import AsyncMock, patch
|
||||
|
||||
from freezegun.api import FrozenDateTimeFactory
|
||||
from imgw_pib import ApiError
|
||||
import pytest
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.imgw_pib.const import UPDATE_INTERVAL
|
||||
@ -18,13 +19,13 @@ from tests.common import MockConfigEntry, async_fire_time_changed, snapshot_plat
|
||||
ENTITY_ID = "sensor.river_name_station_name_water_level"
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_sensor(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
mock_imgw_pib_client: AsyncMock,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
entity_registry_enabled_by_default: None,
|
||||
) -> None:
|
||||
"""Test states of the sensor."""
|
||||
with patch("homeassistant.components.imgw_pib.PLATFORMS", [Platform.SENSOR]):
|
||||
|
@ -92,12 +92,12 @@ def mock_get_setting_values(mock_plenticore_client: ApiClient) -> list:
|
||||
return setting_values
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_setup_all_entries(
|
||||
hass: HomeAssistant,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_plenticore_client: ApiClient,
|
||||
mock_get_setting_values: list,
|
||||
entity_registry_enabled_by_default: None,
|
||||
) -> None:
|
||||
"""Test if all available entries are setup."""
|
||||
|
||||
@ -111,12 +111,12 @@ async def test_setup_all_entries(
|
||||
assert ent_reg.async_get("number.scb_battery_min_home_consumption") is not None
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_setup_no_entries(
|
||||
hass: HomeAssistant,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_plenticore_client: ApiClient,
|
||||
mock_get_setting_values: list,
|
||||
entity_registry_enabled_by_default: None,
|
||||
) -> None:
|
||||
"""Test that no entries are setup if Plenticore does not provide data."""
|
||||
|
||||
@ -145,12 +145,12 @@ async def test_setup_no_entries(
|
||||
assert ent_reg.async_get("number.scb_battery_min_home_consumption") is None
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_number_has_value(
|
||||
hass: HomeAssistant,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_plenticore_client: ApiClient,
|
||||
mock_get_setting_values: list,
|
||||
entity_registry_enabled_by_default: None,
|
||||
) -> None:
|
||||
"""Test if number has a value if data is provided on update."""
|
||||
|
||||
@ -170,12 +170,12 @@ async def test_number_has_value(
|
||||
assert state.attributes[ATTR_MAX] == 100
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_number_is_unavailable(
|
||||
hass: HomeAssistant,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_plenticore_client: ApiClient,
|
||||
mock_get_setting_values: list,
|
||||
entity_registry_enabled_by_default: None,
|
||||
) -> None:
|
||||
"""Test if number is unavailable if no data is provided on update."""
|
||||
|
||||
@ -191,12 +191,12 @@ async def test_number_is_unavailable(
|
||||
assert state.state == STATE_UNAVAILABLE
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_set_value(
|
||||
hass: HomeAssistant,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_plenticore_client: ApiClient,
|
||||
mock_get_setting_values: list,
|
||||
entity_registry_enabled_by_default: None,
|
||||
) -> None:
|
||||
"""Test if a new value could be set."""
|
||||
|
||||
|
@ -5,6 +5,7 @@ from unittest.mock import patch
|
||||
|
||||
from freezegun.api import FrozenDateTimeFactory
|
||||
from pykrakenapi.pykrakenapi import KrakenAPIError
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.kraken.const import (
|
||||
CONF_TRACKED_ASSET_PAIRS,
|
||||
@ -26,10 +27,10 @@ from .const import (
|
||||
from tests.common import MockConfigEntry, async_fire_time_changed
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_sensor(
|
||||
hass: HomeAssistant,
|
||||
freezer: FrozenDateTimeFactory,
|
||||
entity_registry_enabled_by_default: None,
|
||||
) -> None:
|
||||
"""Test that sensor has a value."""
|
||||
with (
|
||||
|
@ -1,5 +1,7 @@
|
||||
"""The tests for Lidarr sensor platform."""
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.sensor import CONF_STATE_CLASS, SensorStateClass
|
||||
from homeassistant.const import ATTR_UNIT_OF_MEASUREMENT
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -7,10 +9,10 @@ from homeassistant.core import HomeAssistant
|
||||
from .conftest import ComponentSetup
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_sensors(
|
||||
hass: HomeAssistant,
|
||||
setup_integration: ComponentSetup,
|
||||
entity_registry_enabled_by_default: None,
|
||||
connection,
|
||||
) -> None:
|
||||
"""Test for successfully setting up the Lidarr platform."""
|
||||
|
@ -15,10 +15,10 @@ from .conftest import setup_integration
|
||||
|
||||
|
||||
@pytest.mark.freeze_time("2022-09-18 23:00:44+00:00")
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_binary_sensors(
|
||||
hass: HomeAssistant,
|
||||
mock_account: MagicMock,
|
||||
entity_registry_enabled_by_default: None,
|
||||
) -> None:
|
||||
"""Tests binary sensors."""
|
||||
await setup_integration(hass, mock_account, PLATFORM_DOMAIN)
|
||||
|
@ -33,9 +33,9 @@ from tests.common import (
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_sensor(
|
||||
hass: HomeAssistant,
|
||||
entity_registry_enabled_by_default: None,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
freezer: FrozenDateTimeFactory,
|
||||
|
@ -1,5 +1,6 @@
|
||||
"""The tests for Netgear LTE binary sensor platform."""
|
||||
|
||||
import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
|
||||
@ -8,9 +9,9 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_binary_sensors(
|
||||
hass: HomeAssistant,
|
||||
entity_registry_enabled_by_default: None,
|
||||
setup_integration: None,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
|
@ -1,5 +1,6 @@
|
||||
"""The tests for Netgear LTE sensor platform."""
|
||||
|
||||
import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.netgear_lte.const import DOMAIN
|
||||
@ -8,9 +9,9 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_sensors(
|
||||
hass: HomeAssistant,
|
||||
entity_registry_enabled_by_default: None,
|
||||
setup_integration: None,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
|
@ -4,6 +4,7 @@ from datetime import timedelta
|
||||
from unittest.mock import patch
|
||||
|
||||
from nextdns import ApiError
|
||||
import pytest
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.const import STATE_UNAVAILABLE, Platform
|
||||
@ -16,9 +17,9 @@ from . import init_integration, mock_nextdns
|
||||
from tests.common import async_fire_time_changed, snapshot_platform
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_sensor(
|
||||
hass: HomeAssistant,
|
||||
entity_registry_enabled_by_default: None,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
@ -29,9 +30,9 @@ async def test_sensor(
|
||||
await snapshot_platform(hass, entity_registry, snapshot, entry.entry_id)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_availability(
|
||||
hass: HomeAssistant,
|
||||
entity_registry_enabled_by_default: None,
|
||||
entity_registry: er.EntityRegistry,
|
||||
) -> None:
|
||||
"""Ensure that we mark the entities unavailable correctly when service causes an error."""
|
||||
|
@ -29,9 +29,9 @@ from . import init_integration, mock_nextdns
|
||||
from tests.common import async_fire_time_changed, snapshot_platform
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_switch(
|
||||
hass: HomeAssistant,
|
||||
entity_registry_enabled_by_default: None,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
|
@ -66,6 +66,7 @@ def _setup_climate_group(
|
||||
(Model.F730, "s1", "climate.climate_system_s1"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_basic(
|
||||
hass: HomeAssistant,
|
||||
mock_connection: MockConnection,
|
||||
@ -73,7 +74,6 @@ async def test_basic(
|
||||
climate_id: str,
|
||||
entity_id: str,
|
||||
coils: dict[int, Any],
|
||||
entity_registry_enabled_by_default: None,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test setting of value."""
|
||||
@ -113,6 +113,7 @@ async def test_basic(
|
||||
(Model.F1155, "s3", "climate.climate_system_s3"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_active_accessory(
|
||||
hass: HomeAssistant,
|
||||
mock_connection: MockConnection,
|
||||
@ -120,7 +121,6 @@ async def test_active_accessory(
|
||||
climate_id: str,
|
||||
entity_id: str,
|
||||
coils: dict[int, Any],
|
||||
entity_registry_enabled_by_default: None,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test climate groups that can be deactivated by configuration."""
|
||||
@ -141,6 +141,7 @@ async def test_active_accessory(
|
||||
(Model.F1155, "s2", "climate.climate_system_s2"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_set_temperature_supported_cooling(
|
||||
hass: HomeAssistant,
|
||||
mock_connection: MockConnection,
|
||||
@ -148,7 +149,6 @@ async def test_set_temperature_supported_cooling(
|
||||
climate_id: str,
|
||||
entity_id: str,
|
||||
coils: dict[int, Any],
|
||||
entity_registry_enabled_by_default: None,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test setting temperature for models with cooling support."""
|
||||
@ -234,6 +234,7 @@ async def test_set_temperature_supported_cooling(
|
||||
(Model.F730, "s1", "climate.climate_system_s1"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_set_temperature_unsupported_cooling(
|
||||
hass: HomeAssistant,
|
||||
mock_connection: MockConnection,
|
||||
@ -241,7 +242,6 @@ async def test_set_temperature_unsupported_cooling(
|
||||
climate_id: str,
|
||||
entity_id: str,
|
||||
coils: dict[int, Any],
|
||||
entity_registry_enabled_by_default: None,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test setting temperature for models that do not support cooling."""
|
||||
@ -300,6 +300,7 @@ async def test_set_temperature_unsupported_cooling(
|
||||
(Model.F730, "s1", "climate.climate_system_s1"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_set_hvac_mode(
|
||||
hass: HomeAssistant,
|
||||
mock_connection: MockConnection,
|
||||
@ -310,7 +311,6 @@ async def test_set_hvac_mode(
|
||||
use_room_sensor: str,
|
||||
hvac_mode: HVACMode,
|
||||
coils: dict[int, Any],
|
||||
entity_registry_enabled_by_default: None,
|
||||
) -> None:
|
||||
"""Test setting a hvac mode."""
|
||||
climate, unit = _setup_climate_group(coils, model, climate_id)
|
||||
@ -349,6 +349,7 @@ async def test_set_hvac_mode(
|
||||
(Model.F730, "s1", "climate.climate_system_s1", HVACMode.COOL),
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_set_invalid_hvac_mode(
|
||||
hass: HomeAssistant,
|
||||
mock_connection: MockConnection,
|
||||
@ -357,7 +358,6 @@ async def test_set_invalid_hvac_mode(
|
||||
entity_id: str,
|
||||
unsupported_mode: str,
|
||||
coils: dict[int, Any],
|
||||
entity_registry_enabled_by_default: None,
|
||||
) -> None:
|
||||
"""Test setting an invalid hvac mode."""
|
||||
_setup_climate_group(coils, model, climate_id)
|
||||
|
@ -22,10 +22,10 @@ async def fixture_single_platform():
|
||||
yield
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_partial_refresh(
|
||||
hass: HomeAssistant,
|
||||
coils: dict[int, Any],
|
||||
entity_registry_enabled_by_default: None,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test that coordinator can handle partial fields."""
|
||||
@ -45,10 +45,10 @@ async def test_partial_refresh(
|
||||
assert data == snapshot(name="3. Sensor is available")
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_invalid_coil(
|
||||
hass: HomeAssistant,
|
||||
coils: dict[int, Any],
|
||||
entity_registry_enabled_by_default: None,
|
||||
snapshot: SnapshotAssertion,
|
||||
freezer_ticker: Any,
|
||||
) -> None:
|
||||
@ -67,10 +67,10 @@ async def test_invalid_coil(
|
||||
assert hass.states.get(entity_id) == snapshot(name="Sensor is not available")
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_pushed_update(
|
||||
hass: HomeAssistant,
|
||||
coils: dict[int, Any],
|
||||
entity_registry_enabled_by_default: None,
|
||||
snapshot: SnapshotAssertion,
|
||||
mock_connection: MockConnection,
|
||||
freezer_ticker: Any,
|
||||
@ -97,10 +97,10 @@ async def test_pushed_update(
|
||||
assert hass.states.get(entity_id) == snapshot(name="4. final values")
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_shutdown(
|
||||
hass: HomeAssistant,
|
||||
coils: dict[int, Any],
|
||||
entity_registry_enabled_by_default: None,
|
||||
mock_connection: MockConnection,
|
||||
freezer_ticker: Any,
|
||||
) -> None:
|
||||
|
@ -43,6 +43,7 @@ async def fixture_single_platform():
|
||||
(Model.F750, 47062, "number.hw_charge_offset_47062", None),
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_update(
|
||||
hass: HomeAssistant,
|
||||
model: Model,
|
||||
@ -50,7 +51,6 @@ async def test_update(
|
||||
address: int,
|
||||
value: Any,
|
||||
coils: dict[int, Any],
|
||||
entity_registry_enabled_by_default: None,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test setting of value."""
|
||||
@ -73,6 +73,7 @@ async def test_update(
|
||||
(Model.F750, 47062, "number.hw_charge_offset_47062", 10),
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_set_value(
|
||||
hass: HomeAssistant,
|
||||
mock_connection: AsyncMock,
|
||||
@ -81,7 +82,6 @@ async def test_set_value(
|
||||
address: int,
|
||||
value: Any,
|
||||
coils: dict[int, Any],
|
||||
entity_registry_enabled_by_default: None,
|
||||
) -> None:
|
||||
"""Test setting of value."""
|
||||
coils[address] = 0
|
||||
|
@ -3,6 +3,8 @@
|
||||
from datetime import timedelta
|
||||
import time
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.bluetooth import (
|
||||
FALLBACK_MAXIMUM_STALE_ADVERTISEMENT_SECONDS,
|
||||
async_address_present,
|
||||
@ -27,9 +29,8 @@ from tests.components.bluetooth import (
|
||||
)
|
||||
|
||||
|
||||
async def test_sensors(
|
||||
hass: HomeAssistant, entity_registry_enabled_by_default: None
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_sensors(hass: HomeAssistant) -> None:
|
||||
"""Test setting up creates the sensors."""
|
||||
start_monotonic = time.monotonic()
|
||||
entry = MockConfigEntry(
|
||||
@ -79,9 +80,8 @@ async def test_sensors(
|
||||
assert toothbrush_sensor.state == "running"
|
||||
|
||||
|
||||
async def test_sensors_io_series_4(
|
||||
hass: HomeAssistant, entity_registry_enabled_by_default: None
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_sensors_io_series_4(hass: HomeAssistant) -> None:
|
||||
"""Test setting up creates the sensors with an io series 4."""
|
||||
start_monotonic = time.monotonic()
|
||||
|
||||
|
@ -106,13 +106,13 @@ from tests.common import MockConfigEntry
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_sensor(
|
||||
hass: HomeAssistant,
|
||||
mock_config_entry_data: dict,
|
||||
mock_station_details: Station,
|
||||
mock_station_measurement: StationMeasurements,
|
||||
expected_states: dict,
|
||||
entity_registry_enabled_by_default: None,
|
||||
) -> None:
|
||||
"""Tests sensor entity."""
|
||||
entry = MockConfigEntry(
|
||||
|
@ -3,6 +3,7 @@
|
||||
from datetime import timedelta
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import pytest
|
||||
from tesla_powerwall import MetersAggregatesResponse
|
||||
from tesla_powerwall.error import MissingAttributeError
|
||||
|
||||
@ -25,11 +26,8 @@ from .mocks import MOCK_GATEWAY_DIN, _mock_powerwall_with_fixtures
|
||||
from tests.common import MockConfigEntry, async_fire_time_changed
|
||||
|
||||
|
||||
async def test_sensors(
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
entity_registry_enabled_by_default: None,
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_sensors(hass: HomeAssistant, device_registry: dr.DeviceRegistry) -> None:
|
||||
"""Test creation of the sensors."""
|
||||
|
||||
mock_powerwall = await _mock_powerwall_with_fixtures(hass)
|
||||
@ -245,11 +243,11 @@ async def test_sensors_with_empty_meters(hass: HomeAssistant) -> None:
|
||||
assert hass.states.get("sensor.mysite_solar_power") is None
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_unique_id_migrate(
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
entity_registry: er.EntityRegistry,
|
||||
entity_registry_enabled_by_default: None,
|
||||
) -> None:
|
||||
"""Test we can migrate unique ids of the sensors."""
|
||||
config_entry = MockConfigEntry(domain=DOMAIN, data={CONF_IP_ADDRESS: "1.2.3.4"})
|
||||
|
@ -3,6 +3,7 @@
|
||||
import time
|
||||
|
||||
from habluetooth.advertisement_tracker import ADVERTISING_TIMES_NEEDED
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.bluetooth.api import (
|
||||
async_get_fallback_availability_interval,
|
||||
@ -184,11 +185,8 @@ async def test_old_tracker_leave_home(
|
||||
assert state.state == "not_home"
|
||||
|
||||
|
||||
async def test_mac_rotation(
|
||||
hass: HomeAssistant,
|
||||
enable_bluetooth: None,
|
||||
entity_registry_enabled_by_default: None,
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("enable_bluetooth", "entity_registry_enabled_by_default")
|
||||
async def test_mac_rotation(hass: HomeAssistant) -> None:
|
||||
"""Test sensors get value when we receive a broadcast."""
|
||||
await async_mock_config_entry(hass)
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
"""Tests for sensors."""
|
||||
|
||||
from habluetooth.advertisement_tracker import ADVERTISING_TIMES_NEEDED
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.bluetooth import async_set_fallback_availability_interval
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -13,11 +14,8 @@ from . import (
|
||||
)
|
||||
|
||||
|
||||
async def test_sensor_unavailable(
|
||||
hass: HomeAssistant,
|
||||
enable_bluetooth: None,
|
||||
entity_registry_enabled_by_default: None,
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("enable_bluetooth", "entity_registry_enabled_by_default")
|
||||
async def test_sensor_unavailable(hass: HomeAssistant) -> None:
|
||||
"""Test sensors are unavailable."""
|
||||
await async_mock_config_entry(hass)
|
||||
|
||||
@ -26,11 +24,8 @@ async def test_sensor_unavailable(
|
||||
assert state.state == "unavailable"
|
||||
|
||||
|
||||
async def test_sensors_already_home(
|
||||
hass: HomeAssistant,
|
||||
enable_bluetooth: None,
|
||||
entity_registry_enabled_by_default: None,
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("enable_bluetooth", "entity_registry_enabled_by_default")
|
||||
async def test_sensors_already_home(hass: HomeAssistant) -> None:
|
||||
"""Test sensors get value when we start at home."""
|
||||
await async_inject_broadcast(hass, MAC_RPA_VALID_1)
|
||||
await async_mock_config_entry(hass)
|
||||
@ -40,11 +35,8 @@ async def test_sensors_already_home(
|
||||
assert state.state == "-63"
|
||||
|
||||
|
||||
async def test_sensors_come_home(
|
||||
hass: HomeAssistant,
|
||||
enable_bluetooth: None,
|
||||
entity_registry_enabled_by_default: None,
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("enable_bluetooth", "entity_registry_enabled_by_default")
|
||||
async def test_sensors_come_home(hass: HomeAssistant) -> None:
|
||||
"""Test sensors get value when we receive a broadcast."""
|
||||
await async_mock_config_entry(hass)
|
||||
await async_inject_broadcast(hass, MAC_RPA_VALID_1)
|
||||
@ -54,11 +46,8 @@ async def test_sensors_come_home(
|
||||
assert state.state == "-63"
|
||||
|
||||
|
||||
async def test_estimated_broadcast_interval(
|
||||
hass: HomeAssistant,
|
||||
enable_bluetooth: None,
|
||||
entity_registry_enabled_by_default: None,
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("enable_bluetooth", "entity_registry_enabled_by_default")
|
||||
async def test_estimated_broadcast_interval(hass: HomeAssistant) -> None:
|
||||
"""Test sensors get value when we receive a broadcast."""
|
||||
await async_mock_config_entry(hass)
|
||||
await async_inject_broadcast(hass, MAC_RPA_VALID_1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user