Rename DOMAIN aliases in tests (#163254)

This commit is contained in:
epenet
2026-02-17 12:15:36 +01:00
committed by GitHub
parent 34a78f9251
commit 82148e46f5
9 changed files with 34 additions and 34 deletions

View File

@@ -5,7 +5,7 @@ from typing import Any
from freezegun.api import FrozenDateTimeFactory
import pytest
from homeassistant.components.air_quality import DOMAIN as AIR_QUALITY_PLATFORM
from homeassistant.components.air_quality import DOMAIN as AIR_QUALITY_DOMAIN
from homeassistant.components.airly.const import DOMAIN
from homeassistant.components.airly.coordinator import set_update_interval
from homeassistant.config_entries import ConfigEntryState
@@ -245,7 +245,7 @@ async def test_remove_air_quality_entities(
) -> None:
"""Test remove air_quality entities from registry."""
entity_registry.async_get_or_create(
AIR_QUALITY_PLATFORM,
AIR_QUALITY_DOMAIN,
DOMAIN,
"123-456",
suggested_object_id="home",

View File

@@ -4,7 +4,7 @@ from unittest.mock import AsyncMock, patch
from imgw_pib import ApiError
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_PLATFORM
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
from homeassistant.components.imgw_pib.const import DOMAIN
from homeassistant.config_entries import ConfigEntryState
from homeassistant.core import HomeAssistant
@@ -58,7 +58,7 @@ async def test_remove_binary_sensor_entity(
mock_config_entry.add_to_hass(hass)
entity_registry.async_get_or_create(
BINARY_SENSOR_PLATFORM,
BINARY_SENSOR_DOMAIN,
DOMAIN,
"123_flood_alarm",
suggested_object_id=entity_id.rsplit(".", maxsplit=1)[-1],

View File

@@ -8,7 +8,7 @@ import pytest
from syrupy.assertion import SnapshotAssertion
from homeassistant.components.imgw_pib.const import DOMAIN, UPDATE_INTERVAL
from homeassistant.components.sensor import DOMAIN as SENSOR_PLATFORM
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.const import STATE_UNAVAILABLE, Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
@@ -79,7 +79,7 @@ async def test_remove_entity(
mock_config_entry.add_to_hass(hass)
entity_registry.async_get_or_create(
SENSOR_PLATFORM,
SENSOR_DOMAIN,
DOMAIN,
"123_flood_alarm_level",
suggested_object_id=entity_id.rsplit(".", maxsplit=1)[-1],

View File

@@ -4,7 +4,7 @@ from unittest.mock import patch
from nettigo_air_monitor import ApiError, AuthFailedError
from homeassistant.components.air_quality import DOMAIN as AIR_QUALITY_PLATFORM
from homeassistant.components.air_quality import DOMAIN as AIR_QUALITY_DOMAIN
from homeassistant.components.nam.const import DOMAIN
from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import STATE_UNAVAILABLE
@@ -81,7 +81,7 @@ async def test_remove_air_quality_entities(
) -> None:
"""Test remove air_quality entities from registry."""
entity_registry.async_get_or_create(
AIR_QUALITY_PLATFORM,
AIR_QUALITY_DOMAIN,
DOMAIN,
"aa:bb:cc:dd:ee:ff-sds011",
suggested_object_id="nettigo_air_monitor_sds011",
@@ -89,7 +89,7 @@ async def test_remove_air_quality_entities(
)
entity_registry.async_get_or_create(
AIR_QUALITY_PLATFORM,
AIR_QUALITY_DOMAIN,
DOMAIN,
"aa:bb:cc:dd:ee:ff-sps30",
suggested_object_id="nettigo_air_monitor_sps30",

View File

@@ -9,7 +9,7 @@ import pytest
from syrupy.assertion import SnapshotAssertion
from homeassistant.components.switch import (
DOMAIN as SWITCH_PLATFORM,
DOMAIN as SWITCH_DOMAIN,
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
)
@@ -79,7 +79,7 @@ async def test_turn_on(
# Write value
await hass.services.async_call(
SWITCH_PLATFORM,
SWITCH_DOMAIN,
SERVICE_TURN_ON,
{ATTR_ENTITY_ID: entity_id},
blocking=True,
@@ -118,7 +118,7 @@ async def test_turn_off(
# Write value
await hass.services.async_call(
SWITCH_PLATFORM,
SWITCH_DOMAIN,
SERVICE_TURN_OFF,
{ATTR_ENTITY_ID: entity_id},
blocking=True,

View File

@@ -9,7 +9,7 @@ import pytest
from homeassistant.components.select import (
ATTR_OPTION,
ATTR_OPTIONS,
DOMAIN as SELECT_PLATFORM,
DOMAIN as SELECT_DOMAIN,
SERVICE_SELECT_OPTION,
)
from homeassistant.components.shelly.const import DOMAIN
@@ -91,7 +91,7 @@ async def test_rpc_device_virtual_enum(
monkeypatch.setitem(mock_rpc_device.status["enum:203"], "value", "option 1")
await hass.services.async_call(
SELECT_PLATFORM,
SELECT_DOMAIN,
SERVICE_SELECT_OPTION,
{ATTR_ENTITY_ID: entity_id, ATTR_OPTION: "Title 1"},
blocking=True,
@@ -131,7 +131,7 @@ async def test_rpc_remove_virtual_enum_when_mode_label(
device_entry = register_device(device_registry, config_entry)
entity_id = register_entity(
hass,
SELECT_PLATFORM,
SELECT_DOMAIN,
"test_name_enum_200",
"enum:200-enum_generic",
config_entry,
@@ -155,7 +155,7 @@ async def test_rpc_remove_virtual_enum_when_orphaned(
device_entry = register_device(device_registry, config_entry)
entity_id = register_entity(
hass,
SELECT_PLATFORM,
SELECT_DOMAIN,
"test_name_enum_200",
"enum:200-enum_generic",
config_entry,
@@ -212,10 +212,10 @@ async def test_select_set_exc(
with pytest.raises(HomeAssistantError, match=error):
await hass.services.async_call(
SELECT_PLATFORM,
SELECT_DOMAIN,
SERVICE_SELECT_OPTION,
{
ATTR_ENTITY_ID: f"{SELECT_PLATFORM}.test_name_enum_203",
ATTR_ENTITY_ID: f"{SELECT_DOMAIN}.test_name_enum_203",
ATTR_OPTION: "option 2",
},
blocking=True,
@@ -250,10 +250,10 @@ async def test_select_set_reauth_error(
mock_rpc_device.enum_set.side_effect = InvalidAuthError
await hass.services.async_call(
SELECT_PLATFORM,
SELECT_DOMAIN,
SERVICE_SELECT_OPTION,
{
ATTR_ENTITY_ID: f"{SELECT_PLATFORM}.test_name_enum_203",
ATTR_ENTITY_ID: f"{SELECT_DOMAIN}.test_name_enum_203",
ATTR_OPTION: "option 2",
},
blocking=True,
@@ -280,7 +280,7 @@ async def test_rpc_cury_mode_select(
monkeypatch: pytest.MonkeyPatch,
) -> None:
"""Test Cury Mode select entity."""
entity_id = f"{SELECT_PLATFORM}.test_name_mode"
entity_id = f"{SELECT_DOMAIN}.test_name_mode"
status = {"cury:0": {"id": 0, "mode": "hall"}}
monkeypatch.setattr(mock_rpc_device, "status", status)
await init_integration(hass, 3)
@@ -310,7 +310,7 @@ async def test_rpc_cury_mode_select(
monkeypatch.setitem(mock_rpc_device.status["cury:0"], "mode", "reception")
await hass.services.async_call(
SELECT_PLATFORM,
SELECT_DOMAIN,
SERVICE_SELECT_OPTION,
{ATTR_ENTITY_ID: entity_id, ATTR_OPTION: "reception"},
blocking=True,

View File

@@ -9,7 +9,7 @@ import pytest
from homeassistant.components.shelly.const import DOMAIN
from homeassistant.components.text import (
ATTR_VALUE,
DOMAIN as TEXT_PLATFORM,
DOMAIN as TEXT_DOMAIN,
SERVICE_SET_VALUE,
)
from homeassistant.config_entries import SOURCE_REAUTH, ConfigEntryState
@@ -72,7 +72,7 @@ async def test_rpc_device_virtual_text(
monkeypatch.setitem(mock_rpc_device.status["text:203"], "value", "sed do eiusmod")
await hass.services.async_call(
TEXT_PLATFORM,
TEXT_DOMAIN,
SERVICE_SET_VALUE,
{ATTR_ENTITY_ID: entity_id, ATTR_VALUE: "sed do eiusmod"},
blocking=True,
@@ -105,7 +105,7 @@ async def test_rpc_remove_virtual_text_when_mode_label(
device_entry = register_device(device_registry, config_entry)
entity_id = register_entity(
hass,
TEXT_PLATFORM,
TEXT_DOMAIN,
"test_name_text_200",
"text:200-text_generic",
config_entry,
@@ -129,7 +129,7 @@ async def test_rpc_remove_virtual_text_when_orphaned(
device_entry = register_device(device_registry, config_entry)
entity_id = register_entity(
hass,
TEXT_PLATFORM,
TEXT_DOMAIN,
"test_name_text_200",
"text:200-text_generic",
config_entry,
@@ -180,10 +180,10 @@ async def test_text_set_exc(
with pytest.raises(HomeAssistantError, match=error):
await hass.services.async_call(
TEXT_PLATFORM,
TEXT_DOMAIN,
SERVICE_SET_VALUE,
{
ATTR_ENTITY_ID: f"{TEXT_PLATFORM}.test_name_text_203",
ATTR_ENTITY_ID: f"{TEXT_DOMAIN}.test_name_text_203",
ATTR_VALUE: "new value",
},
blocking=True,
@@ -212,10 +212,10 @@ async def test_text_set_reauth_error(
mock_rpc_device.text_set.side_effect = InvalidAuthError
await hass.services.async_call(
TEXT_PLATFORM,
TEXT_DOMAIN,
SERVICE_SET_VALUE,
{
ATTR_ENTITY_ID: f"{TEXT_PLATFORM}.test_name_text_203",
ATTR_ENTITY_ID: f"{TEXT_DOMAIN}.test_name_text_203",
ATTR_VALUE: "new value",
},
blocking=True,

View File

@@ -6,7 +6,7 @@ from unittest.mock import AsyncMock, patch
from aiotractive.exceptions import TractiveError, UnauthorizedError
import pytest
from homeassistant.components.sensor import DOMAIN as SENSOR_PLATFORM
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.components.tractive.const import (
ATTR_DAILY_GOAL,
ATTR_MINUTES_ACTIVE,
@@ -233,7 +233,7 @@ async def test_remove_unsupported_sensor_entity(
mock_config_entry.add_to_hass(hass)
entity_registry.async_get_or_create(
SENSOR_PLATFORM,
SENSOR_DOMAIN,
DOMAIN,
f"pet_id_123_{sensor}",
suggested_object_id=entity_id.rsplit(".", maxsplit=1)[-1],

View File

@@ -9,7 +9,7 @@ from weheat.abstractions.discovery import HeatPumpDiscovery
from weheat.abstractions.heat_pump import HeatPump
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS,
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -32,7 +32,7 @@ from tests.common import MockConfigEntry
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, APPLICATION_CREDENTIALS, {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,