mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 09:17:53 +00:00
Replace ConfigEntry with MockConfigEntry in deCONZ tests (#122631)
This commit is contained in:
parent
e262f759af
commit
9b4cf873c1
@ -219,7 +219,7 @@ async def fixture_config_entry_factory(
|
||||
|
||||
@pytest.fixture(name="config_entry_setup")
|
||||
async def fixture_config_entry_setup(
|
||||
config_entry_factory: Callable[[], Coroutine[Any, Any, MockConfigEntry]],
|
||||
config_entry_factory: ConfigEntryFactoryType,
|
||||
) -> MockConfigEntry:
|
||||
"""Fixture providing a set up instance of deCONZ integration."""
|
||||
return await config_entry_factory()
|
||||
|
@ -14,14 +14,13 @@ from homeassistant.components.deconz.const import (
|
||||
DOMAIN as DECONZ_DOMAIN,
|
||||
)
|
||||
from homeassistant.components.deconz.services import SERVICE_DEVICE_REFRESH
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import STATE_OFF, STATE_ON, STATE_UNAVAILABLE, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from .conftest import ConfigEntryFactoryType, WebsocketDataType
|
||||
|
||||
from tests.common import snapshot_platform
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
|
||||
TEST_DATA = [
|
||||
( # Alarm binary sensor
|
||||
@ -409,7 +408,9 @@ async def test_not_allow_clip_sensor(hass: HomeAssistant) -> None:
|
||||
],
|
||||
)
|
||||
@pytest.mark.parametrize("config_entry_options", [{CONF_ALLOW_CLIP_SENSOR: True}])
|
||||
async def test_allow_clip_sensor(hass: HomeAssistant, config_entry_setup) -> None:
|
||||
async def test_allow_clip_sensor(
|
||||
hass: HomeAssistant, config_entry_setup: MockConfigEntry
|
||||
) -> None:
|
||||
"""Test that CLIP sensors can be allowed."""
|
||||
|
||||
assert len(hass.states.async_all()) == 3
|
||||
@ -470,7 +471,7 @@ async def test_add_new_binary_sensor(
|
||||
async def test_add_new_binary_sensor_ignored_load_entities_on_service_call(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
config_entry_setup: ConfigEntry,
|
||||
config_entry_setup: MockConfigEntry,
|
||||
deconz_payload: dict[str, Any],
|
||||
mock_requests: Callable[[str], None],
|
||||
sensor_ws_data: WebsocketDataType,
|
||||
@ -515,7 +516,7 @@ async def test_add_new_binary_sensor_ignored_load_entities_on_service_call(
|
||||
async def test_add_new_binary_sensor_ignored_load_entities_on_options_change(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
config_entry_setup: ConfigEntry,
|
||||
config_entry_setup: MockConfigEntry,
|
||||
deconz_payload: dict[str, Any],
|
||||
mock_requests: Callable[[str], None],
|
||||
sensor_ws_data: WebsocketDataType,
|
||||
|
@ -27,7 +27,6 @@ from homeassistant.config_entries import (
|
||||
SOURCE_REAUTH,
|
||||
SOURCE_SSDP,
|
||||
SOURCE_USER,
|
||||
ConfigEntry,
|
||||
)
|
||||
from homeassistant.const import CONF_API_KEY, CONF_HOST, CONF_PORT, CONTENT_TYPE_JSON
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -35,6 +34,7 @@ from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from .conftest import API_KEY, BRIDGE_ID
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
|
||||
BAD_BRIDGEID = "0000000000000000"
|
||||
@ -225,7 +225,7 @@ async def test_manual_configuration_after_discovery_ResponseError(
|
||||
async def test_manual_configuration_update_configuration(
|
||||
hass: HomeAssistant,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
config_entry_setup: ConfigEntry,
|
||||
config_entry_setup: MockConfigEntry,
|
||||
) -> None:
|
||||
"""Test that manual configuration can update existing config entry."""
|
||||
aioclient_mock.get(
|
||||
@ -404,7 +404,7 @@ async def test_link_step_fails(
|
||||
async def test_reauth_flow_update_configuration(
|
||||
hass: HomeAssistant,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
config_entry_setup: ConfigEntry,
|
||||
config_entry_setup: MockConfigEntry,
|
||||
) -> None:
|
||||
"""Verify reauth flow can update gateway API key."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
@ -484,7 +484,7 @@ async def test_flow_ssdp_discovery(
|
||||
|
||||
|
||||
async def test_ssdp_discovery_update_configuration(
|
||||
hass: HomeAssistant, config_entry_setup: ConfigEntry
|
||||
hass: HomeAssistant, config_entry_setup: MockConfigEntry
|
||||
) -> None:
|
||||
"""Test if a discovered bridge is configured but updates with new attributes."""
|
||||
with patch(
|
||||
@ -513,7 +513,7 @@ async def test_ssdp_discovery_update_configuration(
|
||||
|
||||
|
||||
async def test_ssdp_discovery_dont_update_configuration(
|
||||
hass: HomeAssistant, config_entry_setup: ConfigEntry
|
||||
hass: HomeAssistant, config_entry_setup: MockConfigEntry
|
||||
) -> None:
|
||||
"""Test if a discovered bridge has already been configured."""
|
||||
|
||||
@ -538,7 +538,7 @@ async def test_ssdp_discovery_dont_update_configuration(
|
||||
|
||||
@pytest.mark.parametrize("config_entry_source", [SOURCE_HASSIO])
|
||||
async def test_ssdp_discovery_dont_update_existing_hassio_configuration(
|
||||
hass: HomeAssistant, config_entry_setup: ConfigEntry
|
||||
hass: HomeAssistant, config_entry_setup: MockConfigEntry
|
||||
) -> None:
|
||||
"""Test to ensure the SSDP discovery does not update an Hass.io entry."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
@ -608,7 +608,7 @@ async def test_flow_hassio_discovery(hass: HomeAssistant) -> None:
|
||||
|
||||
async def test_hassio_discovery_update_configuration(
|
||||
hass: HomeAssistant,
|
||||
config_entry_setup: ConfigEntry,
|
||||
config_entry_setup: MockConfigEntry,
|
||||
) -> None:
|
||||
"""Test we can update an existing config entry."""
|
||||
with patch(
|
||||
@ -664,7 +664,7 @@ async def test_hassio_discovery_dont_update_configuration(hass: HomeAssistant) -
|
||||
|
||||
|
||||
async def test_option_flow(
|
||||
hass: HomeAssistant, config_entry_setup: ConfigEntry
|
||||
hass: HomeAssistant, config_entry_setup: MockConfigEntry
|
||||
) -> None:
|
||||
"""Test config flow options."""
|
||||
result = await hass.config_entries.options.async_init(config_entry_setup.entry_id)
|
||||
|
@ -17,7 +17,6 @@ from homeassistant.components.deconz.deconz_event import (
|
||||
CONF_DECONZ_RELATIVE_ROTARY_EVENT,
|
||||
RELATIVE_ROTARY_DECONZ_TO_EVENT,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
CONF_DEVICE_ID,
|
||||
CONF_EVENT,
|
||||
@ -30,7 +29,7 @@ from homeassistant.helpers import device_registry as dr
|
||||
|
||||
from .conftest import WebsocketDataType
|
||||
|
||||
from tests.common import async_capture_events
|
||||
from tests.common import MockConfigEntry, async_capture_events
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@ -78,7 +77,7 @@ from tests.common import async_capture_events
|
||||
async def test_deconz_events(
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
config_entry_setup: ConfigEntry,
|
||||
config_entry_setup: MockConfigEntry,
|
||||
sensor_ws_data: WebsocketDataType,
|
||||
) -> None:
|
||||
"""Test successful creation of deconz events."""
|
||||
@ -246,7 +245,7 @@ async def test_deconz_events(
|
||||
async def test_deconz_alarm_events(
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
config_entry_setup: ConfigEntry,
|
||||
config_entry_setup: MockConfigEntry,
|
||||
sensor_ws_data: WebsocketDataType,
|
||||
) -> None:
|
||||
"""Test successful creation of deconz alarm events."""
|
||||
@ -380,7 +379,7 @@ async def test_deconz_alarm_events(
|
||||
async def test_deconz_presence_events(
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
config_entry_setup: ConfigEntry,
|
||||
config_entry_setup: MockConfigEntry,
|
||||
sensor_ws_data: WebsocketDataType,
|
||||
) -> None:
|
||||
"""Test successful creation of deconz presence events."""
|
||||
@ -468,7 +467,7 @@ async def test_deconz_presence_events(
|
||||
async def test_deconz_relative_rotary_events(
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
config_entry_setup: ConfigEntry,
|
||||
config_entry_setup: MockConfigEntry,
|
||||
sensor_ws_data: WebsocketDataType,
|
||||
) -> None:
|
||||
"""Test successful creation of deconz relative rotary events."""
|
||||
@ -549,7 +548,7 @@ async def test_deconz_relative_rotary_events(
|
||||
async def test_deconz_events_bad_unique_id(
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
config_entry_setup: ConfigEntry,
|
||||
config_entry_setup: MockConfigEntry,
|
||||
) -> None:
|
||||
"""Verify no devices are created if unique id is bad or missing."""
|
||||
assert len(hass.states.async_all()) == 1
|
||||
|
@ -18,7 +18,6 @@ from homeassistant.components.deconz.const import DOMAIN as DECONZ_DOMAIN
|
||||
from homeassistant.components.deconz.device_trigger import CONF_SUBTYPE
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
ATTR_BATTERY_LEVEL,
|
||||
ATTR_ENTITY_ID,
|
||||
@ -35,7 +34,7 @@ from homeassistant.setup import async_setup_component
|
||||
|
||||
from .conftest import WebsocketDataType
|
||||
|
||||
from tests.common import async_get_device_automations
|
||||
from tests.common import MockConfigEntry, async_get_device_automations
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True, name="stub_blueprint_populate")
|
||||
@ -381,7 +380,7 @@ async def test_validate_trigger_unknown_device(hass: HomeAssistant) -> None:
|
||||
async def test_validate_trigger_unsupported_device(
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
config_entry_setup: ConfigEntry,
|
||||
config_entry_setup: MockConfigEntry,
|
||||
) -> None:
|
||||
"""Test unsupported device doesn't return a trigger config."""
|
||||
device = device_registry.async_get_or_create(
|
||||
@ -421,7 +420,7 @@ async def test_validate_trigger_unsupported_device(
|
||||
async def test_validate_trigger_unsupported_trigger(
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
config_entry_setup: ConfigEntry,
|
||||
config_entry_setup: MockConfigEntry,
|
||||
) -> None:
|
||||
"""Test unsupported trigger does not return a trigger config."""
|
||||
device = device_registry.async_get_or_create(
|
||||
@ -463,7 +462,7 @@ async def test_validate_trigger_unsupported_trigger(
|
||||
async def test_attach_trigger_no_matching_event(
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
config_entry_setup: ConfigEntry,
|
||||
config_entry_setup: MockConfigEntry,
|
||||
) -> None:
|
||||
"""Test no matching event for device doesn't return a trigger config."""
|
||||
device = device_registry.async_get_or_create(
|
||||
|
@ -3,11 +3,11 @@
|
||||
from pydeconz.websocket import State
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .conftest import WebsocketStateType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
@ -15,7 +15,7 @@ from tests.typing import ClientSessionGenerator
|
||||
async def test_entry_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
config_entry_setup: ConfigEntry,
|
||||
config_entry_setup: MockConfigEntry,
|
||||
mock_websocket_state: WebsocketStateType,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
|
@ -13,7 +13,6 @@ from homeassistant.components.fan import (
|
||||
SERVICE_TURN_OFF,
|
||||
SERVICE_TURN_ON,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
STATE_OFF,
|
||||
@ -24,7 +23,7 @@ from homeassistant.const import (
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from .conftest import WebsocketDataType
|
||||
from .conftest import ConfigEntryFactoryType, WebsocketDataType
|
||||
|
||||
from tests.common import snapshot_platform
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
@ -57,7 +56,7 @@ async def test_fans(
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
config_entry_factory: ConfigEntry,
|
||||
config_entry_factory: ConfigEntryFactoryType,
|
||||
mock_put_request: Callable[[str, str], AiohttpClientMocker],
|
||||
light_ws_data: WebsocketDataType,
|
||||
) -> None:
|
||||
|
@ -17,16 +17,18 @@ from homeassistant.components.ssdp import (
|
||||
ATTR_UPNP_SERIAL,
|
||||
ATTR_UPNP_UDN,
|
||||
)
|
||||
from homeassistant.config_entries import SOURCE_SSDP, ConfigEntry
|
||||
from homeassistant.config_entries import SOURCE_SSDP
|
||||
from homeassistant.const import STATE_OFF, STATE_UNAVAILABLE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
|
||||
from .conftest import BRIDGE_ID
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
async def test_device_registry_entry(
|
||||
config_entry_setup: ConfigEntry,
|
||||
config_entry_setup: MockConfigEntry,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
@ -68,7 +70,7 @@ async def test_connection_status_signalling(
|
||||
|
||||
|
||||
async def test_update_address(
|
||||
hass: HomeAssistant, config_entry_setup: ConfigEntry
|
||||
hass: HomeAssistant, config_entry_setup: MockConfigEntry
|
||||
) -> None:
|
||||
"""Make sure that connection status triggers a dispatcher send."""
|
||||
gateway = DeconzHub.get_hub(hass, config_entry_setup)
|
||||
@ -99,7 +101,7 @@ async def test_update_address(
|
||||
|
||||
|
||||
async def test_reset_after_successful_setup(
|
||||
hass: HomeAssistant, config_entry_setup: ConfigEntry
|
||||
hass: HomeAssistant, config_entry_setup: MockConfigEntry
|
||||
) -> None:
|
||||
"""Make sure that connection status triggers a dispatcher send."""
|
||||
gateway = DeconzHub.get_hub(hass, config_entry_setup)
|
||||
@ -110,7 +112,9 @@ async def test_reset_after_successful_setup(
|
||||
assert result is True
|
||||
|
||||
|
||||
async def test_get_deconz_api(hass: HomeAssistant, config_entry: ConfigEntry) -> None:
|
||||
async def test_get_deconz_api(
|
||||
hass: HomeAssistant, config_entry: MockConfigEntry
|
||||
) -> None:
|
||||
"""Successful call."""
|
||||
with patch("pydeconz.DeconzSession.refresh_state", return_value=True):
|
||||
assert await get_deconz_api(hass, config_entry)
|
||||
@ -127,7 +131,7 @@ async def test_get_deconz_api(hass: HomeAssistant, config_entry: ConfigEntry) ->
|
||||
)
|
||||
async def test_get_deconz_api_fails(
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
config_entry: MockConfigEntry,
|
||||
side_effect: Exception,
|
||||
raised_exception: Exception,
|
||||
) -> None:
|
||||
|
@ -10,7 +10,6 @@ from homeassistant.components.deconz import (
|
||||
)
|
||||
from homeassistant.components.deconz.const import DOMAIN as DECONZ_DOMAIN
|
||||
from homeassistant.components.deconz.errors import AuthenticationRequired, CannotConnect
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .conftest import ConfigEntryFactoryType
|
||||
@ -18,7 +17,7 @@ from .conftest import ConfigEntryFactoryType
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
async def setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||
async def setup_entry(hass: HomeAssistant, entry: MockConfigEntry) -> None:
|
||||
"""Test that setup entry works."""
|
||||
with (
|
||||
patch.object(DeconzHub, "async_setup", return_value=True),
|
||||
@ -28,7 +27,7 @@ async def setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||
|
||||
|
||||
async def test_setup_entry_successful(
|
||||
hass: HomeAssistant, config_entry_setup: ConfigEntry
|
||||
hass: HomeAssistant, config_entry_setup: MockConfigEntry
|
||||
) -> None:
|
||||
"""Test setup entry is successful."""
|
||||
assert hass.data[DECONZ_DOMAIN]
|
||||
@ -86,7 +85,7 @@ async def test_setup_entry_multiple_gateways(
|
||||
|
||||
|
||||
async def test_unload_entry(
|
||||
hass: HomeAssistant, config_entry_setup: ConfigEntry
|
||||
hass: HomeAssistant, config_entry_setup: MockConfigEntry
|
||||
) -> None:
|
||||
"""Test being able to unload an entry."""
|
||||
assert hass.data[DECONZ_DOMAIN]
|
||||
|
@ -27,7 +27,6 @@ from homeassistant.components.light import (
|
||||
ColorMode,
|
||||
LightEntityFeature,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
ATTR_SUPPORTED_FEATURES,
|
||||
@ -41,7 +40,7 @@ from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from .conftest import ConfigEntryFactoryType, WebsocketDataType
|
||||
|
||||
from tests.common import snapshot_platform
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
|
||||
|
||||
@ -491,7 +490,7 @@ async def test_light_state_change(
|
||||
async def test_light_service_calls(
|
||||
hass: HomeAssistant,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
config_entry_factory: Callable[[], ConfigEntry],
|
||||
config_entry_factory: ConfigEntryFactoryType,
|
||||
light_payload: dict[str, Any],
|
||||
mock_put_request: Callable[[str, str], AiohttpClientMocker],
|
||||
input: dict[str, Any],
|
||||
@ -730,7 +729,7 @@ async def test_configuration_tool(hass: HomeAssistant) -> None:
|
||||
async def test_groups(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
config_entry_factory: Callable[[], ConfigEntry],
|
||||
config_entry_factory: ConfigEntryFactoryType,
|
||||
group_payload: dict[str, Any],
|
||||
input: dict[str, list[str]],
|
||||
snapshot: SnapshotAssertion,
|
||||
@ -972,7 +971,7 @@ async def test_empty_group(hass: HomeAssistant) -> None:
|
||||
@pytest.mark.parametrize("config_entry_options", [{CONF_ALLOW_DECONZ_GROUPS: False}])
|
||||
async def test_disable_light_groups(
|
||||
hass: HomeAssistant,
|
||||
config_entry_setup: ConfigEntry,
|
||||
config_entry_setup: MockConfigEntry,
|
||||
) -> None:
|
||||
"""Test disallowing light groups work."""
|
||||
assert len(hass.states.async_all()) == 1
|
||||
|
@ -9,7 +9,6 @@ from homeassistant.components.lock import (
|
||||
SERVICE_LOCK,
|
||||
SERVICE_UNLOCK,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
STATE_LOCKED,
|
||||
@ -20,6 +19,7 @@ from homeassistant.core import HomeAssistant
|
||||
|
||||
from .conftest import WebsocketDataType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
)
|
||||
async def test_lock_from_light(
|
||||
hass: HomeAssistant,
|
||||
config_entry_setup: ConfigEntry,
|
||||
config_entry_setup: MockConfigEntry,
|
||||
mock_put_request: Callable[[str, str], AiohttpClientMocker],
|
||||
light_ws_data: WebsocketDataType,
|
||||
) -> None:
|
||||
@ -118,7 +118,7 @@ async def test_lock_from_light(
|
||||
)
|
||||
async def test_lock_from_sensor(
|
||||
hass: HomeAssistant,
|
||||
config_entry_setup: ConfigEntry,
|
||||
config_entry_setup: MockConfigEntry,
|
||||
mock_put_request: Callable[[str, str], AiohttpClientMocker],
|
||||
sensor_ws_data: WebsocketDataType,
|
||||
) -> None:
|
||||
|
@ -21,13 +21,12 @@ from homeassistant.components.deconz.services import (
|
||||
SERVICE_REMOVE_ORPHANED_ENTRIES,
|
||||
)
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
||||
from .test_hub import BRIDGE_ID
|
||||
|
||||
from tests.common import async_capture_events
|
||||
from tests.common import MockConfigEntry, async_capture_events
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
|
||||
|
||||
@ -329,7 +328,7 @@ async def test_remove_orphaned_entries_service(
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
entity_registry: er.EntityRegistry,
|
||||
config_entry_setup: ConfigEntry,
|
||||
config_entry_setup: MockConfigEntry,
|
||||
) -> None:
|
||||
"""Test service works and also don't remove more than expected."""
|
||||
device = device_registry.async_get_or_create(
|
||||
|
@ -5,7 +5,6 @@ from collections.abc import Callable
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.siren import ATTR_DURATION, DOMAIN as SIREN_DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
SERVICE_TURN_OFF,
|
||||
@ -18,6 +17,7 @@ from homeassistant.core import HomeAssistant
|
||||
|
||||
from .conftest import WebsocketDataType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
)
|
||||
async def test_sirens(
|
||||
hass: HomeAssistant,
|
||||
config_entry_setup: ConfigEntry,
|
||||
config_entry_setup: MockConfigEntry,
|
||||
light_ws_data: WebsocketDataType,
|
||||
mock_put_request: Callable[[str, str], AiohttpClientMocker],
|
||||
) -> None:
|
||||
|
@ -11,13 +11,13 @@ from homeassistant.components.switch import (
|
||||
SERVICE_TURN_OFF,
|
||||
SERVICE_TURN_ON,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON, STATE_UNAVAILABLE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from .conftest import ConfigEntryFactoryType, WebsocketDataType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
)
|
||||
async def test_power_plugs(
|
||||
hass: HomeAssistant,
|
||||
config_entry_setup: ConfigEntry,
|
||||
config_entry_setup: MockConfigEntry,
|
||||
mock_put_request: Callable[[str, str], AiohttpClientMocker],
|
||||
light_ws_data: WebsocketDataType,
|
||||
) -> None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user