mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 05:47:10 +00:00
Remove unnecessary DOMAIN alias in tests (a-d) (#145817)
This commit is contained in:
parent
9d0fc0d513
commit
7da8e24e21
@ -2,7 +2,7 @@
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.abode import DOMAIN as ABODE_DOMAIN
|
||||
from homeassistant.components.abode import DOMAIN
|
||||
from homeassistant.components.abode.const import CONF_POLLING
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -14,7 +14,7 @@ from tests.common import MockConfigEntry
|
||||
async def setup_platform(hass: HomeAssistant, platform: str) -> MockConfigEntry:
|
||||
"""Set up the Abode platform."""
|
||||
mock_entry = MockConfigEntry(
|
||||
domain=ABODE_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
data={
|
||||
CONF_USERNAME: "user@email.com",
|
||||
CONF_PASSWORD: "password",
|
||||
@ -27,7 +27,7 @@ async def setup_platform(hass: HomeAssistant, platform: str) -> MockConfigEntry:
|
||||
patch("homeassistant.components.abode.PLATFORMS", [platform]),
|
||||
patch("jaraco.abode.event_controller.sio"),
|
||||
):
|
||||
assert await async_setup_component(hass, ABODE_DOMAIN, {})
|
||||
assert await async_setup_component(hass, DOMAIN, {})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
return mock_entry
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.abode.const import DOMAIN as ABODE_DOMAIN
|
||||
from homeassistant.components.abode.const import DOMAIN
|
||||
from homeassistant.components.camera import DOMAIN as CAMERA_DOMAIN, CameraState
|
||||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -35,7 +35,7 @@ async def test_capture_image(hass: HomeAssistant) -> None:
|
||||
|
||||
with patch("jaraco.abode.devices.camera.Camera.capture") as mock_capture:
|
||||
await hass.services.async_call(
|
||||
ABODE_DOMAIN,
|
||||
DOMAIN,
|
||||
"capture_image",
|
||||
{ATTR_ENTITY_ID: "camera.test_cam"},
|
||||
blocking=True,
|
||||
|
@ -8,7 +8,7 @@ from jaraco.abode.exceptions import (
|
||||
Exception as AbodeException,
|
||||
)
|
||||
|
||||
from homeassistant.components.abode import DOMAIN as ABODE_DOMAIN, SERVICE_SETTINGS
|
||||
from homeassistant.components.abode import DOMAIN, SERVICE_SETTINGS
|
||||
from homeassistant.components.alarm_control_panel import DOMAIN as ALARM_DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import CONF_USERNAME
|
||||
@ -23,7 +23,7 @@ async def test_change_settings(hass: HomeAssistant) -> None:
|
||||
|
||||
with patch("jaraco.abode.client.Client.set_setting") as mock_set_setting:
|
||||
await hass.services.async_call(
|
||||
ABODE_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_SETTINGS,
|
||||
{"setting": "confirm_snd", "value": "loud"},
|
||||
blocking=True,
|
||||
|
@ -2,10 +2,7 @@
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.abode import (
|
||||
DOMAIN as ABODE_DOMAIN,
|
||||
SERVICE_TRIGGER_AUTOMATION,
|
||||
)
|
||||
from homeassistant.components.abode import DOMAIN, SERVICE_TRIGGER_AUTOMATION
|
||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
@ -119,7 +116,7 @@ async def test_trigger_automation(hass: HomeAssistant) -> None:
|
||||
|
||||
with patch("jaraco.abode.automation.Automation.trigger") as mock:
|
||||
await hass.services.async_call(
|
||||
ABODE_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_TRIGGER_AUTOMATION,
|
||||
{ATTR_ENTITY_ID: AUTOMATION_ID},
|
||||
blocking=True,
|
||||
|
@ -3,7 +3,7 @@
|
||||
from datetime import timedelta
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
from homeassistant.components.advantage_air.const import DOMAIN as ADVANTAGE_AIR_DOMAIN
|
||||
from homeassistant.components.advantage_air.const import DOMAIN
|
||||
from homeassistant.components.advantage_air.sensor import (
|
||||
ADVANTAGE_AIR_SERVICE_SET_TIME_TO,
|
||||
ADVANTAGE_AIR_SET_COUNTDOWN_VALUE,
|
||||
@ -41,7 +41,7 @@ async def test_sensor_platform(
|
||||
value = 20
|
||||
|
||||
await hass.services.async_call(
|
||||
ADVANTAGE_AIR_DOMAIN,
|
||||
DOMAIN,
|
||||
ADVANTAGE_AIR_SERVICE_SET_TIME_TO,
|
||||
{ATTR_ENTITY_ID: [entity_id], ADVANTAGE_AIR_SET_COUNTDOWN_VALUE: value},
|
||||
blocking=True,
|
||||
@ -61,7 +61,7 @@ async def test_sensor_platform(
|
||||
|
||||
value = 0
|
||||
await hass.services.async_call(
|
||||
ADVANTAGE_AIR_DOMAIN,
|
||||
DOMAIN,
|
||||
ADVANTAGE_AIR_SERVICE_SET_TIME_TO,
|
||||
{ATTR_ENTITY_ID: [entity_id], ADVANTAGE_AIR_SET_COUNTDOWN_VALUE: value},
|
||||
blocking=True,
|
||||
|
@ -6,7 +6,7 @@ from unittest.mock import MagicMock, patch
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
DOMAIN as ALARM_CONTROL_PANEL_DOMAIN,
|
||||
DOMAIN,
|
||||
AlarmControlPanelEntity,
|
||||
AlarmControlPanelEntityFeature,
|
||||
)
|
||||
@ -202,7 +202,7 @@ async def setup_alarm_control_panel_platform_test_entity(
|
||||
|
||||
mock_platform(
|
||||
hass,
|
||||
f"{TEST_DOMAIN}.{ALARM_CONTROL_PANEL_DOMAIN}",
|
||||
f"{TEST_DOMAIN}.{DOMAIN}",
|
||||
MockPlatform(async_setup_entry=async_setup_entry_platform),
|
||||
)
|
||||
|
||||
|
@ -6,7 +6,7 @@ import pytest
|
||||
|
||||
from homeassistant.components import alarm_control_panel
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
DOMAIN as ALARM_CONTROL_PANEL_DOMAIN,
|
||||
DOMAIN,
|
||||
AlarmControlPanelEntityFeature,
|
||||
CodeFormat,
|
||||
)
|
||||
@ -280,9 +280,7 @@ async def test_alarm_control_panel_log_deprecated_state_warning_using_state_prop
|
||||
),
|
||||
built_in=False,
|
||||
)
|
||||
setup_test_component_platform(
|
||||
hass, ALARM_CONTROL_PANEL_DOMAIN, [entity], from_config_entry=True
|
||||
)
|
||||
setup_test_component_platform(hass, DOMAIN, [entity], from_config_entry=True)
|
||||
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
|
||||
state = hass.states.get(entity.entity_id)
|
||||
@ -343,9 +341,7 @@ async def test_alarm_control_panel_log_deprecated_state_warning_using_attr_state
|
||||
),
|
||||
built_in=False,
|
||||
)
|
||||
setup_test_component_platform(
|
||||
hass, ALARM_CONTROL_PANEL_DOMAIN, [entity], from_config_entry=True
|
||||
)
|
||||
setup_test_component_platform(hass, DOMAIN, [entity], from_config_entry=True)
|
||||
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
|
||||
state = hass.states.get(entity.entity_id)
|
||||
@ -426,9 +422,7 @@ async def test_alarm_control_panel_deprecated_state_does_not_break_state(
|
||||
),
|
||||
built_in=False,
|
||||
)
|
||||
setup_test_component_platform(
|
||||
hass, ALARM_CONTROL_PANEL_DOMAIN, [entity], from_config_entry=True
|
||||
)
|
||||
setup_test_component_platform(hass, DOMAIN, [entity], from_config_entry=True)
|
||||
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
|
||||
state = hass.states.get(entity.entity_id)
|
||||
|
@ -7,7 +7,7 @@ import pytest
|
||||
|
||||
from homeassistant.components.assist_pipeline import PipelineEvent
|
||||
from homeassistant.components.assist_satellite import (
|
||||
DOMAIN as AS_DOMAIN,
|
||||
DOMAIN,
|
||||
AssistSatelliteAnnouncement,
|
||||
AssistSatelliteConfiguration,
|
||||
AssistSatelliteEntity,
|
||||
@ -168,7 +168,7 @@ async def init_components(
|
||||
),
|
||||
)
|
||||
setup_test_component_platform(
|
||||
hass, AS_DOMAIN, [entity, entity2, entity_no_features], from_config_entry=True
|
||||
hass, DOMAIN, [entity, entity2, entity_no_features], from_config_entry=True
|
||||
)
|
||||
mock_platform(hass, f"{TEST_DOMAIN}.config_flow", Mock())
|
||||
|
||||
|
@ -3,10 +3,7 @@
|
||||
from typing import Any
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.aussie_broadband.const import (
|
||||
CONF_SERVICES,
|
||||
DOMAIN as AUSSIE_BROADBAND_DOMAIN,
|
||||
)
|
||||
from homeassistant.components.aussie_broadband.const import CONF_SERVICES, DOMAIN
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.typing import UNDEFINED, UndefinedType
|
||||
@ -49,7 +46,7 @@ async def setup_platform(
|
||||
):
|
||||
"""Set up the Aussie Broadband platform."""
|
||||
mock_entry = MockConfigEntry(
|
||||
domain=AUSSIE_BROADBAND_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
data=FAKE_DATA,
|
||||
options={
|
||||
CONF_SERVICES: ["12345678", "87654321", "23456789", "98765432"],
|
||||
|
@ -12,7 +12,7 @@ from axis.rtsp import Signal, State
|
||||
import pytest
|
||||
import respx
|
||||
|
||||
from homeassistant.components.axis.const import DOMAIN as AXIS_DOMAIN
|
||||
from homeassistant.components.axis.const import DOMAIN
|
||||
from homeassistant.const import (
|
||||
CONF_HOST,
|
||||
CONF_MODEL,
|
||||
@ -91,7 +91,7 @@ def fixture_config_entry(
|
||||
) -> MockConfigEntry:
|
||||
"""Define a config entry fixture."""
|
||||
return MockConfigEntry(
|
||||
domain=AXIS_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
entry_id="676abe5b73621446e6550a2e86ffe3dd",
|
||||
unique_id=FORMATTED_MAC,
|
||||
data=config_entry_data,
|
||||
|
@ -12,7 +12,7 @@ from homeassistant.components.axis.const import (
|
||||
CONF_VIDEO_SOURCE,
|
||||
DEFAULT_STREAM_PROFILE,
|
||||
DEFAULT_VIDEO_SOURCE,
|
||||
DOMAIN as AXIS_DOMAIN,
|
||||
DOMAIN,
|
||||
)
|
||||
from homeassistant.config_entries import (
|
||||
SOURCE_DHCP,
|
||||
@ -47,7 +47,7 @@ DHCP_FORMATTED_MAC = dr.format_mac(MAC).replace(":", "")
|
||||
async def test_flow_manual_configuration(hass: HomeAssistant) -> None:
|
||||
"""Test that config flow works."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
AXIS_DOMAIN, context={"source": SOURCE_USER}
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
@ -86,7 +86,7 @@ async def test_manual_configuration_duplicate_fails(
|
||||
assert config_entry_setup.data[CONF_HOST] == "1.2.3.4"
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
AXIS_DOMAIN, context={"source": SOURCE_USER}
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
@ -122,7 +122,7 @@ async def test_flow_fails_on_api(
|
||||
) -> None:
|
||||
"""Test that config flow fails on faulty credentials."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
AXIS_DOMAIN, context={"source": SOURCE_USER}
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
@ -152,18 +152,18 @@ async def test_flow_create_entry_multiple_existing_entries_of_same_model(
|
||||
) -> None:
|
||||
"""Test that create entry can generate a name with other entries."""
|
||||
entry = MockConfigEntry(
|
||||
domain=AXIS_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
data={CONF_NAME: "M1065-LW 0", CONF_MODEL: "M1065-LW"},
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
entry2 = MockConfigEntry(
|
||||
domain=AXIS_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
data={CONF_NAME: "M1065-LW 1", CONF_MODEL: "M1065-LW"},
|
||||
)
|
||||
entry2.add_to_hass(hass)
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
AXIS_DOMAIN, context={"source": SOURCE_USER}
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
@ -337,7 +337,7 @@ async def test_discovery_flow(
|
||||
) -> None:
|
||||
"""Test the different discovery flows for new devices work."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
AXIS_DOMAIN, data=discovery_info, context={"source": source}
|
||||
DOMAIN, data=discovery_info, context={"source": source}
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
@ -420,7 +420,7 @@ async def test_discovered_device_already_configured(
|
||||
assert config_entry_setup.data[CONF_HOST] == DEFAULT_HOST
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
AXIS_DOMAIN, data=discovery_info, context={"source": source}
|
||||
DOMAIN, data=discovery_info, context={"source": source}
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
@ -488,7 +488,7 @@ async def test_discovery_flow_updated_configuration(
|
||||
|
||||
mock_requests("2.3.4.5")
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
AXIS_DOMAIN, data=discovery_info, context={"source": source}
|
||||
DOMAIN, data=discovery_info, context={"source": source}
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@ -546,7 +546,7 @@ async def test_discovery_flow_ignore_non_axis_device(
|
||||
) -> None:
|
||||
"""Test that discovery flow ignores devices with non Axis OUI."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
AXIS_DOMAIN, data=discovery_info, context={"source": source}
|
||||
DOMAIN, data=discovery_info, context={"source": source}
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
@ -595,7 +595,7 @@ async def test_discovery_flow_ignore_link_local_address(
|
||||
) -> None:
|
||||
"""Test that discovery flow ignores devices with link local addresses."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
AXIS_DOMAIN, data=discovery_info, context={"source": source}
|
||||
DOMAIN, data=discovery_info, context={"source": source}
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
|
@ -12,7 +12,7 @@ import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components import axis
|
||||
from homeassistant.components.axis.const import DOMAIN as AXIS_DOMAIN
|
||||
from homeassistant.components.axis.const import DOMAIN
|
||||
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_ZEROCONF, ConfigEntryState
|
||||
from homeassistant.const import STATE_OFF, STATE_ON, STATE_UNAVAILABLE
|
||||
@ -43,7 +43,7 @@ async def test_device_registry_entry(
|
||||
) -> None:
|
||||
"""Successful setup."""
|
||||
device_entry = device_registry.async_get_device(
|
||||
identifiers={(AXIS_DOMAIN, config_entry_setup.unique_id)}
|
||||
identifiers={(DOMAIN, config_entry_setup.unique_id)}
|
||||
)
|
||||
assert device_entry == snapshot
|
||||
|
||||
@ -93,7 +93,7 @@ async def test_update_address(
|
||||
|
||||
mock_requests("2.3.4.5")
|
||||
await hass.config_entries.flow.async_init(
|
||||
AXIS_DOMAIN,
|
||||
DOMAIN,
|
||||
data=ZeroconfServiceInfo(
|
||||
ip_address=ip_address("2.3.4.5"),
|
||||
ip_addresses=[ip_address("2.3.4.5")],
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from homeassistant.components.balboa.const import DOMAIN as BALBOA_DOMAIN
|
||||
from homeassistant.components.balboa.const import DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import CONF_HOST
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -24,7 +24,7 @@ async def test_setup_entry(
|
||||
async def test_setup_entry_fails(hass: HomeAssistant, client: MagicMock) -> None:
|
||||
"""Validate that setup entry also configure the client."""
|
||||
config_entry = MockConfigEntry(
|
||||
domain=BALBOA_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
data={
|
||||
CONF_HOST: TEST_HOST,
|
||||
},
|
||||
|
@ -9,7 +9,7 @@ import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
from syrupy.filters import props
|
||||
|
||||
from homeassistant.components.bluesound import DOMAIN as BLUESOUND_DOMAIN
|
||||
from homeassistant.components.bluesound import DOMAIN
|
||||
from homeassistant.components.bluesound.const import ATTR_MASTER
|
||||
from homeassistant.components.bluesound.media_player import (
|
||||
SERVICE_CLEAR_TIMER,
|
||||
@ -230,7 +230,7 @@ async def test_set_sleep_timer(
|
||||
) -> None:
|
||||
"""Test the set sleep timer action."""
|
||||
await hass.services.async_call(
|
||||
BLUESOUND_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_SET_TIMER,
|
||||
{ATTR_ENTITY_ID: "media_player.player_name1111"},
|
||||
blocking=True,
|
||||
@ -247,7 +247,7 @@ async def test_clear_sleep_timer(
|
||||
player_mocks.player_data.player.sleep_timer.side_effect = [15, 30, 45, 60, 90, 0]
|
||||
|
||||
await hass.services.async_call(
|
||||
BLUESOUND_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_CLEAR_TIMER,
|
||||
{ATTR_ENTITY_ID: "media_player.player_name1111"},
|
||||
blocking=True,
|
||||
@ -262,7 +262,7 @@ async def test_join_cannot_join_to_self(
|
||||
"""Test that joining to self is not allowed."""
|
||||
with pytest.raises(ServiceValidationError, match="Cannot join player to itself"):
|
||||
await hass.services.async_call(
|
||||
BLUESOUND_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_JOIN,
|
||||
{
|
||||
ATTR_ENTITY_ID: "media_player.player_name1111",
|
||||
@ -280,7 +280,7 @@ async def test_join(
|
||||
) -> None:
|
||||
"""Test the join action."""
|
||||
await hass.services.async_call(
|
||||
BLUESOUND_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_JOIN,
|
||||
{
|
||||
ATTR_ENTITY_ID: "media_player.player_name1111",
|
||||
@ -311,7 +311,7 @@ async def test_unjoin(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
await hass.services.async_call(
|
||||
BLUESOUND_DOMAIN,
|
||||
DOMAIN,
|
||||
"unjoin",
|
||||
{ATTR_ENTITY_ID: "media_player.player_name1111"},
|
||||
blocking=True,
|
||||
|
@ -13,7 +13,7 @@ from homeassistant.components.bmw_connected_drive.const import (
|
||||
CONF_GCID,
|
||||
CONF_READ_ONLY,
|
||||
CONF_REFRESH_TOKEN,
|
||||
DOMAIN as BMW_DOMAIN,
|
||||
DOMAIN,
|
||||
)
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_REGION, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -34,7 +34,7 @@ FIXTURE_GCID = "DUMMY"
|
||||
|
||||
FIXTURE_CONFIG_ENTRY = {
|
||||
"entry_id": "1",
|
||||
"domain": BMW_DOMAIN,
|
||||
"domain": DOMAIN,
|
||||
"title": FIXTURE_USER_INPUT[CONF_USERNAME],
|
||||
"data": {
|
||||
CONF_USERNAME: FIXTURE_USER_INPUT[CONF_USERNAME],
|
||||
|
@ -11,7 +11,7 @@ from bimmer_connected.models import (
|
||||
from freezegun.api import FrozenDateTimeFactory
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.bmw_connected_drive import DOMAIN as BMW_DOMAIN
|
||||
from homeassistant.components.bmw_connected_drive import DOMAIN
|
||||
from homeassistant.components.bmw_connected_drive.const import (
|
||||
CONF_REFRESH_TOKEN,
|
||||
SCAN_INTERVALS,
|
||||
@ -140,7 +140,7 @@ async def test_auth_failed_as_update_failed(
|
||||
|
||||
# Verify that no issues are raised and no reauth flow is initialized
|
||||
assert len(issue_registry.issues) == 0
|
||||
assert len(hass.config_entries.flow.async_progress_by_handler(BMW_DOMAIN)) == 0
|
||||
assert len(hass.config_entries.flow.async_progress_by_handler(DOMAIN)) == 0
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("bmw_fixture")
|
||||
@ -190,13 +190,13 @@ async def test_auth_failed_init_reauth(
|
||||
|
||||
reauth_issue = issue_registry.async_get_issue(
|
||||
HOMEASSISTANT_DOMAIN,
|
||||
f"config_entry_reauth_{BMW_DOMAIN}_{config_entry.entry_id}",
|
||||
f"config_entry_reauth_{DOMAIN}_{config_entry.entry_id}",
|
||||
)
|
||||
assert reauth_issue.active is True
|
||||
|
||||
# Check if reauth flow is initialized correctly
|
||||
flow = hass.config_entries.flow.async_get(reauth_issue.data["flow_id"])
|
||||
assert flow["handler"] == BMW_DOMAIN
|
||||
assert flow["handler"] == DOMAIN
|
||||
assert flow["context"]["source"] == "reauth"
|
||||
assert flow["context"]["unique_id"] == config_entry.unique_id
|
||||
|
||||
@ -233,12 +233,12 @@ async def test_captcha_reauth(
|
||||
|
||||
reauth_issue = issue_registry.async_get_issue(
|
||||
HOMEASSISTANT_DOMAIN,
|
||||
f"config_entry_reauth_{BMW_DOMAIN}_{config_entry.entry_id}",
|
||||
f"config_entry_reauth_{DOMAIN}_{config_entry.entry_id}",
|
||||
)
|
||||
assert reauth_issue.active is True
|
||||
|
||||
# Check if reauth flow is initialized correctly
|
||||
flow = hass.config_entries.flow.async_get(reauth_issue.data["flow_id"])
|
||||
assert flow["handler"] == BMW_DOMAIN
|
||||
assert flow["handler"] == DOMAIN
|
||||
assert flow["context"]["source"] == "reauth"
|
||||
assert flow["context"]["unique_id"] == config_entry.unique_id
|
||||
|
@ -6,10 +6,7 @@ from unittest.mock import patch
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.bmw_connected_drive import DEFAULT_OPTIONS
|
||||
from homeassistant.components.bmw_connected_drive.const import (
|
||||
CONF_READ_ONLY,
|
||||
DOMAIN as BMW_DOMAIN,
|
||||
)
|
||||
from homeassistant.components.bmw_connected_drive.const import CONF_READ_ONLY, DOMAIN
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
@ -82,7 +79,7 @@ async def test_migrate_options_from_data(hass: HomeAssistant) -> None:
|
||||
(
|
||||
{
|
||||
"domain": SENSOR_DOMAIN,
|
||||
"platform": BMW_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"unique_id": f"{VIN}-charging_level_hv",
|
||||
"suggested_object_id": f"{VEHICLE_NAME} charging_level_hv",
|
||||
"disabled_by": None,
|
||||
@ -93,7 +90,7 @@ async def test_migrate_options_from_data(hass: HomeAssistant) -> None:
|
||||
(
|
||||
{
|
||||
"domain": SENSOR_DOMAIN,
|
||||
"platform": BMW_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"unique_id": f"{VIN}-remaining_range_total",
|
||||
"suggested_object_id": f"{VEHICLE_NAME} remaining_range_total",
|
||||
"disabled_by": None,
|
||||
@ -104,7 +101,7 @@ async def test_migrate_options_from_data(hass: HomeAssistant) -> None:
|
||||
(
|
||||
{
|
||||
"domain": SENSOR_DOMAIN,
|
||||
"platform": BMW_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"unique_id": f"{VIN}-mileage",
|
||||
"suggested_object_id": f"{VEHICLE_NAME} mileage",
|
||||
"disabled_by": None,
|
||||
@ -115,7 +112,7 @@ async def test_migrate_options_from_data(hass: HomeAssistant) -> None:
|
||||
(
|
||||
{
|
||||
"domain": SENSOR_DOMAIN,
|
||||
"platform": BMW_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"unique_id": f"{VIN}-charging_status",
|
||||
"suggested_object_id": f"{VEHICLE_NAME} Charging Status",
|
||||
"disabled_by": None,
|
||||
@ -126,7 +123,7 @@ async def test_migrate_options_from_data(hass: HomeAssistant) -> None:
|
||||
(
|
||||
{
|
||||
"domain": BINARY_SENSOR_DOMAIN,
|
||||
"platform": BMW_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"unique_id": f"{VIN}-charging_status",
|
||||
"suggested_object_id": f"{VEHICLE_NAME} Charging Status",
|
||||
"disabled_by": None,
|
||||
@ -173,7 +170,7 @@ async def test_migrate_unique_ids(
|
||||
(
|
||||
{
|
||||
"domain": SENSOR_DOMAIN,
|
||||
"platform": BMW_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"unique_id": f"{VIN}-charging_level_hv",
|
||||
"suggested_object_id": f"{VEHICLE_NAME} charging_level_hv",
|
||||
"disabled_by": None,
|
||||
@ -198,7 +195,7 @@ async def test_dont_migrate_unique_ids(
|
||||
# create existing entry with new_unique_id
|
||||
existing_entity = entity_registry.async_get_or_create(
|
||||
SENSOR_DOMAIN,
|
||||
BMW_DOMAIN,
|
||||
DOMAIN,
|
||||
unique_id=f"{VIN}-fuel_and_battery.remaining_battery_percent",
|
||||
suggested_object_id=f"{VEHICLE_NAME} fuel_and_battery.remaining_battery_percent",
|
||||
config_entry=mock_config_entry,
|
||||
@ -241,7 +238,7 @@ async def test_remove_stale_devices(
|
||||
|
||||
device_registry.async_get_or_create(
|
||||
config_entry_id=mock_config_entry.entry_id,
|
||||
identifiers={(BMW_DOMAIN, "stale_device_id")},
|
||||
identifiers={(DOMAIN, "stale_device_id")},
|
||||
)
|
||||
device_entries = dr.async_entries_for_config_entry(
|
||||
device_registry, mock_config_entry.entry_id
|
||||
@ -249,7 +246,7 @@ async def test_remove_stale_devices(
|
||||
|
||||
assert len(device_entries) == 1
|
||||
device_entry = device_entries[0]
|
||||
assert device_entry.identifiers == {(BMW_DOMAIN, "stale_device_id")}
|
||||
assert device_entry.identifiers == {(DOMAIN, "stale_device_id")}
|
||||
|
||||
assert await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
@ -261,6 +258,4 @@ async def test_remove_stale_devices(
|
||||
# Check that the test vehicles are still available but not the stale device
|
||||
assert len(device_entries) > 0
|
||||
remaining_device_identifiers = set().union(*(d.identifiers for d in device_entries))
|
||||
assert not {(BMW_DOMAIN, "stale_device_id")}.intersection(
|
||||
remaining_device_identifiers
|
||||
)
|
||||
assert not {(DOMAIN, "stale_device_id")}.intersection(remaining_device_identifiers)
|
||||
|
@ -8,7 +8,7 @@ import pytest
|
||||
import respx
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.bmw_connected_drive import DOMAIN as BMW_DOMAIN
|
||||
from homeassistant.components.bmw_connected_drive import DOMAIN
|
||||
from homeassistant.components.bmw_connected_drive.select import SELECT_TYPES
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -182,9 +182,9 @@ async def test_entity_option_translations(
|
||||
# Setup component to load translations
|
||||
assert await setup_mocked_integration(hass)
|
||||
|
||||
prefix = f"component.{BMW_DOMAIN}.entity.{Platform.SELECT.value}"
|
||||
prefix = f"component.{DOMAIN}.entity.{Platform.SELECT.value}"
|
||||
|
||||
translations = await async_get_translations(hass, "en", "entity", [BMW_DOMAIN])
|
||||
translations = await async_get_translations(hass, "en", "entity", [DOMAIN])
|
||||
translation_states = {
|
||||
k for k in translations if k.startswith(prefix) and ".state." in k
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ from freezegun.api import FrozenDateTimeFactory
|
||||
import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.bmw_connected_drive import DOMAIN as BMW_DOMAIN
|
||||
from homeassistant.components.bmw_connected_drive import DOMAIN
|
||||
from homeassistant.components.bmw_connected_drive.const import SCAN_INTERVALS
|
||||
from homeassistant.components.bmw_connected_drive.sensor import SENSOR_TYPES
|
||||
from homeassistant.components.sensor import SensorDeviceClass
|
||||
@ -96,9 +96,9 @@ async def test_entity_option_translations(
|
||||
# Setup component to load translations
|
||||
assert await setup_mocked_integration(hass)
|
||||
|
||||
prefix = f"component.{BMW_DOMAIN}.entity.{Platform.SENSOR.value}"
|
||||
prefix = f"component.{DOMAIN}.entity.{Platform.SENSOR.value}"
|
||||
|
||||
translations = await async_get_translations(hass, "en", "entity", [BMW_DOMAIN])
|
||||
translations = await async_get_translations(hass, "en", "entity", [DOMAIN])
|
||||
translation_states = {
|
||||
k for k in translations if k.startswith(prefix) and ".state." in k
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ from aiohttp.client_exceptions import ClientResponseError
|
||||
from bond_async import DeviceType
|
||||
|
||||
from homeassistant import core
|
||||
from homeassistant.components.bond.const import DOMAIN as BOND_DOMAIN
|
||||
from homeassistant.components.bond.const import DOMAIN
|
||||
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_HOST, STATE_UNAVAILABLE
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util import utcnow
|
||||
@ -77,7 +77,7 @@ async def setup_platform(
|
||||
):
|
||||
"""Set up the specified Bond platform."""
|
||||
mock_entry = MockConfigEntry(
|
||||
domain=BOND_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
data={CONF_HOST: "some host", CONF_ACCESS_TOKEN: "test-token"},
|
||||
)
|
||||
mock_entry.add_to_hass(hass)
|
||||
@ -93,7 +93,7 @@ async def setup_platform(
|
||||
patch_bond_device_properties(return_value=props),
|
||||
patch_bond_device_state(return_value=state),
|
||||
):
|
||||
assert await async_setup_component(hass, BOND_DOMAIN, {})
|
||||
assert await async_setup_component(hass, DOMAIN, {})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
return mock_entry
|
||||
|
@ -11,7 +11,7 @@ import pytest
|
||||
from homeassistant import core
|
||||
from homeassistant.components import fan
|
||||
from homeassistant.components.bond.const import (
|
||||
DOMAIN as BOND_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_SET_FAN_SPEED_TRACKED_STATE,
|
||||
)
|
||||
from homeassistant.components.bond.fan import PRESET_MODE_BREEZE
|
||||
@ -367,7 +367,7 @@ async def test_set_speed_belief_speed_zero(hass: HomeAssistant) -> None:
|
||||
|
||||
with patch_bond_action() as mock_action, patch_bond_device_state():
|
||||
await hass.services.async_call(
|
||||
BOND_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_SET_FAN_SPEED_TRACKED_STATE,
|
||||
{ATTR_ENTITY_ID: "fan.name_1", "speed": 0},
|
||||
blocking=True,
|
||||
@ -391,7 +391,7 @@ async def test_set_speed_belief_speed_api_error(hass: HomeAssistant) -> None:
|
||||
patch_bond_device_state(),
|
||||
):
|
||||
await hass.services.async_call(
|
||||
BOND_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_SET_FAN_SPEED_TRACKED_STATE,
|
||||
{ATTR_ENTITY_ID: "fan.name_1", "speed": 100},
|
||||
blocking=True,
|
||||
@ -406,7 +406,7 @@ async def test_set_speed_belief_speed_100(hass: HomeAssistant) -> None:
|
||||
|
||||
with patch_bond_action() as mock_action, patch_bond_device_state():
|
||||
await hass.services.async_call(
|
||||
BOND_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_SET_FAN_SPEED_TRACKED_STATE,
|
||||
{ATTR_ENTITY_ID: "fan.name_1", "speed": 100},
|
||||
blocking=True,
|
||||
|
@ -7,7 +7,7 @@ import pytest
|
||||
|
||||
from homeassistant.components.bond.const import (
|
||||
ATTR_POWER_STATE,
|
||||
DOMAIN as BOND_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_SET_POWER_TRACKED_STATE,
|
||||
)
|
||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
|
||||
@ -94,7 +94,7 @@ async def test_switch_set_power_belief(hass: HomeAssistant) -> None:
|
||||
|
||||
with patch_bond_action() as mock_bond_action, patch_bond_device_state():
|
||||
await hass.services.async_call(
|
||||
BOND_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_SET_POWER_TRACKED_STATE,
|
||||
{ATTR_ENTITY_ID: "switch.name_1", ATTR_POWER_STATE: False},
|
||||
blocking=True,
|
||||
@ -118,7 +118,7 @@ async def test_switch_set_power_belief_api_error(hass: HomeAssistant) -> None:
|
||||
patch_bond_device_state(),
|
||||
):
|
||||
await hass.services.async_call(
|
||||
BOND_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_SET_POWER_TRACKED_STATE,
|
||||
{ATTR_ENTITY_ID: "switch.name_1", ATTR_POWER_STATE: False},
|
||||
blocking=True,
|
||||
|
@ -4,11 +4,7 @@ from copy import deepcopy
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.comelit.const import (
|
||||
BRIDGE,
|
||||
DOMAIN as COMELIT_DOMAIN,
|
||||
VEDO,
|
||||
)
|
||||
from homeassistant.components.comelit.const import BRIDGE, DOMAIN, VEDO
|
||||
from homeassistant.const import CONF_HOST, CONF_PIN, CONF_PORT, CONF_TYPE
|
||||
|
||||
from .const import (
|
||||
@ -60,7 +56,7 @@ def mock_serial_bridge() -> Generator[AsyncMock]:
|
||||
def mock_serial_bridge_config_entry() -> MockConfigEntry:
|
||||
"""Mock a Comelit config entry for Comelit bridge."""
|
||||
return MockConfigEntry(
|
||||
domain=COMELIT_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
data={
|
||||
CONF_HOST: BRIDGE_HOST,
|
||||
CONF_PORT: BRIDGE_PORT,
|
||||
@ -97,7 +93,7 @@ def mock_vedo() -> Generator[AsyncMock]:
|
||||
def mock_vedo_config_entry() -> MockConfigEntry:
|
||||
"""Mock a Comelit config entry for Comelit vedo."""
|
||||
return MockConfigEntry(
|
||||
domain=COMELIT_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
data={
|
||||
CONF_HOST: VEDO_HOST,
|
||||
CONF_PORT: VEDO_PORT,
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.cups import CONF_PRINTERS, DOMAIN as CUPS_DOMAIN
|
||||
from homeassistant.components.cups import CONF_PRINTERS, DOMAIN
|
||||
from homeassistant.components.sensor.const import DOMAIN as SENSOR_DOMAIN
|
||||
from homeassistant.const import CONF_PLATFORM
|
||||
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
|
||||
@ -25,7 +25,7 @@ async def test_repair_issue_is_created(
|
||||
{
|
||||
SENSOR_DOMAIN: [
|
||||
{
|
||||
CONF_PLATFORM: CUPS_DOMAIN,
|
||||
CONF_PLATFORM: DOMAIN,
|
||||
CONF_PRINTERS: [
|
||||
"printer1",
|
||||
],
|
||||
@ -36,5 +36,5 @@ async def test_repair_issue_is_created(
|
||||
await hass.async_block_till_done()
|
||||
assert (
|
||||
HOMEASSISTANT_DOMAIN,
|
||||
f"deprecated_system_packages_yaml_integration_{CUPS_DOMAIN}",
|
||||
f"deprecated_system_packages_yaml_integration_{DOMAIN}",
|
||||
) in issue_registry.issues
|
||||
|
@ -10,7 +10,7 @@ from unittest.mock import patch
|
||||
from pydeconz.websocket import Signal
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.deconz.const import DOMAIN as DECONZ_DOMAIN
|
||||
from homeassistant.components.deconz.const import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.const import CONF_API_KEY, CONF_HOST, CONF_PORT, CONTENT_TYPE_JSON
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -53,7 +53,7 @@ def fixture_config_entry(
|
||||
) -> MockConfigEntry:
|
||||
"""Define a config entry fixture."""
|
||||
return MockConfigEntry(
|
||||
domain=DECONZ_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
entry_id="1",
|
||||
unique_id=BRIDGE_ID,
|
||||
data=config_entry_data,
|
||||
|
@ -11,7 +11,7 @@ from homeassistant.components.deconz.const import (
|
||||
CONF_ALLOW_CLIP_SENSOR,
|
||||
CONF_ALLOW_NEW_DEVICES,
|
||||
CONF_MASTER_GATEWAY,
|
||||
DOMAIN as DECONZ_DOMAIN,
|
||||
DOMAIN,
|
||||
)
|
||||
from homeassistant.components.deconz.services import SERVICE_DEVICE_REFRESH
|
||||
from homeassistant.const import STATE_OFF, STATE_ON, Platform
|
||||
@ -492,7 +492,7 @@ async def test_add_new_binary_sensor_ignored_load_entities_on_service_call(
|
||||
deconz_payload["sensors"]["0"] = sensor
|
||||
mock_requests()
|
||||
|
||||
await hass.services.async_call(DECONZ_DOMAIN, SERVICE_DEVICE_REFRESH)
|
||||
await hass.services.async_call(DOMAIN, SERVICE_DEVICE_REFRESH)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert len(hass.states.async_all()) == 1
|
||||
|
@ -16,7 +16,7 @@ from homeassistant.components.deconz.const import (
|
||||
CONF_ALLOW_DECONZ_GROUPS,
|
||||
CONF_ALLOW_NEW_DEVICES,
|
||||
CONF_MASTER_GATEWAY,
|
||||
DOMAIN as DECONZ_DOMAIN,
|
||||
DOMAIN,
|
||||
HASSIO_CONFIGURATION_URL,
|
||||
)
|
||||
from homeassistant.config_entries import SOURCE_HASSIO, SOURCE_SSDP, SOURCE_USER
|
||||
@ -53,7 +53,7 @@ async def test_flow_discovered_bridges(
|
||||
)
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DECONZ_DOMAIN, context={"source": SOURCE_USER}
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
@ -96,7 +96,7 @@ async def test_flow_manual_configuration_decision(
|
||||
)
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DECONZ_DOMAIN, context={"source": SOURCE_USER}
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -151,7 +151,7 @@ async def test_flow_manual_configuration(
|
||||
)
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DECONZ_DOMAIN, context={"source": SOURCE_USER}
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
@ -197,7 +197,7 @@ async def test_manual_configuration_after_discovery_timeout(
|
||||
aioclient_mock.get(pydeconz.utils.URL_DISCOVER, exc=TimeoutError)
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DECONZ_DOMAIN, context={"source": SOURCE_USER}
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
@ -212,7 +212,7 @@ async def test_manual_configuration_after_discovery_ResponseError(
|
||||
aioclient_mock.get(pydeconz.utils.URL_DISCOVER, exc=pydeconz.errors.ResponseError)
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DECONZ_DOMAIN, context={"source": SOURCE_USER}
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
@ -233,7 +233,7 @@ async def test_manual_configuration_update_configuration(
|
||||
)
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DECONZ_DOMAIN, context={"source": SOURCE_USER}
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
@ -280,7 +280,7 @@ async def test_manual_configuration_dont_update_configuration(
|
||||
)
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DECONZ_DOMAIN, context={"source": SOURCE_USER}
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
@ -325,7 +325,7 @@ async def test_manual_configuration_timeout_get_bridge(
|
||||
)
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DECONZ_DOMAIN, context={"source": SOURCE_USER}
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
@ -378,7 +378,7 @@ async def test_link_step_fails(
|
||||
)
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DECONZ_DOMAIN, context={"source": SOURCE_USER}
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -437,7 +437,7 @@ async def test_flow_ssdp_discovery(
|
||||
) -> None:
|
||||
"""Test that config flow for one discovered bridge works."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DECONZ_DOMAIN,
|
||||
DOMAIN,
|
||||
data=SsdpServiceInfo(
|
||||
ssdp_usn="mock_usn",
|
||||
ssdp_st="mock_st",
|
||||
@ -485,7 +485,7 @@ async def test_ssdp_discovery_update_configuration(
|
||||
return_value=True,
|
||||
) as mock_setup_entry:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DECONZ_DOMAIN,
|
||||
DOMAIN,
|
||||
data=SsdpServiceInfo(
|
||||
ssdp_usn="mock_usn",
|
||||
ssdp_st="mock_st",
|
||||
@ -511,7 +511,7 @@ async def test_ssdp_discovery_dont_update_configuration(
|
||||
"""Test if a discovered bridge has already been configured."""
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DECONZ_DOMAIN,
|
||||
DOMAIN,
|
||||
data=SsdpServiceInfo(
|
||||
ssdp_usn="mock_usn",
|
||||
ssdp_st="mock_st",
|
||||
@ -535,7 +535,7 @@ async def test_ssdp_discovery_dont_update_existing_hassio_configuration(
|
||||
) -> None:
|
||||
"""Test to ensure the SSDP discovery does not update an Hass.io entry."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DECONZ_DOMAIN,
|
||||
DOMAIN,
|
||||
data=SsdpServiceInfo(
|
||||
ssdp_usn="mock_usn",
|
||||
ssdp_st="mock_st",
|
||||
@ -556,7 +556,7 @@ async def test_ssdp_discovery_dont_update_existing_hassio_configuration(
|
||||
async def test_flow_hassio_discovery(hass: HomeAssistant) -> None:
|
||||
"""Test hassio discovery flow works."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DECONZ_DOMAIN,
|
||||
DOMAIN,
|
||||
data=HassioServiceInfo(
|
||||
config={
|
||||
"addon": "Mock Addon",
|
||||
@ -609,7 +609,7 @@ async def test_hassio_discovery_update_configuration(
|
||||
return_value=True,
|
||||
) as mock_setup_entry:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DECONZ_DOMAIN,
|
||||
DOMAIN,
|
||||
data=HassioServiceInfo(
|
||||
config={
|
||||
CONF_HOST: "2.3.4.5",
|
||||
@ -637,7 +637,7 @@ async def test_hassio_discovery_update_configuration(
|
||||
async def test_hassio_discovery_dont_update_configuration(hass: HomeAssistant) -> None:
|
||||
"""Test we can update an existing config entry."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DECONZ_DOMAIN,
|
||||
DOMAIN,
|
||||
data=HassioServiceInfo(
|
||||
config={
|
||||
CONF_HOST: "1.2.3.4",
|
||||
|
@ -7,7 +7,7 @@ from pydeconz.models.sensor.ancillary_control import (
|
||||
from pydeconz.models.sensor.presence import PresenceStatePresenceEvent
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.deconz.const import DOMAIN as DECONZ_DOMAIN
|
||||
from homeassistant.components.deconz.const import DOMAIN
|
||||
from homeassistant.components.deconz.deconz_event import (
|
||||
ATTR_DURATION,
|
||||
ATTR_ROTATION,
|
||||
@ -94,7 +94,7 @@ async def test_deconz_events(
|
||||
await sensor_ws_data({"id": "1", "state": {"buttonevent": 2000}})
|
||||
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DECONZ_DOMAIN, "00:00:00:00:00:00:00:01")}
|
||||
identifiers={(DOMAIN, "00:00:00:00:00:00:00:01")}
|
||||
)
|
||||
|
||||
assert len(captured_events) == 1
|
||||
@ -108,7 +108,7 @@ async def test_deconz_events(
|
||||
await sensor_ws_data({"id": "3", "state": {"buttonevent": 2000}})
|
||||
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DECONZ_DOMAIN, "00:00:00:00:00:00:00:03")}
|
||||
identifiers={(DOMAIN, "00:00:00:00:00:00:00:03")}
|
||||
)
|
||||
|
||||
assert len(captured_events) == 2
|
||||
@ -123,7 +123,7 @@ async def test_deconz_events(
|
||||
await sensor_ws_data({"id": "4", "state": {"gesture": 0}})
|
||||
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DECONZ_DOMAIN, "00:00:00:00:00:00:00:04")}
|
||||
identifiers={(DOMAIN, "00:00:00:00:00:00:00:04")}
|
||||
)
|
||||
|
||||
assert len(captured_events) == 3
|
||||
@ -142,7 +142,7 @@ async def test_deconz_events(
|
||||
await sensor_ws_data(event_changed_sensor)
|
||||
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DECONZ_DOMAIN, "00:00:00:00:00:00:00:05")}
|
||||
identifiers={(DOMAIN, "00:00:00:00:00:00:00:05")}
|
||||
)
|
||||
|
||||
assert len(captured_events) == 4
|
||||
@ -250,7 +250,7 @@ async def test_deconz_alarm_events(
|
||||
await sensor_ws_data({"state": {"action": AncillaryControlAction.EMERGENCY}})
|
||||
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DECONZ_DOMAIN, "00:00:00:00:00:00:00:01")}
|
||||
identifiers={(DOMAIN, "00:00:00:00:00:00:00:01")}
|
||||
)
|
||||
|
||||
assert len(captured_events) == 1
|
||||
@ -266,7 +266,7 @@ async def test_deconz_alarm_events(
|
||||
await sensor_ws_data({"state": {"action": AncillaryControlAction.FIRE}})
|
||||
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DECONZ_DOMAIN, "00:00:00:00:00:00:00:01")}
|
||||
identifiers={(DOMAIN, "00:00:00:00:00:00:00:01")}
|
||||
)
|
||||
|
||||
assert len(captured_events) == 2
|
||||
@ -282,7 +282,7 @@ async def test_deconz_alarm_events(
|
||||
await sensor_ws_data({"state": {"action": AncillaryControlAction.INVALID_CODE}})
|
||||
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DECONZ_DOMAIN, "00:00:00:00:00:00:00:01")}
|
||||
identifiers={(DOMAIN, "00:00:00:00:00:00:00:01")}
|
||||
)
|
||||
|
||||
assert len(captured_events) == 3
|
||||
@ -298,7 +298,7 @@ async def test_deconz_alarm_events(
|
||||
await sensor_ws_data({"state": {"action": AncillaryControlAction.PANIC}})
|
||||
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DECONZ_DOMAIN, "00:00:00:00:00:00:00:01")}
|
||||
identifiers={(DOMAIN, "00:00:00:00:00:00:00:01")}
|
||||
)
|
||||
|
||||
assert len(captured_events) == 4
|
||||
@ -366,7 +366,7 @@ async def test_deconz_presence_events(
|
||||
)
|
||||
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DECONZ_DOMAIN, "xx:xx:xx:xx:xx:xx:xx:xx")}
|
||||
identifiers={(DOMAIN, "xx:xx:xx:xx:xx:xx:xx:xx")}
|
||||
)
|
||||
|
||||
captured_events = async_capture_events(hass, CONF_DECONZ_PRESENCE_EVENT)
|
||||
@ -443,7 +443,7 @@ async def test_deconz_relative_rotary_events(
|
||||
)
|
||||
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DECONZ_DOMAIN, "xx:xx:xx:xx:xx:xx:xx:xx")}
|
||||
identifiers={(DOMAIN, "xx:xx:xx:xx:xx:xx:xx:xx")}
|
||||
)
|
||||
|
||||
captured_events = async_capture_events(hass, CONF_DECONZ_RELATIVE_ROTARY_EVENT)
|
||||
|
@ -16,7 +16,7 @@ from homeassistant.components.binary_sensor.device_trigger import (
|
||||
CONF_TAMPERED,
|
||||
)
|
||||
from homeassistant.components.deconz import device_trigger
|
||||
from homeassistant.components.deconz.const import DOMAIN as DECONZ_DOMAIN
|
||||
from homeassistant.components.deconz.const import 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
|
||||
@ -76,7 +76,7 @@ async def test_get_triggers(
|
||||
) -> None:
|
||||
"""Test triggers work."""
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DECONZ_DOMAIN, "d0:cf:5e:ff:fe:71:a4:3a")}
|
||||
identifiers={(DOMAIN, "d0:cf:5e:ff:fe:71:a4:3a")}
|
||||
)
|
||||
battery_sensor_entry = entity_registry.async_get(
|
||||
"sensor.tradfri_on_off_switch_battery"
|
||||
@ -89,7 +89,7 @@ async def test_get_triggers(
|
||||
expected_triggers = [
|
||||
{
|
||||
CONF_DEVICE_ID: device.id,
|
||||
CONF_DOMAIN: DECONZ_DOMAIN,
|
||||
CONF_DOMAIN: DOMAIN,
|
||||
CONF_PLATFORM: "device",
|
||||
CONF_TYPE: device_trigger.CONF_SHORT_PRESS,
|
||||
CONF_SUBTYPE: device_trigger.CONF_TURN_ON,
|
||||
@ -97,7 +97,7 @@ async def test_get_triggers(
|
||||
},
|
||||
{
|
||||
CONF_DEVICE_ID: device.id,
|
||||
CONF_DOMAIN: DECONZ_DOMAIN,
|
||||
CONF_DOMAIN: DOMAIN,
|
||||
CONF_PLATFORM: "device",
|
||||
CONF_TYPE: device_trigger.CONF_LONG_PRESS,
|
||||
CONF_SUBTYPE: device_trigger.CONF_TURN_ON,
|
||||
@ -105,7 +105,7 @@ async def test_get_triggers(
|
||||
},
|
||||
{
|
||||
CONF_DEVICE_ID: device.id,
|
||||
CONF_DOMAIN: DECONZ_DOMAIN,
|
||||
CONF_DOMAIN: DOMAIN,
|
||||
CONF_PLATFORM: "device",
|
||||
CONF_TYPE: device_trigger.CONF_LONG_RELEASE,
|
||||
CONF_SUBTYPE: device_trigger.CONF_TURN_ON,
|
||||
@ -113,7 +113,7 @@ async def test_get_triggers(
|
||||
},
|
||||
{
|
||||
CONF_DEVICE_ID: device.id,
|
||||
CONF_DOMAIN: DECONZ_DOMAIN,
|
||||
CONF_DOMAIN: DOMAIN,
|
||||
CONF_PLATFORM: "device",
|
||||
CONF_TYPE: device_trigger.CONF_SHORT_PRESS,
|
||||
CONF_SUBTYPE: device_trigger.CONF_TURN_OFF,
|
||||
@ -121,7 +121,7 @@ async def test_get_triggers(
|
||||
},
|
||||
{
|
||||
CONF_DEVICE_ID: device.id,
|
||||
CONF_DOMAIN: DECONZ_DOMAIN,
|
||||
CONF_DOMAIN: DOMAIN,
|
||||
CONF_PLATFORM: "device",
|
||||
CONF_TYPE: device_trigger.CONF_LONG_PRESS,
|
||||
CONF_SUBTYPE: device_trigger.CONF_TURN_OFF,
|
||||
@ -129,7 +129,7 @@ async def test_get_triggers(
|
||||
},
|
||||
{
|
||||
CONF_DEVICE_ID: device.id,
|
||||
CONF_DOMAIN: DECONZ_DOMAIN,
|
||||
CONF_DOMAIN: DOMAIN,
|
||||
CONF_PLATFORM: "device",
|
||||
CONF_TYPE: device_trigger.CONF_LONG_RELEASE,
|
||||
CONF_SUBTYPE: device_trigger.CONF_TURN_OFF,
|
||||
@ -187,7 +187,7 @@ async def test_get_triggers_for_alarm_event(
|
||||
) -> None:
|
||||
"""Test triggers work."""
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DECONZ_DOMAIN, "00:00:00:00:00:00:00:00")}
|
||||
identifiers={(DOMAIN, "00:00:00:00:00:00:00:00")}
|
||||
)
|
||||
bat_entity = entity_registry.async_get("sensor.keypad_battery")
|
||||
low_bat_entity = entity_registry.async_get("binary_sensor.keypad_low_battery")
|
||||
@ -272,7 +272,7 @@ async def test_get_triggers_manage_unsupported_remotes(
|
||||
) -> None:
|
||||
"""Verify no triggers for an unsupported remote."""
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DECONZ_DOMAIN, "d0:cf:5e:ff:fe:71:a4:3a")}
|
||||
identifiers={(DOMAIN, "d0:cf:5e:ff:fe:71:a4:3a")}
|
||||
)
|
||||
|
||||
triggers = await async_get_device_automations(
|
||||
@ -317,7 +317,7 @@ async def test_functional_device_trigger(
|
||||
) -> None:
|
||||
"""Test proper matching and attachment of device trigger automation."""
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DECONZ_DOMAIN, "d0:cf:5e:ff:fe:71:a4:3a")}
|
||||
identifiers={(DOMAIN, "d0:cf:5e:ff:fe:71:a4:3a")}
|
||||
)
|
||||
|
||||
assert await async_setup_component(
|
||||
@ -328,7 +328,7 @@ async def test_functional_device_trigger(
|
||||
{
|
||||
"trigger": {
|
||||
CONF_PLATFORM: "device",
|
||||
CONF_DOMAIN: DECONZ_DOMAIN,
|
||||
CONF_DOMAIN: DOMAIN,
|
||||
CONF_DEVICE_ID: device.id,
|
||||
CONF_TYPE: device_trigger.CONF_SHORT_PRESS,
|
||||
CONF_SUBTYPE: device_trigger.CONF_TURN_ON,
|
||||
@ -362,7 +362,7 @@ async def test_validate_trigger_unknown_device(hass: HomeAssistant) -> None:
|
||||
{
|
||||
"trigger": {
|
||||
CONF_PLATFORM: "device",
|
||||
CONF_DOMAIN: DECONZ_DOMAIN,
|
||||
CONF_DOMAIN: DOMAIN,
|
||||
CONF_DEVICE_ID: "unknown device",
|
||||
CONF_TYPE: device_trigger.CONF_SHORT_PRESS,
|
||||
CONF_SUBTYPE: device_trigger.CONF_TURN_ON,
|
||||
@ -388,7 +388,7 @@ async def test_validate_trigger_unsupported_device(
|
||||
"""Test unsupported device doesn't return a trigger config."""
|
||||
device = device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry_setup.entry_id,
|
||||
identifiers={(DECONZ_DOMAIN, "d0:cf:5e:ff:fe:71:a4:3a")},
|
||||
identifiers={(DOMAIN, "d0:cf:5e:ff:fe:71:a4:3a")},
|
||||
model="unsupported",
|
||||
)
|
||||
|
||||
@ -400,7 +400,7 @@ async def test_validate_trigger_unsupported_device(
|
||||
{
|
||||
"trigger": {
|
||||
CONF_PLATFORM: "device",
|
||||
CONF_DOMAIN: DECONZ_DOMAIN,
|
||||
CONF_DOMAIN: DOMAIN,
|
||||
CONF_DEVICE_ID: device.id,
|
||||
CONF_TYPE: device_trigger.CONF_SHORT_PRESS,
|
||||
CONF_SUBTYPE: device_trigger.CONF_TURN_ON,
|
||||
@ -428,13 +428,13 @@ async def test_validate_trigger_unsupported_trigger(
|
||||
"""Test unsupported trigger does not return a trigger config."""
|
||||
device = device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry_setup.entry_id,
|
||||
identifiers={(DECONZ_DOMAIN, "d0:cf:5e:ff:fe:71:a4:3a")},
|
||||
identifiers={(DOMAIN, "d0:cf:5e:ff:fe:71:a4:3a")},
|
||||
model="TRADFRI on/off switch",
|
||||
)
|
||||
|
||||
trigger_config = {
|
||||
CONF_PLATFORM: "device",
|
||||
CONF_DOMAIN: DECONZ_DOMAIN,
|
||||
CONF_DOMAIN: DOMAIN,
|
||||
CONF_DEVICE_ID: device.id,
|
||||
CONF_TYPE: "unsupported",
|
||||
CONF_SUBTYPE: device_trigger.CONF_TURN_ON,
|
||||
@ -470,14 +470,14 @@ async def test_attach_trigger_no_matching_event(
|
||||
"""Test no matching event for device doesn't return a trigger config."""
|
||||
device = device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry_setup.entry_id,
|
||||
identifiers={(DECONZ_DOMAIN, "d0:cf:5e:ff:fe:71:a4:3a")},
|
||||
identifiers={(DOMAIN, "d0:cf:5e:ff:fe:71:a4:3a")},
|
||||
name="Tradfri switch",
|
||||
model="TRADFRI on/off switch",
|
||||
)
|
||||
|
||||
trigger_config = {
|
||||
CONF_PLATFORM: "device",
|
||||
CONF_DOMAIN: DECONZ_DOMAIN,
|
||||
CONF_DOMAIN: DOMAIN,
|
||||
CONF_DEVICE_ID: device.id,
|
||||
CONF_TYPE: device_trigger.CONF_SHORT_PRESS,
|
||||
CONF_SUBTYPE: device_trigger.CONF_TURN_ON,
|
||||
|
@ -7,7 +7,7 @@ import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.deconz.config_flow import DECONZ_MANUFACTURERURL
|
||||
from homeassistant.components.deconz.const import DOMAIN as DECONZ_DOMAIN
|
||||
from homeassistant.components.deconz.const import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_SSDP
|
||||
from homeassistant.const import STATE_OFF, STATE_UNAVAILABLE
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -31,7 +31,7 @@ async def test_device_registry_entry(
|
||||
) -> None:
|
||||
"""Successful setup."""
|
||||
device_entry = device_registry.async_get_device(
|
||||
identifiers={(DECONZ_DOMAIN, config_entry_setup.unique_id)}
|
||||
identifiers={(DOMAIN, config_entry_setup.unique_id)}
|
||||
)
|
||||
assert device_entry == snapshot
|
||||
|
||||
@ -80,7 +80,7 @@ async def test_update_address(
|
||||
patch("pydeconz.gateway.WSClient") as ws_mock,
|
||||
):
|
||||
await hass.config_entries.flow.async_init(
|
||||
DECONZ_DOMAIN,
|
||||
DOMAIN,
|
||||
data=SsdpServiceInfo(
|
||||
ssdp_st="mock_st",
|
||||
ssdp_usn="mock_usn",
|
||||
|
@ -6,10 +6,7 @@ from unittest.mock import patch
|
||||
import pydeconz
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.deconz.const import (
|
||||
CONF_MASTER_GATEWAY,
|
||||
DOMAIN as DECONZ_DOMAIN,
|
||||
)
|
||||
from homeassistant.components.deconz.const import CONF_MASTER_GATEWAY, DOMAIN
|
||||
from homeassistant.components.deconz.errors import AuthenticationRequired
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -76,7 +73,7 @@ async def test_setup_entry_multiple_gateways(
|
||||
config_entry = await config_entry_factory()
|
||||
|
||||
entry2 = MockConfigEntry(
|
||||
domain=DECONZ_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
entry_id="2",
|
||||
unique_id="01234E56789B",
|
||||
data=config_entry.data | {"host": "2.3.4.5"},
|
||||
@ -105,7 +102,7 @@ async def test_unload_entry_multiple_gateways(
|
||||
config_entry = await config_entry_factory()
|
||||
|
||||
entry2 = MockConfigEntry(
|
||||
domain=DECONZ_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
entry_id="2",
|
||||
unique_id="01234E56789B",
|
||||
data=config_entry.data | {"host": "2.3.4.5"},
|
||||
@ -127,7 +124,7 @@ async def test_unload_entry_multiple_gateways_parallel(
|
||||
config_entry = await config_entry_factory()
|
||||
|
||||
entry2 = MockConfigEntry(
|
||||
domain=DECONZ_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
entry_id="2",
|
||||
unique_id="01234E56789B",
|
||||
data=config_entry.data | {"host": "2.3.4.5"},
|
||||
|
@ -4,7 +4,7 @@ from typing import Any
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.deconz.const import CONF_GESTURE, DOMAIN as DECONZ_DOMAIN
|
||||
from homeassistant.components.deconz.const import CONF_GESTURE, DOMAIN
|
||||
from homeassistant.components.deconz.deconz_event import (
|
||||
CONF_DECONZ_ALARM_EVENT,
|
||||
CONF_DECONZ_EVENT,
|
||||
@ -64,7 +64,7 @@ async def test_humanifying_deconz_alarm_event(
|
||||
keypad_event_id = slugify(sensor_payload["name"])
|
||||
keypad_serial = serial_from_unique_id(sensor_payload["uniqueid"])
|
||||
keypad_entry = device_registry.async_get_device(
|
||||
identifiers={(DECONZ_DOMAIN, keypad_serial)}
|
||||
identifiers={(DOMAIN, keypad_serial)}
|
||||
)
|
||||
|
||||
removed_device_event_id = "removed_device"
|
||||
@ -157,25 +157,25 @@ async def test_humanifying_deconz_event(
|
||||
switch_event_id = slugify(sensor_payload["1"]["name"])
|
||||
switch_serial = serial_from_unique_id(sensor_payload["1"]["uniqueid"])
|
||||
switch_entry = device_registry.async_get_device(
|
||||
identifiers={(DECONZ_DOMAIN, switch_serial)}
|
||||
identifiers={(DOMAIN, switch_serial)}
|
||||
)
|
||||
|
||||
hue_remote_event_id = slugify(sensor_payload["2"]["name"])
|
||||
hue_remote_serial = serial_from_unique_id(sensor_payload["2"]["uniqueid"])
|
||||
hue_remote_entry = device_registry.async_get_device(
|
||||
identifiers={(DECONZ_DOMAIN, hue_remote_serial)}
|
||||
identifiers={(DOMAIN, hue_remote_serial)}
|
||||
)
|
||||
|
||||
xiaomi_cube_event_id = slugify(sensor_payload["3"]["name"])
|
||||
xiaomi_cube_serial = serial_from_unique_id(sensor_payload["3"]["uniqueid"])
|
||||
xiaomi_cube_entry = device_registry.async_get_device(
|
||||
identifiers={(DECONZ_DOMAIN, xiaomi_cube_serial)}
|
||||
identifiers={(DOMAIN, xiaomi_cube_serial)}
|
||||
)
|
||||
|
||||
faulty_event_id = slugify(sensor_payload["4"]["name"])
|
||||
faulty_serial = serial_from_unique_id(sensor_payload["4"]["uniqueid"])
|
||||
faulty_entry = device_registry.async_get_device(
|
||||
identifiers={(DECONZ_DOMAIN, faulty_serial)}
|
||||
identifiers={(DOMAIN, faulty_serial)}
|
||||
)
|
||||
|
||||
removed_device_event_id = "removed_device"
|
||||
|
@ -9,7 +9,7 @@ import voluptuous as vol
|
||||
from homeassistant.components.deconz.const import (
|
||||
CONF_BRIDGE_ID,
|
||||
CONF_MASTER_GATEWAY,
|
||||
DOMAIN as DECONZ_DOMAIN,
|
||||
DOMAIN,
|
||||
)
|
||||
from homeassistant.components.deconz.deconz_event import CONF_DECONZ_EVENT
|
||||
from homeassistant.components.deconz.services import (
|
||||
@ -45,7 +45,7 @@ async def test_configure_service_with_field(
|
||||
aioclient_mock = mock_put_request("/lights/2")
|
||||
|
||||
await hass.services.async_call(
|
||||
DECONZ_DOMAIN, SERVICE_CONFIGURE_DEVICE, service_data=data, blocking=True
|
||||
DOMAIN, SERVICE_CONFIGURE_DEVICE, service_data=data, blocking=True
|
||||
)
|
||||
assert aioclient_mock.mock_calls[1][2] == {"on": True, "attr1": 10, "attr2": 20}
|
||||
|
||||
@ -74,7 +74,7 @@ async def test_configure_service_with_entity(
|
||||
aioclient_mock = mock_put_request("/lights/0")
|
||||
|
||||
await hass.services.async_call(
|
||||
DECONZ_DOMAIN, SERVICE_CONFIGURE_DEVICE, service_data=data, blocking=True
|
||||
DOMAIN, SERVICE_CONFIGURE_DEVICE, service_data=data, blocking=True
|
||||
)
|
||||
assert aioclient_mock.mock_calls[1][2] == {"on": True, "attr1": 10, "attr2": 20}
|
||||
|
||||
@ -104,7 +104,7 @@ async def test_configure_service_with_entity_and_field(
|
||||
aioclient_mock = mock_put_request("/lights/0/state")
|
||||
|
||||
await hass.services.async_call(
|
||||
DECONZ_DOMAIN, SERVICE_CONFIGURE_DEVICE, service_data=data, blocking=True
|
||||
DOMAIN, SERVICE_CONFIGURE_DEVICE, service_data=data, blocking=True
|
||||
)
|
||||
assert aioclient_mock.mock_calls[1][2] == {"on": True, "attr1": 10, "attr2": 20}
|
||||
|
||||
@ -122,9 +122,7 @@ async def test_configure_service_with_faulty_bridgeid(
|
||||
SERVICE_DATA: {"on": True},
|
||||
}
|
||||
|
||||
await hass.services.async_call(
|
||||
DECONZ_DOMAIN, SERVICE_CONFIGURE_DEVICE, service_data=data
|
||||
)
|
||||
await hass.services.async_call(DOMAIN, SERVICE_CONFIGURE_DEVICE, service_data=data)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert len(aioclient_mock.mock_calls) == 0
|
||||
@ -137,7 +135,7 @@ async def test_configure_service_with_faulty_field(hass: HomeAssistant) -> None:
|
||||
|
||||
with pytest.raises(vol.Invalid):
|
||||
await hass.services.async_call(
|
||||
DECONZ_DOMAIN, SERVICE_CONFIGURE_DEVICE, service_data=data
|
||||
DOMAIN, SERVICE_CONFIGURE_DEVICE, service_data=data
|
||||
)
|
||||
|
||||
|
||||
@ -153,9 +151,7 @@ async def test_configure_service_with_faulty_entity(
|
||||
SERVICE_DATA: {},
|
||||
}
|
||||
|
||||
await hass.services.async_call(
|
||||
DECONZ_DOMAIN, SERVICE_CONFIGURE_DEVICE, service_data=data
|
||||
)
|
||||
await hass.services.async_call(DOMAIN, SERVICE_CONFIGURE_DEVICE, service_data=data)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert len(aioclient_mock.mock_calls) == 0
|
||||
@ -174,9 +170,7 @@ async def test_calling_service_with_no_master_gateway_fails(
|
||||
SERVICE_DATA: {"on": True},
|
||||
}
|
||||
|
||||
await hass.services.async_call(
|
||||
DECONZ_DOMAIN, SERVICE_CONFIGURE_DEVICE, service_data=data
|
||||
)
|
||||
await hass.services.async_call(DOMAIN, SERVICE_CONFIGURE_DEVICE, service_data=data)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert len(aioclient_mock.mock_calls) == 0
|
||||
@ -227,7 +221,7 @@ async def test_service_refresh_devices(
|
||||
mock_requests()
|
||||
|
||||
await hass.services.async_call(
|
||||
DECONZ_DOMAIN, SERVICE_DEVICE_REFRESH, service_data={CONF_BRIDGE_ID: BRIDGE_ID}
|
||||
DOMAIN, SERVICE_DEVICE_REFRESH, service_data={CONF_BRIDGE_ID: BRIDGE_ID}
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@ -293,7 +287,7 @@ async def test_service_refresh_devices_trigger_no_state_update(
|
||||
mock_requests()
|
||||
|
||||
await hass.services.async_call(
|
||||
DECONZ_DOMAIN, SERVICE_DEVICE_REFRESH, service_data={CONF_BRIDGE_ID: BRIDGE_ID}
|
||||
DOMAIN, SERVICE_DEVICE_REFRESH, service_data={CONF_BRIDGE_ID: BRIDGE_ID}
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@ -349,7 +343,7 @@ async def test_remove_orphaned_entries_service(
|
||||
|
||||
entity_registry.async_get_or_create(
|
||||
SENSOR_DOMAIN,
|
||||
DECONZ_DOMAIN,
|
||||
DOMAIN,
|
||||
"12345",
|
||||
suggested_object_id="Orphaned sensor",
|
||||
config_entry=config_entry_setup,
|
||||
@ -366,7 +360,7 @@ async def test_remove_orphaned_entries_service(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DECONZ_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_REMOVE_ORPHANED_ENTRIES,
|
||||
service_data={CONF_BRIDGE_ID: BRIDGE_ID},
|
||||
)
|
||||
|
@ -4,7 +4,7 @@ from collections.abc import Callable
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.deconz.const import DOMAIN as DECONZ_DOMAIN
|
||||
from homeassistant.components.deconz.const import DOMAIN
|
||||
from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN
|
||||
from homeassistant.components.switch import (
|
||||
DOMAIN as SWITCH_DOMAIN,
|
||||
@ -110,7 +110,7 @@ async def test_remove_legacy_on_off_output_as_light(
|
||||
) -> None:
|
||||
"""Test that switch platform cleans up legacy light entities."""
|
||||
assert entity_registry.async_get_or_create(
|
||||
LIGHT_DOMAIN, DECONZ_DOMAIN, "00:00:00:00:00:00:00:00-00"
|
||||
LIGHT_DOMAIN, DOMAIN, "00:00:00:00:00:00:00:00-00"
|
||||
)
|
||||
|
||||
await config_entry_factory()
|
||||
|
@ -5,7 +5,7 @@ from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.demo import DOMAIN as DEMO_DOMAIN
|
||||
from homeassistant.components.demo import DOMAIN
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
@ -26,7 +26,7 @@ async def stt_only(hass: HomeAssistant) -> None:
|
||||
@pytest.fixture(autouse=True)
|
||||
async def setup_config_entry(hass: HomeAssistant, stt_only) -> None:
|
||||
"""Set up demo component from config entry."""
|
||||
config_entry = MockConfigEntry(domain=DEMO_DOMAIN)
|
||||
config_entry = MockConfigEntry(domain=DOMAIN)
|
||||
config_entry.add_to_hass(hass)
|
||||
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from homeassistant.components.dlib_face_detect import DOMAIN as DLIB_DOMAIN
|
||||
from homeassistant.components.dlib_face_detect import DOMAIN
|
||||
from homeassistant.components.image_processing import DOMAIN as IMAGE_PROCESSING_DOMAIN
|
||||
from homeassistant.const import CONF_ENTITY_ID, CONF_PLATFORM, CONF_SOURCE
|
||||
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
|
||||
@ -22,7 +22,7 @@ async def test_repair_issue_is_created(
|
||||
{
|
||||
IMAGE_PROCESSING_DOMAIN: [
|
||||
{
|
||||
CONF_PLATFORM: DLIB_DOMAIN,
|
||||
CONF_PLATFORM: DOMAIN,
|
||||
CONF_SOURCE: [
|
||||
{CONF_ENTITY_ID: "camera.test_camera"},
|
||||
],
|
||||
@ -33,5 +33,5 @@ async def test_repair_issue_is_created(
|
||||
await hass.async_block_till_done()
|
||||
assert (
|
||||
HOMEASSISTANT_DOMAIN,
|
||||
f"deprecated_system_packages_yaml_integration_{DLIB_DOMAIN}",
|
||||
f"deprecated_system_packages_yaml_integration_{DOMAIN}",
|
||||
) in issue_registry.issues
|
||||
|
@ -2,10 +2,7 @@
|
||||
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from homeassistant.components.dlib_face_identify import (
|
||||
CONF_FACES,
|
||||
DOMAIN as DLIB_DOMAIN,
|
||||
)
|
||||
from homeassistant.components.dlib_face_identify import CONF_FACES, DOMAIN
|
||||
from homeassistant.components.image_processing import DOMAIN as IMAGE_PROCESSING_DOMAIN
|
||||
from homeassistant.const import CONF_ENTITY_ID, CONF_PLATFORM, CONF_SOURCE
|
||||
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
|
||||
@ -25,7 +22,7 @@ async def test_repair_issue_is_created(
|
||||
{
|
||||
IMAGE_PROCESSING_DOMAIN: [
|
||||
{
|
||||
CONF_PLATFORM: DLIB_DOMAIN,
|
||||
CONF_PLATFORM: DOMAIN,
|
||||
CONF_SOURCE: [
|
||||
{CONF_ENTITY_ID: "camera.test_camera"},
|
||||
],
|
||||
@ -37,5 +34,5 @@ async def test_repair_issue_is_created(
|
||||
await hass.async_block_till_done()
|
||||
assert (
|
||||
HOMEASSISTANT_DOMAIN,
|
||||
f"deprecated_system_packages_yaml_integration_{DLIB_DOMAIN}",
|
||||
f"deprecated_system_packages_yaml_integration_{DOMAIN}",
|
||||
) in issue_registry.issues
|
||||
|
@ -10,7 +10,7 @@ from async_upnp_client.client import UpnpDevice, UpnpService
|
||||
from async_upnp_client.client_factory import UpnpFactory
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.dlna_dmr.const import DOMAIN as DLNA_DOMAIN
|
||||
from homeassistant.components.dlna_dmr.const import DOMAIN
|
||||
from homeassistant.components.dlna_dmr.data import DlnaDmrData
|
||||
from homeassistant.const import CONF_DEVICE_ID, CONF_MAC, CONF_TYPE, CONF_URL
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -76,7 +76,7 @@ def domain_data_mock(hass: HomeAssistant) -> Mock:
|
||||
seal(upnp_device)
|
||||
domain_data.upnp_factory.async_create_device.return_value = upnp_device
|
||||
|
||||
hass.data[DLNA_DOMAIN] = domain_data
|
||||
hass.data[DOMAIN] = domain_data
|
||||
return domain_data
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ def config_entry_mock() -> MockConfigEntry:
|
||||
"""Mock a config entry for this platform."""
|
||||
return MockConfigEntry(
|
||||
unique_id=MOCK_DEVICE_UDN,
|
||||
domain=DLNA_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
data={
|
||||
CONF_URL: MOCK_DEVICE_LOCATION,
|
||||
CONF_DEVICE_ID: MOCK_DEVICE_UDN,
|
||||
@ -102,7 +102,7 @@ def config_entry_mock_no_mac() -> MockConfigEntry:
|
||||
"""Mock a config entry that does not already contain a MAC address."""
|
||||
return MockConfigEntry(
|
||||
unique_id=MOCK_DEVICE_UDN,
|
||||
domain=DLNA_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
data={
|
||||
CONF_URL: MOCK_DEVICE_LOCATION,
|
||||
CONF_DEVICE_ID: MOCK_DEVICE_UDN,
|
||||
|
@ -17,7 +17,7 @@ from homeassistant.components.dlna_dmr.const import (
|
||||
CONF_CALLBACK_URL_OVERRIDE,
|
||||
CONF_LISTEN_PORT,
|
||||
CONF_POLL_AVAILABILITY,
|
||||
DOMAIN as DLNA_DOMAIN,
|
||||
DOMAIN,
|
||||
)
|
||||
from homeassistant.const import CONF_DEVICE_ID, CONF_HOST, CONF_MAC, CONF_TYPE, CONF_URL
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -92,7 +92,7 @@ MOCK_DISCOVERY = SsdpServiceInfo(
|
||||
]
|
||||
},
|
||||
},
|
||||
x_homeassistant_matching_domains={DLNA_DOMAIN},
|
||||
x_homeassistant_matching_domains={DOMAIN},
|
||||
)
|
||||
|
||||
|
||||
@ -118,7 +118,7 @@ def mock_setup_entry() -> Generator[Mock]:
|
||||
async def test_user_flow_undiscovered_manual(hass: HomeAssistant) -> None:
|
||||
"""Test user-init'd flow, no discovered devices, user entering a valid URL."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
@ -150,7 +150,7 @@ async def test_user_flow_discovered_manual(
|
||||
]
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
@ -188,7 +188,7 @@ async def test_user_flow_selected(hass: HomeAssistant, ssdp_scanner_mock: Mock)
|
||||
]
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["errors"] is None
|
||||
@ -217,7 +217,7 @@ async def test_user_flow_uncontactable(
|
||||
domain_data_mock.upnp_factory.async_create_device.side_effect = UpnpError
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
@ -252,7 +252,7 @@ async def test_user_flow_embedded_st(
|
||||
upnp_device.all_devices.append(embedded_device)
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
@ -280,7 +280,7 @@ async def test_user_flow_wrong_st(hass: HomeAssistant, domain_data_mock: Mock) -
|
||||
upnp_device.device_type = WRONG_DEVICE_TYPE
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
@ -301,7 +301,7 @@ async def test_ssdp_flow_success(hass: HomeAssistant) -> None:
|
||||
logging.DEBUG
|
||||
)
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=MOCK_DISCOVERY,
|
||||
)
|
||||
@ -333,7 +333,7 @@ async def test_ssdp_flow_unavailable(
|
||||
message, there's no need to connect to the device to configure it.
|
||||
"""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=MOCK_DISCOVERY,
|
||||
)
|
||||
@ -364,7 +364,7 @@ async def test_ssdp_flow_existing(
|
||||
"""Test that SSDP discovery of existing config entry updates the URL."""
|
||||
config_entry_mock.add_to_hass(hass)
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=SsdpServiceInfo(
|
||||
ssdp_usn="mock_usn",
|
||||
@ -394,7 +394,7 @@ async def test_ssdp_flow_duplicate_location(
|
||||
# New discovery with different UDN but same location
|
||||
discovery = dataclasses.replace(MOCK_DISCOVERY, ssdp_udn=CHANGED_DEVICE_UDN)
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=discovery,
|
||||
)
|
||||
@ -420,7 +420,7 @@ async def test_ssdp_duplicate_mac_ignored_entry(
|
||||
|
||||
# SSDP discovery should be aborted
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=discovery,
|
||||
)
|
||||
@ -443,7 +443,7 @@ async def test_ssdp_duplicate_mac_configured_entry(
|
||||
|
||||
# SSDP discovery should be aborted
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=discovery,
|
||||
)
|
||||
@ -459,7 +459,7 @@ async def test_ssdp_add_mac(
|
||||
|
||||
# Start a discovery that adds the MAC address (due to auto-use mock_get_mac_address)
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=MOCK_DISCOVERY,
|
||||
)
|
||||
@ -480,7 +480,7 @@ async def test_ssdp_dont_remove_mac(
|
||||
# Start a discovery that fails when resolving the MAC
|
||||
mock_get_mac_address.return_value = None
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=MOCK_DISCOVERY,
|
||||
)
|
||||
@ -498,7 +498,7 @@ async def test_ssdp_flow_upnp_udn(
|
||||
"""Test that SSDP discovery ignores the root device's UDN."""
|
||||
config_entry_mock.add_to_hass(hass)
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=SsdpServiceInfo(
|
||||
ssdp_usn="mock_usn",
|
||||
@ -524,7 +524,7 @@ async def test_ssdp_missing_services(hass: HomeAssistant) -> None:
|
||||
discovery.upnp = dict(discovery.upnp)
|
||||
del discovery.upnp[ATTR_UPNP_SERVICE_LIST]
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=discovery,
|
||||
)
|
||||
@ -536,7 +536,7 @@ async def test_ssdp_missing_services(hass: HomeAssistant) -> None:
|
||||
discovery.upnp = discovery.upnp.copy()
|
||||
discovery.upnp[ATTR_UPNP_SERVICE_LIST] = {"bad_key": "bad_value"}
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=discovery,
|
||||
)
|
||||
@ -554,7 +554,7 @@ async def test_ssdp_missing_services(hass: HomeAssistant) -> None:
|
||||
]
|
||||
}
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN, context={"source": config_entries.SOURCE_SSDP}, data=discovery
|
||||
DOMAIN, context={"source": config_entries.SOURCE_SSDP}, data=discovery
|
||||
)
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
assert result["reason"] == "not_dmr"
|
||||
@ -574,7 +574,7 @@ async def test_ssdp_single_service(hass: HomeAssistant) -> None:
|
||||
discovery.upnp[ATTR_UPNP_SERVICE_LIST] = service_list
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=discovery,
|
||||
)
|
||||
@ -585,10 +585,10 @@ async def test_ssdp_single_service(hass: HomeAssistant) -> None:
|
||||
async def test_ssdp_ignore_device(hass: HomeAssistant) -> None:
|
||||
"""Test SSDP discovery ignores certain devices."""
|
||||
discovery = dataclasses.replace(MOCK_DISCOVERY)
|
||||
discovery.x_homeassistant_matching_domains = {DLNA_DOMAIN, "other_domain"}
|
||||
discovery.x_homeassistant_matching_domains = {DOMAIN, "other_domain"}
|
||||
assert discovery.x_homeassistant_matching_domains
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=discovery,
|
||||
)
|
||||
@ -599,7 +599,7 @@ async def test_ssdp_ignore_device(hass: HomeAssistant) -> None:
|
||||
discovery.upnp = dict(discovery.upnp)
|
||||
discovery.upnp[ATTR_UPNP_DEVICE_TYPE] = "urn:schemas-upnp-org:device:ZonePlayer:1"
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=discovery,
|
||||
)
|
||||
@ -617,7 +617,7 @@ async def test_ssdp_ignore_device(hass: HomeAssistant) -> None:
|
||||
discovery.upnp[ATTR_UPNP_MANUFACTURER] = manufacturer
|
||||
discovery.upnp[ATTR_UPNP_MODEL_NAME] = model
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=discovery,
|
||||
)
|
||||
@ -637,7 +637,7 @@ async def test_ignore_flow(hass: HomeAssistant, ssdp_scanner_mock: Mock) -> None
|
||||
]
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_IGNORE},
|
||||
data={"unique_id": MOCK_DEVICE_UDN, "title": MOCK_DEVICE_NAME},
|
||||
)
|
||||
@ -661,7 +661,7 @@ async def test_ignore_flow_no_ssdp(
|
||||
ssdp_scanner_mock.async_get_discovery_info_by_udn_st.return_value = None
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_IGNORE},
|
||||
data={"unique_id": MOCK_DEVICE_UDN, "title": MOCK_DEVICE_NAME},
|
||||
)
|
||||
@ -683,7 +683,7 @@ async def test_get_mac_address_ipv4(
|
||||
"""Test getting MAC address from IPv4 address for SSDP discovery."""
|
||||
# Init'ing the flow should be enough to get the MAC address
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=MOCK_DISCOVERY,
|
||||
)
|
||||
@ -707,7 +707,7 @@ async def test_get_mac_address_ipv6(
|
||||
|
||||
# Init'ing the flow should be enough to get the MAC address
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data=discovery,
|
||||
)
|
||||
@ -728,7 +728,7 @@ async def test_get_mac_address_host(
|
||||
DEVICE_LOCATION = f"http://{DEVICE_HOSTNAME}/dmr_description.xml"
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DLNA_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={CONF_URL: DEVICE_LOCATION}
|
||||
|
@ -3,7 +3,7 @@
|
||||
from unittest.mock import Mock
|
||||
|
||||
from homeassistant.components import media_player
|
||||
from homeassistant.components.dlna_dmr.const import DOMAIN as DLNA_DOMAIN
|
||||
from homeassistant.components.dlna_dmr.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.helpers.entity_component import async_update_entity
|
||||
@ -23,7 +23,7 @@ async def test_resource_lifecycle(
|
||||
"""Test that resources are acquired/released as the entity is setup/unloaded."""
|
||||
# Set up the config entry
|
||||
config_entry_mock.add_to_hass(hass)
|
||||
assert await async_setup_component(hass, DLNA_DOMAIN, {}) is True
|
||||
assert await async_setup_component(hass, DOMAIN, {}) is True
|
||||
await hass.async_block_till_done()
|
||||
|
||||
# Check the entity is created and working
|
||||
|
Loading…
x
Reference in New Issue
Block a user