From 82148e46f52440cdcf9170dc20e44cf422ca1c2d Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Tue, 17 Feb 2026 12:15:36 +0100 Subject: [PATCH] Rename DOMAIN aliases in tests (#163254) --- tests/components/airly/test_init.py | 4 ++-- tests/components/imgw_pib/test_init.py | 4 ++-- tests/components/imgw_pib/test_sensor.py | 4 ++-- tests/components/nam/test_init.py | 6 +++--- tests/components/nibe_heatpump/test_switch.py | 6 +++--- tests/components/shelly/test_select.py | 20 +++++++++---------- tests/components/shelly/test_text.py | 16 +++++++-------- tests/components/tractive/test_init.py | 4 ++-- tests/components/weheat/conftest.py | 4 ++-- 9 files changed, 34 insertions(+), 34 deletions(-) diff --git a/tests/components/airly/test_init.py b/tests/components/airly/test_init.py index b7fa8a44360..ea24fe80c0a 100644 --- a/tests/components/airly/test_init.py +++ b/tests/components/airly/test_init.py @@ -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", diff --git a/tests/components/imgw_pib/test_init.py b/tests/components/imgw_pib/test_init.py index e352c643676..20fe4aed1aa 100644 --- a/tests/components/imgw_pib/test_init.py +++ b/tests/components/imgw_pib/test_init.py @@ -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], diff --git a/tests/components/imgw_pib/test_sensor.py b/tests/components/imgw_pib/test_sensor.py index cb27f0f9b46..48d03df5786 100644 --- a/tests/components/imgw_pib/test_sensor.py +++ b/tests/components/imgw_pib/test_sensor.py @@ -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], diff --git a/tests/components/nam/test_init.py b/tests/components/nam/test_init.py index ea61739c008..878d90e19ce 100644 --- a/tests/components/nam/test_init.py +++ b/tests/components/nam/test_init.py @@ -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", diff --git a/tests/components/nibe_heatpump/test_switch.py b/tests/components/nibe_heatpump/test_switch.py index 4221de52ba1..76e34f6daa1 100644 --- a/tests/components/nibe_heatpump/test_switch.py +++ b/tests/components/nibe_heatpump/test_switch.py @@ -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, diff --git a/tests/components/shelly/test_select.py b/tests/components/shelly/test_select.py index 26bb3a9cd78..dce5f151f2c 100644 --- a/tests/components/shelly/test_select.py +++ b/tests/components/shelly/test_select.py @@ -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, diff --git a/tests/components/shelly/test_text.py b/tests/components/shelly/test_text.py index ad8497a1d03..0dd8111ed31 100644 --- a/tests/components/shelly/test_text.py +++ b/tests/components/shelly/test_text.py @@ -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, diff --git a/tests/components/tractive/test_init.py b/tests/components/tractive/test_init.py index 9b84168eec5..71934600c01 100644 --- a/tests/components/tractive/test_init.py +++ b/tests/components/tractive/test_init.py @@ -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], diff --git a/tests/components/weheat/conftest.py b/tests/components/weheat/conftest.py index 692792955fc..8d2f70ea472 100644 --- a/tests/components/weheat/conftest.py +++ b/tests/components/weheat/conftest.py @@ -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,