mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Remove unnecessary DOMAIN alias in tests (e-k) (#145818)
This commit is contained in:
parent
7da8e24e21
commit
695f69bd90
@ -2,7 +2,7 @@
|
||||
|
||||
from enocean.utils import combine_hex
|
||||
|
||||
from homeassistant.components.enocean import DOMAIN as ENOCEAN_DOMAIN
|
||||
from homeassistant.components.enocean import DOMAIN
|
||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
@ -13,7 +13,7 @@ from tests.common import MockConfigEntry, assert_setup_component
|
||||
SWITCH_CONFIG = {
|
||||
"switch": [
|
||||
{
|
||||
"platform": ENOCEAN_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"id": [0xDE, 0xAD, 0xBE, 0xEF],
|
||||
"channel": 1,
|
||||
"name": "room0",
|
||||
@ -35,14 +35,14 @@ async def test_unique_id_migration(
|
||||
|
||||
old_unique_id = f"{combine_hex(dev_id)}"
|
||||
|
||||
entry = MockConfigEntry(domain=ENOCEAN_DOMAIN, data={"device": "/dev/null"})
|
||||
entry = MockConfigEntry(domain=DOMAIN, data={"device": "/dev/null"})
|
||||
|
||||
entry.add_to_hass(hass)
|
||||
|
||||
# Add a switch with an old unique_id to the entity registry
|
||||
entity_entry = entity_registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
ENOCEAN_DOMAIN,
|
||||
DOMAIN,
|
||||
old_unique_id,
|
||||
suggested_object_id=entity_name,
|
||||
config_entry=entry,
|
||||
@ -69,8 +69,6 @@ async def test_unique_id_migration(
|
||||
|
||||
assert entity_entry.unique_id == new_unique_id
|
||||
assert (
|
||||
entity_registry.async_get_entity_id(
|
||||
SWITCH_DOMAIN, ENOCEAN_DOMAIN, old_unique_id
|
||||
)
|
||||
entity_registry.async_get_entity_id(SWITCH_DOMAIN, DOMAIN, old_unique_id)
|
||||
is None
|
||||
)
|
||||
|
@ -6,7 +6,7 @@ import time
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.flo.const import DOMAIN as FLO_DOMAIN
|
||||
from homeassistant.components.flo.const import DOMAIN
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, CONTENT_TYPE_JSON
|
||||
|
||||
from .common import TEST_EMAIL_ADDRESS, TEST_PASSWORD, TEST_TOKEN, TEST_USER_ID
|
||||
@ -19,7 +19,7 @@ from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
def config_entry() -> MockConfigEntry:
|
||||
"""Config entry version 1 fixture."""
|
||||
return MockConfigEntry(
|
||||
domain=FLO_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
data={CONF_USERNAME: TEST_USER_ID, CONF_PASSWORD: TEST_PASSWORD},
|
||||
version=1,
|
||||
)
|
||||
|
@ -3,7 +3,7 @@
|
||||
import pytest
|
||||
from voluptuous.error import MultipleInvalid
|
||||
|
||||
from homeassistant.components.flo.const import DOMAIN as FLO_DOMAIN
|
||||
from homeassistant.components.flo.const import DOMAIN
|
||||
from homeassistant.components.flo.switch import (
|
||||
ATTR_REVERT_TO_MODE,
|
||||
ATTR_SLEEP_MINUTES,
|
||||
@ -36,7 +36,7 @@ async def test_services(
|
||||
assert aioclient_mock.call_count == 8
|
||||
|
||||
await hass.services.async_call(
|
||||
FLO_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_RUN_HEALTH_TEST,
|
||||
{ATTR_ENTITY_ID: SWITCH_ENTITY_ID},
|
||||
blocking=True,
|
||||
@ -45,7 +45,7 @@ async def test_services(
|
||||
assert aioclient_mock.call_count == 9
|
||||
|
||||
await hass.services.async_call(
|
||||
FLO_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_SET_AWAY_MODE,
|
||||
{ATTR_ENTITY_ID: SWITCH_ENTITY_ID},
|
||||
blocking=True,
|
||||
@ -54,7 +54,7 @@ async def test_services(
|
||||
assert aioclient_mock.call_count == 10
|
||||
|
||||
await hass.services.async_call(
|
||||
FLO_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_SET_HOME_MODE,
|
||||
{ATTR_ENTITY_ID: SWITCH_ENTITY_ID},
|
||||
blocking=True,
|
||||
@ -63,7 +63,7 @@ async def test_services(
|
||||
assert aioclient_mock.call_count == 11
|
||||
|
||||
await hass.services.async_call(
|
||||
FLO_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_SET_SLEEP_MODE,
|
||||
{
|
||||
ATTR_ENTITY_ID: SWITCH_ENTITY_ID,
|
||||
@ -77,7 +77,7 @@ async def test_services(
|
||||
|
||||
# test calling with a string value to ensure it is converted to int
|
||||
await hass.services.async_call(
|
||||
FLO_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_SET_SLEEP_MODE,
|
||||
{
|
||||
ATTR_ENTITY_ID: SWITCH_ENTITY_ID,
|
||||
@ -92,7 +92,7 @@ async def test_services(
|
||||
# test calling with a non string -> int value and ensure exception is thrown
|
||||
with pytest.raises(MultipleInvalid):
|
||||
await hass.services.async_call(
|
||||
FLO_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_SET_SLEEP_MODE,
|
||||
{
|
||||
ATTR_ENTITY_ID: SWITCH_ENTITY_ID,
|
||||
|
@ -9,7 +9,7 @@ from requests.exceptions import HTTPError
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
|
||||
from homeassistant.components.fritzbox.const import DOMAIN as FB_DOMAIN
|
||||
from homeassistant.components.fritzbox.const import DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import CONF_DEVICES, STATE_UNAVAILABLE, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -35,7 +35,7 @@ async def test_setup(
|
||||
device = FritzDeviceBinarySensorMock()
|
||||
with patch("homeassistant.components.fritzbox.PLATFORMS", [Platform.BINARY_SENSOR]):
|
||||
entry = await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
assert entry.state is ConfigEntryState.LOADED
|
||||
|
||||
@ -47,7 +47,7 @@ async def test_is_off(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
device = FritzDeviceBinarySensorMock()
|
||||
device.present = False
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
state = hass.states.get(f"{ENTITY_ID}_alarm")
|
||||
@ -67,7 +67,7 @@ async def test_update(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
"""Test update without error."""
|
||||
device = FritzDeviceBinarySensorMock()
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
assert fritz().update_devices.call_count == 1
|
||||
@ -86,7 +86,7 @@ async def test_update_error(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
device = FritzDeviceBinarySensorMock()
|
||||
device.update.side_effect = [mock.DEFAULT, HTTPError("Boom")]
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
assert fritz().update_devices.call_count == 1
|
||||
@ -104,7 +104,7 @@ async def test_discover_new_device(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
"""Test adding new discovered devices during runtime."""
|
||||
device = FritzDeviceBinarySensorMock()
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
state = hass.states.get(f"{ENTITY_ID}_alarm")
|
||||
|
@ -6,7 +6,7 @@ from unittest.mock import Mock, patch
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.button import DOMAIN as BUTTON_DOMAIN, SERVICE_PRESS
|
||||
from homeassistant.components.fritzbox.const import DOMAIN as FB_DOMAIN
|
||||
from homeassistant.components.fritzbox.const import DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import ATTR_ENTITY_ID, CONF_DEVICES, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -32,7 +32,7 @@ async def test_setup(
|
||||
with patch("homeassistant.components.fritzbox.PLATFORMS", [Platform.BUTTON]):
|
||||
entry = await setup_config_entry(
|
||||
hass,
|
||||
MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0],
|
||||
MOCK_CONFIG[DOMAIN][CONF_DEVICES][0],
|
||||
fritz=fritz,
|
||||
template=template,
|
||||
)
|
||||
@ -45,7 +45,7 @@ async def test_apply_template(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
"""Test if applies works."""
|
||||
template = FritzEntityBaseMock()
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], fritz=fritz, template=template
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], fritz=fritz, template=template
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
@ -58,7 +58,7 @@ async def test_discover_new_device(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
"""Test adding new discovered devices during runtime."""
|
||||
template = FritzEntityBaseMock()
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], fritz=fritz, template=template
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], fritz=fritz, template=template
|
||||
)
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
|
@ -34,7 +34,7 @@ from homeassistant.components.fritzbox.climate import (
|
||||
from homeassistant.components.fritzbox.const import (
|
||||
ATTR_STATE_HOLIDAY_MODE,
|
||||
ATTR_STATE_SUMMER_MODE,
|
||||
DOMAIN as FB_DOMAIN,
|
||||
DOMAIN,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import ATTR_ENTITY_ID, ATTR_TEMPERATURE, CONF_DEVICES, Platform
|
||||
@ -66,7 +66,7 @@ async def test_setup(
|
||||
device = FritzDeviceClimateMock()
|
||||
with patch("homeassistant.components.fritzbox.PLATFORMS", [Platform.CLIMATE]):
|
||||
entry = await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
await snapshot_platform(hass, entity_registry, snapshot, entry.entry_id)
|
||||
@ -76,7 +76,7 @@ async def test_hkr_wo_temperature_sensor(hass: HomeAssistant, fritz: Mock) -> No
|
||||
"""Test hkr without exposing dedicated temperature sensor data block."""
|
||||
device = FritzDeviceClimateWithoutTempSensorMock()
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
@ -89,7 +89,7 @@ async def test_target_temperature_on(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
device = FritzDeviceClimateMock()
|
||||
device.target_temperature = 127.0
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
@ -102,7 +102,7 @@ async def test_target_temperature_off(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
device = FritzDeviceClimateMock()
|
||||
device.target_temperature = 126.5
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
@ -114,7 +114,7 @@ async def test_update(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
"""Test update without error."""
|
||||
device = FritzDeviceClimateMock()
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
@ -145,7 +145,7 @@ async def test_automatic_offset(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
device.actual_temperature = 19
|
||||
device.target_temperature = 20
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
@ -161,7 +161,7 @@ async def test_update_error(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
device = FritzDeviceClimateMock()
|
||||
fritz().update_devices.side_effect = HTTPError("Boom")
|
||||
entry = await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
assert entry.state is ConfigEntryState.SETUP_RETRY
|
||||
|
||||
@ -214,7 +214,7 @@ async def test_set_temperature(
|
||||
device.lock = False
|
||||
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
@ -302,7 +302,7 @@ async def test_set_hvac_mode(
|
||||
device.nextchange_endperiod = 0
|
||||
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
@ -343,7 +343,7 @@ async def test_set_preset_mode_comfort(
|
||||
device.lock = False
|
||||
device.comfort_temperature = comfort_temperature
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
@ -376,7 +376,7 @@ async def test_set_preset_mode_eco(
|
||||
device.lock = False
|
||||
device.eco_temperature = eco_temperature
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
@ -398,7 +398,7 @@ async def test_set_preset_mode_boost(
|
||||
device.lock = False
|
||||
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
@ -417,7 +417,7 @@ async def test_preset_mode_update(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
device.comfort_temperature = 23
|
||||
device.eco_temperature = 20
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
@ -462,7 +462,7 @@ async def test_discover_new_device(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
"""Test adding new discovered devices during runtime."""
|
||||
device = FritzDeviceClimateMock()
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
@ -501,7 +501,7 @@ async def test_set_temperature_lock(
|
||||
|
||||
device.lock = True
|
||||
assert await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
with pytest.raises(
|
||||
@ -559,7 +559,7 @@ async def test_set_hvac_mode_lock(
|
||||
device.nextchange_endperiod = 0
|
||||
|
||||
assert await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
with pytest.raises(
|
||||
@ -582,7 +582,7 @@ async def test_holidy_summer_mode(
|
||||
device.lock = False
|
||||
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
# initial state
|
||||
|
@ -8,7 +8,7 @@ from unittest.mock import Mock
|
||||
from pyfritzhome import LoginError
|
||||
from requests.exceptions import ConnectionError, HTTPError
|
||||
|
||||
from homeassistant.components.fritzbox.const import DOMAIN as FB_DOMAIN
|
||||
from homeassistant.components.fritzbox.const import DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import CONF_DEVICES
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -26,8 +26,8 @@ async def test_coordinator_update_after_reboot(
|
||||
) -> None:
|
||||
"""Test coordinator after reboot."""
|
||||
entry = MockConfigEntry(
|
||||
domain=FB_DOMAIN,
|
||||
data=MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0],
|
||||
domain=DOMAIN,
|
||||
data=MOCK_CONFIG[DOMAIN][CONF_DEVICES][0],
|
||||
unique_id="any",
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
@ -46,8 +46,8 @@ async def test_coordinator_update_after_password_change(
|
||||
) -> None:
|
||||
"""Test coordinator after password change."""
|
||||
entry = MockConfigEntry(
|
||||
domain=FB_DOMAIN,
|
||||
data=MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0],
|
||||
domain=DOMAIN,
|
||||
data=MOCK_CONFIG[DOMAIN][CONF_DEVICES][0],
|
||||
unique_id="any",
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
@ -66,8 +66,8 @@ async def test_coordinator_update_when_unreachable(
|
||||
) -> None:
|
||||
"""Test coordinator after reboot."""
|
||||
entry = MockConfigEntry(
|
||||
domain=FB_DOMAIN,
|
||||
data=MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0],
|
||||
domain=DOMAIN,
|
||||
data=MOCK_CONFIG[DOMAIN][CONF_DEVICES][0],
|
||||
unique_id="any",
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
@ -106,8 +106,8 @@ async def test_coordinator_automatic_registry_cleanup(
|
||||
)
|
||||
]
|
||||
entry = MockConfigEntry(
|
||||
domain=FB_DOMAIN,
|
||||
data=MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0],
|
||||
domain=DOMAIN,
|
||||
data=MOCK_CONFIG[DOMAIN][CONF_DEVICES][0],
|
||||
unique_id="any",
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
|
@ -6,7 +6,7 @@ from unittest.mock import Mock, call, patch
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.cover import ATTR_POSITION, DOMAIN as COVER_DOMAIN
|
||||
from homeassistant.components.fritzbox.const import DOMAIN as FB_DOMAIN
|
||||
from homeassistant.components.fritzbox.const import DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
@ -45,7 +45,7 @@ async def test_setup(
|
||||
device = FritzDeviceCoverMock()
|
||||
with patch("homeassistant.components.fritzbox.PLATFORMS", [Platform.COVER]):
|
||||
entry = await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
assert entry.state is ConfigEntryState.LOADED
|
||||
|
||||
@ -56,7 +56,7 @@ async def test_unknown_position(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
"""Test cover with unknown position."""
|
||||
device = FritzDeviceCoverUnknownPositionMock()
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
@ -68,7 +68,7 @@ async def test_open_cover(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
"""Test opening the cover."""
|
||||
device = FritzDeviceCoverMock()
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
@ -81,7 +81,7 @@ async def test_close_cover(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
"""Test closing the device."""
|
||||
device = FritzDeviceCoverMock()
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
@ -94,7 +94,7 @@ async def test_set_position_cover(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
"""Test stopping the device."""
|
||||
device = FritzDeviceCoverMock()
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
@ -110,7 +110,7 @@ async def test_stop_cover(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
"""Test stopping the device."""
|
||||
device = FritzDeviceCoverMock()
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
@ -123,7 +123,7 @@ async def test_discover_new_device(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
"""Test adding new discovered devices during runtime."""
|
||||
device = FritzDeviceCoverMock()
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
|
@ -5,7 +5,7 @@ from __future__ import annotations
|
||||
from unittest.mock import Mock
|
||||
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
from homeassistant.components.fritzbox.const import DOMAIN as FB_DOMAIN
|
||||
from homeassistant.components.fritzbox.const import DOMAIN
|
||||
from homeassistant.components.fritzbox.diagnostics import TO_REDACT
|
||||
from homeassistant.const import CONF_DEVICES
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -21,9 +21,9 @@ async def test_entry_diagnostics(
|
||||
hass: HomeAssistant, hass_client: ClientSessionGenerator, fritz: Mock
|
||||
) -> None:
|
||||
"""Test config entry diagnostics."""
|
||||
assert await setup_config_entry(hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0])
|
||||
assert await setup_config_entry(hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0])
|
||||
|
||||
entries = hass.config_entries.async_entries(FB_DOMAIN)
|
||||
entries = hass.config_entries.async_entries(DOMAIN)
|
||||
entry_dict = entries[0].as_dict()
|
||||
for key in TO_REDACT:
|
||||
entry_dict["data"][key] = REDACTED
|
||||
|
@ -9,7 +9,7 @@ import pytest
|
||||
from requests.exceptions import ConnectionError as RequestConnectionError
|
||||
|
||||
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
|
||||
from homeassistant.components.fritzbox.const import DOMAIN as FB_DOMAIN
|
||||
from homeassistant.components.fritzbox.const import DOMAIN
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
@ -35,7 +35,7 @@ from tests.typing import WebSocketGenerator
|
||||
|
||||
async def test_setup(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
"""Test setup of integration."""
|
||||
assert await setup_config_entry(hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0])
|
||||
assert await setup_config_entry(hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0])
|
||||
entries = hass.config_entries.async_entries()
|
||||
assert entries
|
||||
assert len(entries) == 1
|
||||
@ -54,7 +54,7 @@ async def test_setup(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
(
|
||||
{
|
||||
"domain": SENSOR_DOMAIN,
|
||||
"platform": FB_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"unique_id": CONF_FAKE_AIN,
|
||||
"unit_of_measurement": UnitOfTemperature.CELSIUS,
|
||||
},
|
||||
@ -64,7 +64,7 @@ async def test_setup(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
(
|
||||
{
|
||||
"domain": BINARY_SENSOR_DOMAIN,
|
||||
"platform": FB_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"unique_id": CONF_FAKE_AIN,
|
||||
},
|
||||
CONF_FAKE_AIN,
|
||||
@ -83,8 +83,8 @@ async def test_update_unique_id(
|
||||
"""Test unique_id update of integration."""
|
||||
fritz().get_devices.return_value = [FritzDeviceSwitchMock()]
|
||||
entry = MockConfigEntry(
|
||||
domain=FB_DOMAIN,
|
||||
data=MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0],
|
||||
domain=DOMAIN,
|
||||
data=MOCK_CONFIG[DOMAIN][CONF_DEVICES][0],
|
||||
unique_id="any",
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
@ -108,7 +108,7 @@ async def test_update_unique_id(
|
||||
(
|
||||
{
|
||||
"domain": SENSOR_DOMAIN,
|
||||
"platform": FB_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"unique_id": f"{CONF_FAKE_AIN}_temperature",
|
||||
"unit_of_measurement": UnitOfTemperature.CELSIUS,
|
||||
},
|
||||
@ -117,7 +117,7 @@ async def test_update_unique_id(
|
||||
(
|
||||
{
|
||||
"domain": BINARY_SENSOR_DOMAIN,
|
||||
"platform": FB_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"unique_id": f"{CONF_FAKE_AIN}_alarm",
|
||||
},
|
||||
f"{CONF_FAKE_AIN}_alarm",
|
||||
@ -125,7 +125,7 @@ async def test_update_unique_id(
|
||||
(
|
||||
{
|
||||
"domain": BINARY_SENSOR_DOMAIN,
|
||||
"platform": FB_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"unique_id": f"{CONF_FAKE_AIN}_other",
|
||||
},
|
||||
f"{CONF_FAKE_AIN}_other",
|
||||
@ -142,8 +142,8 @@ async def test_update_unique_id_no_change(
|
||||
"""Test unique_id is not updated of integration."""
|
||||
fritz().get_devices.return_value = [FritzDeviceSwitchMock()]
|
||||
entry = MockConfigEntry(
|
||||
domain=FB_DOMAIN,
|
||||
data=MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0],
|
||||
domain=DOMAIN,
|
||||
data=MOCK_CONFIG[DOMAIN][CONF_DEVICES][0],
|
||||
unique_id="any",
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
@ -167,13 +167,13 @@ async def test_unload_remove(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
entity_id = f"{SWITCH_DOMAIN}.{CONF_FAKE_NAME}"
|
||||
|
||||
entry = MockConfigEntry(
|
||||
domain=FB_DOMAIN,
|
||||
data=MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0],
|
||||
domain=DOMAIN,
|
||||
data=MOCK_CONFIG[DOMAIN][CONF_DEVICES][0],
|
||||
unique_id=entity_id,
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
|
||||
config_entries = hass.config_entries.async_entries(FB_DOMAIN)
|
||||
config_entries = hass.config_entries.async_entries(DOMAIN)
|
||||
assert len(config_entries) == 1
|
||||
assert entry is config_entries[0]
|
||||
|
||||
@ -206,13 +206,13 @@ async def test_logout_on_stop(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
entity_id = f"{SWITCH_DOMAIN}.{CONF_FAKE_NAME}"
|
||||
|
||||
entry = MockConfigEntry(
|
||||
domain=FB_DOMAIN,
|
||||
data=MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0],
|
||||
domain=DOMAIN,
|
||||
data=MOCK_CONFIG[DOMAIN][CONF_DEVICES][0],
|
||||
unique_id=entity_id,
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
|
||||
config_entries = hass.config_entries.async_entries(FB_DOMAIN)
|
||||
config_entries = hass.config_entries.async_entries(DOMAIN)
|
||||
assert len(config_entries) == 1
|
||||
assert entry is config_entries[0]
|
||||
|
||||
@ -240,8 +240,8 @@ async def test_remove_device(
|
||||
assert await async_setup_component(hass, "config", {})
|
||||
assert await setup_config_entry(
|
||||
hass,
|
||||
MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0],
|
||||
f"{FB_DOMAIN}.{CONF_FAKE_NAME}",
|
||||
MOCK_CONFIG[DOMAIN][CONF_DEVICES][0],
|
||||
f"{DOMAIN}.{CONF_FAKE_NAME}",
|
||||
FritzDeviceSwitchMock(),
|
||||
fritz,
|
||||
)
|
||||
@ -258,7 +258,7 @@ async def test_remove_device(
|
||||
|
||||
orphan_device = device_registry.async_get_or_create(
|
||||
config_entry_id=entry.entry_id,
|
||||
identifiers={(FB_DOMAIN, "0000 000000")},
|
||||
identifiers={(DOMAIN, "0000 000000")},
|
||||
)
|
||||
|
||||
# try to delete good_device
|
||||
@ -278,8 +278,8 @@ async def test_remove_device(
|
||||
async def test_raise_config_entry_not_ready_when_offline(hass: HomeAssistant) -> None:
|
||||
"""Config entry state is SETUP_RETRY when fritzbox is offline."""
|
||||
entry = MockConfigEntry(
|
||||
domain=FB_DOMAIN,
|
||||
data={CONF_HOST: "any", **MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0]},
|
||||
domain=DOMAIN,
|
||||
data={CONF_HOST: "any", **MOCK_CONFIG[DOMAIN][CONF_DEVICES][0]},
|
||||
unique_id="any",
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
@ -299,8 +299,8 @@ async def test_raise_config_entry_not_ready_when_offline(hass: HomeAssistant) ->
|
||||
async def test_raise_config_entry_error_when_login_fail(hass: HomeAssistant) -> None:
|
||||
"""Config entry state is SETUP_ERROR when login to fritzbox fail."""
|
||||
entry = MockConfigEntry(
|
||||
domain=FB_DOMAIN,
|
||||
data={CONF_HOST: "any", **MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0]},
|
||||
domain=DOMAIN,
|
||||
data={CONF_HOST: "any", **MOCK_CONFIG[DOMAIN][CONF_DEVICES][0]},
|
||||
unique_id="any",
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
|
@ -6,11 +6,7 @@ from unittest.mock import Mock, call, patch
|
||||
from requests.exceptions import HTTPError
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.fritzbox.const import (
|
||||
COLOR_MODE,
|
||||
COLOR_TEMP_MODE,
|
||||
DOMAIN as FB_DOMAIN,
|
||||
)
|
||||
from homeassistant.components.fritzbox.const import COLOR_MODE, COLOR_TEMP_MODE, DOMAIN
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS,
|
||||
ATTR_COLOR_TEMP_KELVIN,
|
||||
@ -54,7 +50,7 @@ async def test_setup(
|
||||
|
||||
with patch("homeassistant.components.fritzbox.PLATFORMS", [Platform.LIGHT]):
|
||||
entry = await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
assert entry.state is ConfigEntryState.LOADED
|
||||
|
||||
@ -75,7 +71,7 @@ async def test_setup_non_color(
|
||||
|
||||
with patch("homeassistant.components.fritzbox.PLATFORMS", [Platform.LIGHT]):
|
||||
entry = await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
assert entry.state is ConfigEntryState.LOADED
|
||||
|
||||
@ -97,7 +93,7 @@ async def test_setup_non_color_non_level(
|
||||
|
||||
with patch("homeassistant.components.fritzbox.PLATFORMS", [Platform.LIGHT]):
|
||||
entry = await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
assert entry.state is ConfigEntryState.LOADED
|
||||
|
||||
@ -122,7 +118,7 @@ async def test_setup_color(
|
||||
|
||||
with patch("homeassistant.components.fritzbox.PLATFORMS", [Platform.LIGHT]):
|
||||
entry = await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
assert entry.state is ConfigEntryState.LOADED
|
||||
|
||||
@ -137,7 +133,7 @@ async def test_turn_on(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
"Red": [("100", "70", "10"), ("100", "50", "10"), ("100", "30", "10")]
|
||||
}
|
||||
assert await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
@ -162,7 +158,7 @@ async def test_turn_on_color(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
}
|
||||
device.fullcolorsupport = True
|
||||
assert await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
await hass.services.async_call(
|
||||
LIGHT_DOMAIN,
|
||||
@ -191,7 +187,7 @@ async def test_turn_on_color_no_fullcolorsupport(
|
||||
}
|
||||
device.fullcolorsupport = False
|
||||
assert await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
@ -216,7 +212,7 @@ async def test_turn_off(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
"Red": [("100", "70", "10"), ("100", "50", "10"), ("100", "30", "10")]
|
||||
}
|
||||
assert await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
await hass.services.async_call(
|
||||
LIGHT_DOMAIN, SERVICE_TURN_OFF, {ATTR_ENTITY_ID: ENTITY_ID}, True
|
||||
@ -232,7 +228,7 @@ async def test_update(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
"Red": [("100", "70", "10"), ("100", "50", "10"), ("100", "30", "10")]
|
||||
}
|
||||
assert await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
assert fritz().update_devices.call_count == 1
|
||||
assert fritz().login.call_count == 1
|
||||
@ -254,7 +250,7 @@ async def test_update_error(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
}
|
||||
fritz().update_devices.side_effect = HTTPError("Boom")
|
||||
entry = await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
assert entry.state is ConfigEntryState.SETUP_RETRY
|
||||
assert fritz().update_devices.call_count == 2
|
||||
@ -278,7 +274,7 @@ async def test_discover_new_device(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
device.color_mode = COLOR_TEMP_MODE
|
||||
device.color_temp = 2700
|
||||
assert await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
|
@ -8,7 +8,7 @@ from requests.exceptions import HTTPError
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.climate import PRESET_COMFORT, PRESET_ECO
|
||||
from homeassistant.components.fritzbox.const import DOMAIN as FB_DOMAIN
|
||||
from homeassistant.components.fritzbox.const import DOMAIN
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import CONF_DEVICES, STATE_UNKNOWN, Platform
|
||||
@ -53,7 +53,7 @@ async def test_setup(
|
||||
|
||||
with patch("homeassistant.components.fritzbox.PLATFORMS", [Platform.SENSOR]):
|
||||
entry = await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
assert entry.state is ConfigEntryState.LOADED
|
||||
|
||||
@ -64,7 +64,7 @@ async def test_update(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
"""Test update without error."""
|
||||
device = FritzDeviceSensorMock()
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
assert fritz().update_devices.call_count == 1
|
||||
assert fritz().login.call_count == 1
|
||||
@ -82,7 +82,7 @@ async def test_update_error(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
device = FritzDeviceSensorMock()
|
||||
fritz().update_devices.side_effect = HTTPError("Boom")
|
||||
entry = await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
assert entry.state is ConfigEntryState.SETUP_RETRY
|
||||
assert fritz().update_devices.call_count == 2
|
||||
@ -100,7 +100,7 @@ async def test_discover_new_device(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
"""Test adding new discovered devices during runtime."""
|
||||
device = FritzDeviceSensorMock()
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
state = hass.states.get(f"{ENTITY_ID}_temperature")
|
||||
@ -150,7 +150,7 @@ async def test_next_change_sensors(
|
||||
device.nextchange_temperature = next_changes[1]
|
||||
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
base_name = f"{SENSOR_DOMAIN}.{CONF_FAKE_NAME}"
|
||||
|
@ -7,7 +7,7 @@ import pytest
|
||||
from requests.exceptions import HTTPError
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.fritzbox.const import DOMAIN as FB_DOMAIN
|
||||
from homeassistant.components.fritzbox.const import DOMAIN
|
||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import (
|
||||
@ -41,7 +41,7 @@ async def test_setup(
|
||||
device = FritzDeviceSwitchMock()
|
||||
with patch("homeassistant.components.fritzbox.PLATFORMS", [Platform.SWITCH]):
|
||||
entry = await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
assert entry.state is ConfigEntryState.LOADED
|
||||
|
||||
@ -52,7 +52,7 @@ async def test_turn_on(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
"""Test turn device on."""
|
||||
device = FritzDeviceSwitchMock()
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
@ -66,7 +66,7 @@ async def test_turn_off(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
device = FritzDeviceSwitchMock()
|
||||
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
@ -82,7 +82,7 @@ async def test_toggle_while_locked(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
device.lock = True
|
||||
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
with pytest.raises(
|
||||
@ -106,7 +106,7 @@ async def test_update(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
"""Test update without error."""
|
||||
device = FritzDeviceSwitchMock()
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
assert fritz().update_devices.call_count == 1
|
||||
assert fritz().login.call_count == 1
|
||||
@ -124,7 +124,7 @@ async def test_update_error(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
device = FritzDeviceSwitchMock()
|
||||
fritz().update_devices.side_effect = HTTPError("Boom")
|
||||
entry = await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
assert entry.state is ConfigEntryState.SETUP_RETRY
|
||||
assert fritz().update_devices.call_count == 2
|
||||
@ -145,7 +145,7 @@ async def test_assume_device_unavailable(hass: HomeAssistant, fritz: Mock) -> No
|
||||
device.energy = 0
|
||||
device.power = 0
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
@ -157,7 +157,7 @@ async def test_discover_new_device(hass: HomeAssistant, fritz: Mock) -> None:
|
||||
"""Test adding new discovered devices during runtime."""
|
||||
device = FritzDeviceSwitchMock()
|
||||
await setup_config_entry(
|
||||
hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
hass, MOCK_CONFIG[DOMAIN][CONF_DEVICES][0], ENTITY_ID, device, fritz
|
||||
)
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
|
@ -7,7 +7,7 @@ from unittest.mock import AsyncMock, MagicMock, patch
|
||||
from fyta_cli.fyta_models import Credentials, Plant
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.fyta.const import CONF_EXPIRATION, DOMAIN as FYTA_DOMAIN
|
||||
from homeassistant.components.fyta.const import CONF_EXPIRATION, DOMAIN
|
||||
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_PASSWORD, CONF_USERNAME
|
||||
|
||||
from .const import ACCESS_TOKEN, EXPIRATION, PASSWORD, USERNAME
|
||||
@ -19,7 +19,7 @@ from tests.common import MockConfigEntry, load_json_object_fixture
|
||||
def mock_config_entry() -> MockConfigEntry:
|
||||
"""Mock a config entry."""
|
||||
return MockConfigEntry(
|
||||
domain=FYTA_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
title="fyta_user",
|
||||
data={
|
||||
CONF_USERNAME: USERNAME,
|
||||
@ -37,8 +37,8 @@ def mock_fyta_connector():
|
||||
"""Build a fixture for the Fyta API that connects successfully and returns one device."""
|
||||
|
||||
plants: dict[int, Plant] = {
|
||||
0: Plant.from_dict(load_json_object_fixture("plant_status1.json", FYTA_DOMAIN)),
|
||||
1: Plant.from_dict(load_json_object_fixture("plant_status2.json", FYTA_DOMAIN)),
|
||||
0: Plant.from_dict(load_json_object_fixture("plant_status1.json", DOMAIN)),
|
||||
1: Plant.from_dict(load_json_object_fixture("plant_status2.json", DOMAIN)),
|
||||
}
|
||||
|
||||
mock_fyta_connector = AsyncMock()
|
||||
|
@ -9,7 +9,7 @@ from fyta_cli.fyta_models import Plant
|
||||
import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.fyta.const import DOMAIN as FYTA_DOMAIN
|
||||
from homeassistant.components.fyta.const import DOMAIN
|
||||
from homeassistant.const import STATE_OFF, STATE_ON, STATE_UNAVAILABLE, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
@ -79,14 +79,10 @@ async def test_add_remove_entities(
|
||||
|
||||
plants: dict[int, Plant] = {
|
||||
0: Plant.from_dict(
|
||||
await async_load_json_object_fixture(
|
||||
hass, "plant_status1.json", FYTA_DOMAIN
|
||||
)
|
||||
await async_load_json_object_fixture(hass, "plant_status1.json", DOMAIN)
|
||||
),
|
||||
2: Plant.from_dict(
|
||||
await async_load_json_object_fixture(
|
||||
hass, "plant_status3.json", FYTA_DOMAIN
|
||||
)
|
||||
await async_load_json_object_fixture(hass, "plant_status3.json", DOMAIN)
|
||||
),
|
||||
}
|
||||
mock_fyta_connector.update_all_plants.return_value = plants
|
||||
|
@ -10,7 +10,7 @@ from fyta_cli.fyta_models import Plant
|
||||
import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.fyta.const import DOMAIN as FYTA_DOMAIN
|
||||
from homeassistant.components.fyta.const import DOMAIN
|
||||
from homeassistant.components.image import ImageEntity
|
||||
from homeassistant.const import STATE_UNAVAILABLE, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -84,14 +84,10 @@ async def test_add_remove_entities(
|
||||
|
||||
plants: dict[int, Plant] = {
|
||||
0: Plant.from_dict(
|
||||
await async_load_json_object_fixture(
|
||||
hass, "plant_status1.json", FYTA_DOMAIN
|
||||
)
|
||||
await async_load_json_object_fixture(hass, "plant_status1.json", DOMAIN)
|
||||
),
|
||||
2: Plant.from_dict(
|
||||
await async_load_json_object_fixture(
|
||||
hass, "plant_status3.json", FYTA_DOMAIN
|
||||
)
|
||||
await async_load_json_object_fixture(hass, "plant_status3.json", DOMAIN)
|
||||
),
|
||||
}
|
||||
mock_fyta_connector.update_all_plants.return_value = plants
|
||||
@ -130,13 +126,11 @@ async def test_update_image(
|
||||
plants: dict[int, Plant] = {
|
||||
0: Plant.from_dict(
|
||||
await async_load_json_object_fixture(
|
||||
hass, "plant_status1_update.json", FYTA_DOMAIN
|
||||
hass, "plant_status1_update.json", DOMAIN
|
||||
)
|
||||
),
|
||||
2: Plant.from_dict(
|
||||
await async_load_json_object_fixture(
|
||||
hass, "plant_status3.json", FYTA_DOMAIN
|
||||
)
|
||||
await async_load_json_object_fixture(hass, "plant_status3.json", DOMAIN)
|
||||
),
|
||||
}
|
||||
mock_fyta_connector.update_all_plants.return_value = plants
|
||||
|
@ -10,7 +10,7 @@ from fyta_cli.fyta_exceptions import (
|
||||
)
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.fyta.const import CONF_EXPIRATION, DOMAIN as FYTA_DOMAIN
|
||||
from homeassistant.components.fyta.const import CONF_EXPIRATION, DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import (
|
||||
CONF_ACCESS_TOKEN,
|
||||
@ -127,7 +127,7 @@ async def test_migrate_config_entry(
|
||||
) -> None:
|
||||
"""Test successful migration of entry data."""
|
||||
entry = MockConfigEntry(
|
||||
domain=FYTA_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
title=USERNAME,
|
||||
data={
|
||||
CONF_USERNAME: USERNAME,
|
||||
|
@ -9,7 +9,7 @@ from fyta_cli.fyta_models import Plant
|
||||
import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.fyta.const import DOMAIN as FYTA_DOMAIN
|
||||
from homeassistant.components.fyta.const import DOMAIN
|
||||
from homeassistant.const import STATE_UNAVAILABLE, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
@ -76,14 +76,10 @@ async def test_add_remove_entities(
|
||||
|
||||
plants: dict[int, Plant] = {
|
||||
0: Plant.from_dict(
|
||||
await async_load_json_object_fixture(
|
||||
hass, "plant_status1.json", FYTA_DOMAIN
|
||||
)
|
||||
await async_load_json_object_fixture(hass, "plant_status1.json", DOMAIN)
|
||||
),
|
||||
2: Plant.from_dict(
|
||||
await async_load_json_object_fixture(
|
||||
hass, "plant_status3.json", FYTA_DOMAIN
|
||||
)
|
||||
await async_load_json_object_fixture(hass, "plant_status3.json", DOMAIN)
|
||||
),
|
||||
}
|
||||
mock_fyta_connector.update_all_plants.return_value = plants
|
||||
|
@ -9,9 +9,7 @@ import voluptuous as vol
|
||||
|
||||
from homeassistant import core as ha
|
||||
from homeassistant.components import input_boolean, switch
|
||||
from homeassistant.components.generic_hygrostat import (
|
||||
DOMAIN as GENERIC_HYDROSTAT_DOMAIN,
|
||||
)
|
||||
from homeassistant.components.generic_hygrostat import DOMAIN
|
||||
from homeassistant.components.humidifier import (
|
||||
ATTR_HUMIDITY,
|
||||
DOMAIN as HUMIDIFIER_DOMAIN,
|
||||
@ -1862,7 +1860,7 @@ async def test_device_id(
|
||||
|
||||
helper_config_entry = MockConfigEntry(
|
||||
data={},
|
||||
domain=GENERIC_HYDROSTAT_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
options={
|
||||
"device_class": "humidifier",
|
||||
"dry_tolerance": 2.0,
|
||||
|
@ -2,9 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from homeassistant.components.generic_hygrostat import (
|
||||
DOMAIN as GENERIC_HYDROSTAT_DOMAIN,
|
||||
)
|
||||
from homeassistant.components.generic_hygrostat import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
||||
@ -45,7 +43,7 @@ async def test_device_cleaning(
|
||||
# Configure the configuration entry for helper
|
||||
helper_config_entry = MockConfigEntry(
|
||||
data={},
|
||||
domain=GENERIC_HYDROSTAT_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
options={
|
||||
"device_class": "humidifier",
|
||||
"dry_tolerance": 2.0,
|
||||
|
@ -21,9 +21,7 @@ from homeassistant.components.climate import (
|
||||
PRESET_SLEEP,
|
||||
HVACMode,
|
||||
)
|
||||
from homeassistant.components.generic_thermostat.const import (
|
||||
DOMAIN as GENERIC_THERMOSTAT_DOMAIN,
|
||||
)
|
||||
from homeassistant.components.generic_thermostat.const import DOMAIN
|
||||
from homeassistant.const import (
|
||||
ATTR_TEMPERATURE,
|
||||
SERVICE_RELOAD,
|
||||
@ -1492,7 +1490,7 @@ async def test_reload(hass: HomeAssistant) -> None:
|
||||
yaml_path = get_fixture_path("configuration.yaml", "generic_thermostat")
|
||||
with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path):
|
||||
await hass.services.async_call(
|
||||
GENERIC_THERMOSTAT_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_RELOAD,
|
||||
{},
|
||||
blocking=True,
|
||||
@ -1530,7 +1528,7 @@ async def test_device_id(
|
||||
|
||||
helper_config_entry = MockConfigEntry(
|
||||
data={},
|
||||
domain=GENERIC_THERMOSTAT_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
options={
|
||||
"name": "Test",
|
||||
"heater": "switch.test_source",
|
||||
|
@ -6,7 +6,7 @@ from unittest.mock import AsyncMock, Mock
|
||||
|
||||
from greeclimate.discovery import Listener
|
||||
|
||||
from homeassistant.components.gree.const import DISCOVERY_TIMEOUT, DOMAIN as GREE_DOMAIN
|
||||
from homeassistant.components.gree.const import DISCOVERY_TIMEOUT, DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
@ -93,8 +93,8 @@ def build_device_mock(name="fake-device-1", ipAddress="1.1.1.1", mac="aabbcc1122
|
||||
|
||||
async def async_setup_gree(hass: HomeAssistant) -> MockConfigEntry:
|
||||
"""Set up the gree platform."""
|
||||
entry = MockConfigEntry(domain=GREE_DOMAIN)
|
||||
entry = MockConfigEntry(domain=DOMAIN)
|
||||
entry.add_to_hass(hass)
|
||||
await async_setup_component(hass, GREE_DOMAIN, {GREE_DOMAIN: {"climate": {}}})
|
||||
await async_setup_component(hass, DOMAIN, {DOMAIN: {"climate": {}}})
|
||||
await hass.async_block_till_done()
|
||||
return entry
|
||||
|
@ -5,7 +5,7 @@ from unittest.mock import AsyncMock, patch
|
||||
import pytest
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.gree.const import DOMAIN as GREE_DOMAIN
|
||||
from homeassistant.components.gree.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
@ -24,7 +24,7 @@ async def test_creating_entry_sets_up_climate(
|
||||
return_value=FakeDiscovery(),
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
GREE_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
# Confirmation form
|
||||
@ -50,7 +50,7 @@ async def test_creating_entry_has_no_devices(
|
||||
discovery.return_value.mock_devices = []
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
GREE_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
# Confirmation form
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.gree.const import DOMAIN as GREE_DOMAIN
|
||||
from homeassistant.components.gree.const import DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
@ -12,7 +12,7 @@ from tests.common import MockConfigEntry
|
||||
|
||||
async def test_setup_simple(hass: HomeAssistant) -> None:
|
||||
"""Test gree integration is setup."""
|
||||
entry = MockConfigEntry(domain=GREE_DOMAIN)
|
||||
entry = MockConfigEntry(domain=DOMAIN)
|
||||
entry.add_to_hass(hass)
|
||||
|
||||
with (
|
||||
@ -25,7 +25,7 @@ async def test_setup_simple(hass: HomeAssistant) -> None:
|
||||
return_value=True,
|
||||
) as switch_setup,
|
||||
):
|
||||
assert await async_setup_component(hass, GREE_DOMAIN, {})
|
||||
assert await async_setup_component(hass, DOMAIN, {})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert len(climate_setup.mock_calls) == 1
|
||||
@ -39,10 +39,10 @@ async def test_setup_simple(hass: HomeAssistant) -> None:
|
||||
async def test_unload_config_entry(hass: HomeAssistant) -> None:
|
||||
"""Test that the async_unload_entry works."""
|
||||
# As we have currently no configuration, we just to pass the domain here.
|
||||
entry = MockConfigEntry(domain=GREE_DOMAIN)
|
||||
entry = MockConfigEntry(domain=DOMAIN)
|
||||
entry.add_to_hass(hass)
|
||||
|
||||
assert await async_setup_component(hass, GREE_DOMAIN, {})
|
||||
assert await async_setup_component(hass, DOMAIN, {})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -6,7 +6,7 @@ from greeclimate.exceptions import DeviceTimeoutError
|
||||
import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.gree.const import DOMAIN as GREE_DOMAIN
|
||||
from homeassistant.components.gree.const import DOMAIN
|
||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
@ -31,9 +31,9 @@ ENTITY_ID_XTRA_FAN = f"{SWITCH_DOMAIN}.fake_device_1_xtra_fan"
|
||||
|
||||
async def async_setup_gree(hass: HomeAssistant) -> MockConfigEntry:
|
||||
"""Set up the gree switch platform."""
|
||||
entry = MockConfigEntry(domain=GREE_DOMAIN)
|
||||
entry = MockConfigEntry(domain=DOMAIN)
|
||||
entry.add_to_hass(hass)
|
||||
await async_setup_component(hass, GREE_DOMAIN, {GREE_DOMAIN: {SWITCH_DOMAIN: {}}})
|
||||
await async_setup_component(hass, DOMAIN, {DOMAIN: {SWITCH_DOMAIN: {}}})
|
||||
await hass.async_block_till_done()
|
||||
return entry
|
||||
|
||||
|
@ -10,7 +10,7 @@ from unittest.mock import patch
|
||||
import pytest
|
||||
|
||||
from homeassistant import config as hass_config
|
||||
from homeassistant.components.group import DOMAIN as GROUP_DOMAIN
|
||||
from homeassistant.components.group import DOMAIN
|
||||
from homeassistant.components.group.sensor import (
|
||||
ATTR_LAST_ENTITY_ID,
|
||||
ATTR_MAX_ENTITY_ID,
|
||||
@ -77,7 +77,7 @@ async def test_sensors2(
|
||||
"""Test the sensors."""
|
||||
config = {
|
||||
SENSOR_DOMAIN: {
|
||||
"platform": GROUP_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"name": DEFAULT_NAME,
|
||||
"type": sensor_type,
|
||||
"entities": ["sensor.test_1", "sensor.test_2", "sensor.test_3"],
|
||||
@ -121,7 +121,7 @@ async def test_sensors_attributes_defined(hass: HomeAssistant) -> None:
|
||||
"""Test the sensors."""
|
||||
config = {
|
||||
SENSOR_DOMAIN: {
|
||||
"platform": GROUP_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"name": DEFAULT_NAME,
|
||||
"type": "sum",
|
||||
"entities": ["sensor.test_1", "sensor.test_2", "sensor.test_3"],
|
||||
@ -163,7 +163,7 @@ async def test_not_enough_sensor_value(hass: HomeAssistant) -> None:
|
||||
"""Test that there is nothing done if not enough values available."""
|
||||
config = {
|
||||
SENSOR_DOMAIN: {
|
||||
"platform": GROUP_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"name": "test_max",
|
||||
"type": "max",
|
||||
"ignore_non_numeric": True,
|
||||
@ -218,7 +218,7 @@ async def test_reload(hass: HomeAssistant) -> None:
|
||||
"sensor",
|
||||
{
|
||||
SENSOR_DOMAIN: {
|
||||
"platform": GROUP_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"name": "test_sensor",
|
||||
"type": "mean",
|
||||
"entities": ["sensor.test_1", "sensor.test_2"],
|
||||
@ -236,7 +236,7 @@ async def test_reload(hass: HomeAssistant) -> None:
|
||||
|
||||
with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path):
|
||||
await hass.services.async_call(
|
||||
GROUP_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_RELOAD,
|
||||
{},
|
||||
blocking=True,
|
||||
@ -255,7 +255,7 @@ async def test_sensor_incorrect_state_with_ignore_non_numeric(
|
||||
"""Test that non numeric values are ignored in a group."""
|
||||
config = {
|
||||
SENSOR_DOMAIN: {
|
||||
"platform": GROUP_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"name": "test_ignore_non_numeric",
|
||||
"type": "max",
|
||||
"ignore_non_numeric": True,
|
||||
@ -296,7 +296,7 @@ async def test_sensor_incorrect_state_with_not_ignore_non_numeric(
|
||||
"""Test that non numeric values cause a group to be unknown."""
|
||||
config = {
|
||||
SENSOR_DOMAIN: {
|
||||
"platform": GROUP_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"name": "test_failure",
|
||||
"type": "max",
|
||||
"ignore_non_numeric": False,
|
||||
@ -333,7 +333,7 @@ async def test_sensor_require_all_states(hass: HomeAssistant) -> None:
|
||||
"""Test the sum sensor with missing state require all."""
|
||||
config = {
|
||||
SENSOR_DOMAIN: {
|
||||
"platform": GROUP_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"name": "test_sum",
|
||||
"type": "sum",
|
||||
"ignore_non_numeric": False,
|
||||
@ -361,7 +361,7 @@ async def test_sensor_calculated_properties(hass: HomeAssistant) -> None:
|
||||
"""Test the sensor calculating device_class, state_class and unit of measurement."""
|
||||
config = {
|
||||
SENSOR_DOMAIN: {
|
||||
"platform": GROUP_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"name": "test_sum",
|
||||
"type": "sum",
|
||||
"entities": ["sensor.test_1", "sensor.test_2", "sensor.test_3"],
|
||||
@ -434,7 +434,7 @@ async def test_sensor_with_uoms_but_no_device_class(
|
||||
"""Test the sensor works with same uom when there is no device class."""
|
||||
config = {
|
||||
SENSOR_DOMAIN: {
|
||||
"platform": GROUP_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"name": "test_sum",
|
||||
"type": "sum",
|
||||
"entities": ["sensor.test_1", "sensor.test_2", "sensor.test_3"],
|
||||
@ -482,9 +482,7 @@ async def test_sensor_with_uoms_but_no_device_class(
|
||||
assert state.state == str(float(sum(VALUES)))
|
||||
|
||||
assert not [
|
||||
issue
|
||||
for issue in issue_registry.issues.values()
|
||||
if issue.domain == GROUP_DOMAIN
|
||||
issue for issue in issue_registry.issues.values() if issue.domain == DOMAIN
|
||||
]
|
||||
|
||||
hass.states.async_set(
|
||||
@ -531,7 +529,7 @@ async def test_sensor_calculated_properties_not_same(
|
||||
"""Test the sensor calculating device_class, state_class and unit of measurement not same."""
|
||||
config = {
|
||||
SENSOR_DOMAIN: {
|
||||
"platform": GROUP_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"name": "test_sum",
|
||||
"type": "sum",
|
||||
"entities": ["sensor.test_1", "sensor.test_2", "sensor.test_3"],
|
||||
@ -580,13 +578,13 @@ async def test_sensor_calculated_properties_not_same(
|
||||
assert state.attributes.get("unit_of_measurement") is None
|
||||
|
||||
assert issue_registry.async_get_issue(
|
||||
GROUP_DOMAIN, "sensor.test_sum_uoms_not_matching_no_device_class"
|
||||
DOMAIN, "sensor.test_sum_uoms_not_matching_no_device_class"
|
||||
)
|
||||
assert issue_registry.async_get_issue(
|
||||
GROUP_DOMAIN, "sensor.test_sum_device_classes_not_matching"
|
||||
DOMAIN, "sensor.test_sum_device_classes_not_matching"
|
||||
)
|
||||
assert issue_registry.async_get_issue(
|
||||
GROUP_DOMAIN, "sensor.test_sum_state_classes_not_matching"
|
||||
DOMAIN, "sensor.test_sum_state_classes_not_matching"
|
||||
)
|
||||
|
||||
|
||||
@ -594,7 +592,7 @@ async def test_sensor_calculated_result_fails_on_uom(hass: HomeAssistant) -> Non
|
||||
"""Test the sensor calculating fails as UoM not part of device class."""
|
||||
config = {
|
||||
SENSOR_DOMAIN: {
|
||||
"platform": GROUP_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"name": "test_sum",
|
||||
"type": "sum",
|
||||
"entities": ["sensor.test_1", "sensor.test_2", "sensor.test_3"],
|
||||
@ -667,7 +665,7 @@ async def test_sensor_calculated_properties_not_convertible_device_class(
|
||||
"""Test the sensor calculating device_class, state_class and unit of measurement when device class not convertible."""
|
||||
config = {
|
||||
SENSOR_DOMAIN: {
|
||||
"platform": GROUP_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"name": "test_sum",
|
||||
"type": "sum",
|
||||
"entities": ["sensor.test_1", "sensor.test_2", "sensor.test_3"],
|
||||
@ -748,7 +746,7 @@ async def test_last_sensor(hass: HomeAssistant) -> None:
|
||||
"""Test the last sensor."""
|
||||
config = {
|
||||
SENSOR_DOMAIN: {
|
||||
"platform": GROUP_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"name": "test_last",
|
||||
"type": "last",
|
||||
"entities": ["sensor.test_1", "sensor.test_2", "sensor.test_3"],
|
||||
@ -775,7 +773,7 @@ async def test_sensors_attributes_added_when_entity_info_available(
|
||||
"""Test the sensor calculate attributes once all entities attributes are available."""
|
||||
config = {
|
||||
SENSOR_DOMAIN: {
|
||||
"platform": GROUP_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"name": DEFAULT_NAME,
|
||||
"type": "sum",
|
||||
"entities": ["sensor.test_1", "sensor.test_2", "sensor.test_3"],
|
||||
@ -830,7 +828,7 @@ async def test_sensor_state_class_no_uom_not_available(
|
||||
|
||||
config = {
|
||||
SENSOR_DOMAIN: {
|
||||
"platform": GROUP_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"name": "test_sum",
|
||||
"type": "sum",
|
||||
"entities": ["sensor.test_1", "sensor.test_2", "sensor.test_3"],
|
||||
@ -893,7 +891,7 @@ async def test_sensor_different_attributes_ignore_non_numeric(
|
||||
"""Test the sensor handles calculating attributes when using ignore_non_numeric."""
|
||||
config = {
|
||||
SENSOR_DOMAIN: {
|
||||
"platform": GROUP_DOMAIN,
|
||||
"platform": DOMAIN,
|
||||
"name": "test_sum",
|
||||
"type": "sum",
|
||||
"ignore_non_numeric": True,
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from homeassistant.components.gstreamer import DOMAIN as GSTREAMER_DOMAIN
|
||||
from homeassistant.components.gstreamer import DOMAIN
|
||||
from homeassistant.components.media_player import DOMAIN as PLATFORM_DOMAIN
|
||||
from homeassistant.const import CONF_PLATFORM
|
||||
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
|
||||
@ -22,7 +22,7 @@ async def test_repair_issue_is_created(
|
||||
{
|
||||
PLATFORM_DOMAIN: [
|
||||
{
|
||||
CONF_PLATFORM: GSTREAMER_DOMAIN,
|
||||
CONF_PLATFORM: DOMAIN,
|
||||
}
|
||||
],
|
||||
},
|
||||
@ -30,5 +30,5 @@ async def test_repair_issue_is_created(
|
||||
await hass.async_block_till_done()
|
||||
assert (
|
||||
HOMEASSISTANT_DOMAIN,
|
||||
f"deprecated_system_packages_yaml_integration_{GSTREAMER_DOMAIN}",
|
||||
f"deprecated_system_packages_yaml_integration_{DOMAIN}",
|
||||
) in issue_registry.issues
|
||||
|
@ -6,7 +6,7 @@ from homeassistant.components.history_stats.const import (
|
||||
CONF_END,
|
||||
CONF_START,
|
||||
DEFAULT_NAME,
|
||||
DOMAIN as HISTORY_STATS_DOMAIN,
|
||||
DOMAIN,
|
||||
)
|
||||
from homeassistant.components.recorder import Recorder
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
@ -61,7 +61,7 @@ async def test_device_cleaning(
|
||||
# Configure the configuration entry for History stats
|
||||
history_stats_config_entry = MockConfigEntry(
|
||||
data={},
|
||||
domain=HISTORY_STATS_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
options={
|
||||
CONF_NAME: DEFAULT_NAME,
|
||||
CONF_ENTITY_ID: "binary_sensor.test_source",
|
||||
|
@ -10,7 +10,7 @@ from homeassistant import config, core as ha
|
||||
from homeassistant.components.homeassistant import (
|
||||
ATTR_ENTRY_ID,
|
||||
ATTR_SAFE_MODE,
|
||||
DOMAIN as HOMEASSISTANT_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_CHECK_CONFIG,
|
||||
SERVICE_HOMEASSISTANT_RESTART,
|
||||
SERVICE_HOMEASSISTANT_STOP,
|
||||
@ -669,14 +669,12 @@ async def test_deprecated_installation_issue_32bit_method(
|
||||
"arch": arch,
|
||||
},
|
||||
):
|
||||
assert await async_setup_component(hass, HOMEASSISTANT_DOMAIN, {})
|
||||
assert await async_setup_component(hass, DOMAIN, {})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert len(issue_registry.issues) == 1
|
||||
issue = issue_registry.async_get_issue(
|
||||
HOMEASSISTANT_DOMAIN, "deprecated_method_architecture"
|
||||
)
|
||||
assert issue.domain == HOMEASSISTANT_DOMAIN
|
||||
issue = issue_registry.async_get_issue(DOMAIN, "deprecated_method_architecture")
|
||||
assert issue.domain == DOMAIN
|
||||
assert issue.severity == ir.IssueSeverity.WARNING
|
||||
assert issue.translation_placeholders == {
|
||||
"installation_type": installation_type[15:],
|
||||
@ -712,14 +710,12 @@ async def test_deprecated_installation_issue_32bit(
|
||||
"arch": arch,
|
||||
},
|
||||
):
|
||||
assert await async_setup_component(hass, HOMEASSISTANT_DOMAIN, {})
|
||||
assert await async_setup_component(hass, DOMAIN, {})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert len(issue_registry.issues) == 1
|
||||
issue = issue_registry.async_get_issue(
|
||||
HOMEASSISTANT_DOMAIN, "deprecated_architecture"
|
||||
)
|
||||
assert issue.domain == HOMEASSISTANT_DOMAIN
|
||||
issue = issue_registry.async_get_issue(DOMAIN, "deprecated_architecture")
|
||||
assert issue.domain == DOMAIN
|
||||
assert issue.severity == ir.IssueSeverity.WARNING
|
||||
assert issue.translation_placeholders == {
|
||||
"installation_type": installation_type[15:],
|
||||
@ -747,12 +743,12 @@ async def test_deprecated_installation_issue_method(
|
||||
"arch": "generic-x86-64",
|
||||
},
|
||||
):
|
||||
assert await async_setup_component(hass, HOMEASSISTANT_DOMAIN, {})
|
||||
assert await async_setup_component(hass, DOMAIN, {})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert len(issue_registry.issues) == 1
|
||||
issue = issue_registry.async_get_issue(HOMEASSISTANT_DOMAIN, "deprecated_method")
|
||||
assert issue.domain == HOMEASSISTANT_DOMAIN
|
||||
issue = issue_registry.async_get_issue(DOMAIN, "deprecated_method")
|
||||
assert issue.domain == DOMAIN
|
||||
assert issue.severity == ir.IssueSeverity.WARNING
|
||||
assert issue.translation_placeholders == {
|
||||
"installation_type": installation_type[15:],
|
||||
@ -789,12 +785,12 @@ async def test_deprecated_installation_issue_aarch64(
|
||||
"homeassistant.components.hassio.get_os_info", return_value={"board": board}
|
||||
),
|
||||
):
|
||||
assert await async_setup_component(hass, HOMEASSISTANT_DOMAIN, {})
|
||||
assert await async_setup_component(hass, DOMAIN, {})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert len(issue_registry.issues) == 1
|
||||
issue = issue_registry.async_get_issue(HOMEASSISTANT_DOMAIN, issue_id)
|
||||
assert issue.domain == HOMEASSISTANT_DOMAIN
|
||||
issue = issue_registry.async_get_issue(DOMAIN, issue_id)
|
||||
assert issue.domain == DOMAIN
|
||||
assert issue.severity == ir.IssueSeverity.WARNING
|
||||
assert issue.translation_placeholders == {
|
||||
"installation_guide": "https://www.home-assistant.io/installation/",
|
||||
@ -813,12 +809,10 @@ async def test_deprecated_installation_issue_armv7_container(
|
||||
"arch": "armv7",
|
||||
},
|
||||
):
|
||||
assert await async_setup_component(hass, HOMEASSISTANT_DOMAIN, {})
|
||||
assert await async_setup_component(hass, DOMAIN, {})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert len(issue_registry.issues) == 1
|
||||
issue = issue_registry.async_get_issue(
|
||||
HOMEASSISTANT_DOMAIN, "deprecated_container_armv7"
|
||||
)
|
||||
assert issue.domain == HOMEASSISTANT_DOMAIN
|
||||
issue = issue_registry.async_get_issue(DOMAIN, "deprecated_container_armv7")
|
||||
assert issue.domain == DOMAIN
|
||||
assert issue.severity == ir.IssueSeverity.WARNING
|
||||
|
@ -7,7 +7,7 @@ import pytest
|
||||
from homeassistant.components.homekit.const import (
|
||||
ATTR_DISPLAY_NAME,
|
||||
ATTR_VALUE,
|
||||
DOMAIN as DOMAIN_HOMEKIT,
|
||||
DOMAIN,
|
||||
EVENT_HOMEKIT_CHANGED,
|
||||
)
|
||||
from homeassistant.config_entries import SOURCE_ZEROCONF, ConfigEntryState
|
||||
@ -60,12 +60,12 @@ async def test_humanify_homekit_changed_event(hass: HomeAssistant, hk_driver) ->
|
||||
)
|
||||
|
||||
assert event1["name"] == "HomeKit"
|
||||
assert event1["domain"] == DOMAIN_HOMEKIT
|
||||
assert event1["domain"] == DOMAIN
|
||||
assert event1["message"] == "send command lock for Front Door"
|
||||
assert event1["entity_id"] == "lock.front_door"
|
||||
|
||||
assert event2["name"] == "HomeKit"
|
||||
assert event2["domain"] == DOMAIN_HOMEKIT
|
||||
assert event2["domain"] == DOMAIN
|
||||
assert event2["message"] == "send command set_cover_position to 75 for Window"
|
||||
assert event2["entity_id"] == "cover.window"
|
||||
|
||||
@ -92,7 +92,7 @@ async def test_bridge_with_triggers(
|
||||
device_id = entry.device_id
|
||||
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN_HOMEKIT,
|
||||
domain=DOMAIN,
|
||||
source=SOURCE_ZEROCONF,
|
||||
data={
|
||||
"name": "HASS Bridge",
|
||||
|
@ -9,7 +9,7 @@ from homematicip.connection.rest_connection import RestConnection
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.homematicip_cloud import (
|
||||
DOMAIN as HMIPC_DOMAIN,
|
||||
DOMAIN,
|
||||
async_setup as hmip_async_setup,
|
||||
)
|
||||
from homeassistant.components.homematicip_cloud.const import (
|
||||
@ -53,7 +53,7 @@ def hmip_config_entry_fixture() -> MockConfigEntry:
|
||||
}
|
||||
return MockConfigEntry(
|
||||
version=1,
|
||||
domain=HMIPC_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
title="Home Test SN",
|
||||
unique_id=HAPID,
|
||||
data=entry_data,
|
||||
@ -80,7 +80,7 @@ def hmip_config_fixture() -> ConfigType:
|
||||
HMIPC_PIN: HAPPIN,
|
||||
}
|
||||
|
||||
return {HMIPC_DOMAIN: [entry_data]}
|
||||
return {DOMAIN: [entry_data]}
|
||||
|
||||
|
||||
@pytest.fixture(name="dummy_config")
|
||||
@ -97,7 +97,7 @@ async def mock_hap_with_service_fixture(
|
||||
mock_hap = await default_mock_hap_factory.async_get_mock_hap()
|
||||
await hmip_async_setup(hass, dummy_config)
|
||||
await hass.async_block_till_done()
|
||||
entry = hass.config_entries.async_entries(HMIPC_DOMAIN)[0]
|
||||
entry = hass.config_entries.async_entries(DOMAIN)[0]
|
||||
entry.runtime_data = mock_hap
|
||||
return mock_hap
|
||||
|
||||
|
@ -15,7 +15,7 @@ from homematicip.device import Device
|
||||
from homematicip.group import Group
|
||||
from homematicip.home import Home
|
||||
|
||||
from homeassistant.components.homematicip_cloud import DOMAIN as HMIPC_DOMAIN
|
||||
from homeassistant.components.homematicip_cloud import DOMAIN
|
||||
from homeassistant.components.homematicip_cloud.entity import (
|
||||
ATTR_IS_GROUP,
|
||||
ATTR_MODEL_TYPE,
|
||||
@ -116,7 +116,7 @@ class HomeFactory:
|
||||
"homeassistant.components.homematicip_cloud.hap.HomematicipHAP.get_hap",
|
||||
return_value=mock_home,
|
||||
):
|
||||
assert await async_setup_component(self.hass, HMIPC_DOMAIN, {})
|
||||
assert await async_setup_component(self.hass, DOMAIN, {})
|
||||
|
||||
await self.hass.async_block_till_done()
|
||||
|
||||
|
@ -18,7 +18,7 @@ from homeassistant.components.climate import (
|
||||
HVACAction,
|
||||
HVACMode,
|
||||
)
|
||||
from homeassistant.components.homematicip_cloud import DOMAIN as HMIPC_DOMAIN
|
||||
from homeassistant.components.homematicip_cloud import DOMAIN
|
||||
from homeassistant.components.homematicip_cloud.climate import (
|
||||
ATTR_PRESET_END_TIME,
|
||||
PERMANENT_END_TIME,
|
||||
@ -617,7 +617,7 @@ async def test_hmip_climate_services(
|
||||
{"accesspoint_id": not_existing_hap_id},
|
||||
blocking=True,
|
||||
)
|
||||
assert excinfo.value.translation_domain == HMIPC_DOMAIN
|
||||
assert excinfo.value.translation_domain == DOMAIN
|
||||
assert excinfo.value.translation_key == "access_point_not_found"
|
||||
# There is no further call on connection.
|
||||
assert len(home._connection.mock_calls) == 10
|
||||
@ -665,7 +665,7 @@ async def test_hmip_set_home_cooling_mode(
|
||||
{"accesspoint_id": not_existing_hap_id, "cooling": True},
|
||||
blocking=True,
|
||||
)
|
||||
assert excinfo.value.translation_domain == HMIPC_DOMAIN
|
||||
assert excinfo.value.translation_domain == DOMAIN
|
||||
assert excinfo.value.translation_key == "access_point_not_found"
|
||||
# There is no further call on connection.
|
||||
assert len(home._connection.mock_calls) == 3
|
||||
|
@ -4,7 +4,7 @@ from unittest.mock import patch
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.homematicip_cloud.const import (
|
||||
DOMAIN as HMIPC_DOMAIN,
|
||||
DOMAIN,
|
||||
HMIPC_AUTHTOKEN,
|
||||
HMIPC_HAPID,
|
||||
HMIPC_NAME,
|
||||
@ -34,7 +34,7 @@ async def test_flow_works(hass: HomeAssistant, simple_mock_home) -> None:
|
||||
),
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
HMIPC_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_USER},
|
||||
data=DEFAULT_CONFIG,
|
||||
)
|
||||
@ -84,7 +84,7 @@ async def test_flow_init_connection_error(hass: HomeAssistant) -> None:
|
||||
return_value=False,
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
HMIPC_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_USER},
|
||||
data=DEFAULT_CONFIG,
|
||||
)
|
||||
@ -110,7 +110,7 @@ async def test_flow_link_connection_error(hass: HomeAssistant) -> None:
|
||||
),
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
HMIPC_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_USER},
|
||||
data=DEFAULT_CONFIG,
|
||||
)
|
||||
@ -132,7 +132,7 @@ async def test_flow_link_press_button(hass: HomeAssistant) -> None:
|
||||
),
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
HMIPC_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_USER},
|
||||
data=DEFAULT_CONFIG,
|
||||
)
|
||||
@ -146,7 +146,7 @@ async def test_init_flow_show_form(hass: HomeAssistant) -> None:
|
||||
"""Test config flow shows up with a form."""
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
HMIPC_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
@ -154,13 +154,13 @@ async def test_init_flow_show_form(hass: HomeAssistant) -> None:
|
||||
|
||||
async def test_init_already_configured(hass: HomeAssistant) -> None:
|
||||
"""Test accesspoint is already configured."""
|
||||
MockConfigEntry(domain=HMIPC_DOMAIN, unique_id="ABC123").add_to_hass(hass)
|
||||
MockConfigEntry(domain=DOMAIN, unique_id="ABC123").add_to_hass(hass)
|
||||
with patch(
|
||||
"homeassistant.components.homematicip_cloud.hap.HomematicipAuth.async_checkbutton",
|
||||
return_value=True,
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
HMIPC_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_USER},
|
||||
data=DEFAULT_CONFIG,
|
||||
)
|
||||
@ -189,7 +189,7 @@ async def test_import_config(hass: HomeAssistant, simple_mock_home) -> None:
|
||||
),
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
HMIPC_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_IMPORT},
|
||||
data=IMPORT_CONFIG,
|
||||
)
|
||||
@ -202,7 +202,7 @@ async def test_import_config(hass: HomeAssistant, simple_mock_home) -> None:
|
||||
|
||||
async def test_import_existing_config(hass: HomeAssistant) -> None:
|
||||
"""Test abort of an existing accesspoint from config."""
|
||||
MockConfigEntry(domain=HMIPC_DOMAIN, unique_id="ABC123").add_to_hass(hass)
|
||||
MockConfigEntry(domain=DOMAIN, unique_id="ABC123").add_to_hass(hass)
|
||||
with (
|
||||
patch(
|
||||
"homeassistant.components.homematicip_cloud.hap.HomematicipAuth.async_checkbutton",
|
||||
@ -218,7 +218,7 @@ async def test_import_existing_config(hass: HomeAssistant) -> None:
|
||||
),
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
HMIPC_DOMAIN,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_IMPORT},
|
||||
data=IMPORT_CONFIG,
|
||||
)
|
||||
|
@ -7,7 +7,7 @@ from homematicip.connection.connection_context import ConnectionContext
|
||||
from homematicip.exceptions.connection_exceptions import HmipConnectionError
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.homematicip_cloud import DOMAIN as HMIPC_DOMAIN
|
||||
from homeassistant.components.homematicip_cloud import DOMAIN
|
||||
from homeassistant.components.homematicip_cloud.const import (
|
||||
HMIPC_AUTHTOKEN,
|
||||
HMIPC_HAPID,
|
||||
@ -83,7 +83,7 @@ async def test_hap_setup_works(hass: HomeAssistant) -> None:
|
||||
"""Test a successful setup of a accesspoint."""
|
||||
# This test should not be accessing the integration internals
|
||||
entry = MockConfigEntry(
|
||||
domain=HMIPC_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
data={HMIPC_HAPID: "ABC123", HMIPC_AUTHTOKEN: "123", HMIPC_NAME: "hmip"},
|
||||
)
|
||||
home = Mock()
|
||||
@ -99,7 +99,7 @@ async def test_hap_setup_connection_error() -> None:
|
||||
"""Test a failed accesspoint setup."""
|
||||
hass = Mock()
|
||||
entry = MockConfigEntry(
|
||||
domain=HMIPC_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
data={HMIPC_HAPID: "ABC123", HMIPC_AUTHTOKEN: "123", HMIPC_NAME: "hmip"},
|
||||
)
|
||||
hap = HomematicipHAP(hass, entry)
|
||||
@ -119,7 +119,7 @@ async def test_hap_reset_unloads_entry_if_setup(
|
||||
) -> None:
|
||||
"""Test calling reset while the entry has been setup."""
|
||||
mock_hap = await default_mock_hap_factory.async_get_mock_hap()
|
||||
config_entries = hass.config_entries.async_entries(HMIPC_DOMAIN)
|
||||
config_entries = hass.config_entries.async_entries(DOMAIN)
|
||||
assert len(config_entries) == 1
|
||||
assert config_entries[0].runtime_data == mock_hap
|
||||
# hap_reset is called during unload
|
||||
@ -132,7 +132,7 @@ async def test_hap_create(
|
||||
hass: HomeAssistant, hmip_config_entry: MockConfigEntry, simple_mock_home
|
||||
) -> None:
|
||||
"""Mock AsyncHome to execute get_hap."""
|
||||
hass.config.components.add(HMIPC_DOMAIN)
|
||||
hass.config.components.add(DOMAIN)
|
||||
hap = HomematicipHAP(hass, hmip_config_entry)
|
||||
assert hap
|
||||
with (
|
||||
@ -150,7 +150,7 @@ async def test_hap_create_exception(
|
||||
hass: HomeAssistant, hmip_config_entry: MockConfigEntry, mock_connection_init
|
||||
) -> None:
|
||||
"""Mock AsyncHome to execute get_hap."""
|
||||
hass.config.components.add(HMIPC_DOMAIN)
|
||||
hass.config.components.add(DOMAIN)
|
||||
|
||||
hap = HomematicipHAP(hass, hmip_config_entry)
|
||||
assert hap
|
||||
|
@ -8,7 +8,7 @@ from homematicip.exceptions.connection_exceptions import HmipConnectionError
|
||||
from homeassistant.components.homematicip_cloud.const import (
|
||||
CONF_ACCESSPOINT,
|
||||
CONF_AUTHTOKEN,
|
||||
DOMAIN as HMIPC_DOMAIN,
|
||||
DOMAIN,
|
||||
HMIPC_AUTHTOKEN,
|
||||
HMIPC_HAPID,
|
||||
HMIPC_NAME,
|
||||
@ -33,17 +33,15 @@ async def test_config_with_accesspoint_passed_to_config_entry(
|
||||
CONF_NAME: "name",
|
||||
}
|
||||
# no config_entry exists
|
||||
assert len(hass.config_entries.async_entries(HMIPC_DOMAIN)) == 0
|
||||
assert len(hass.config_entries.async_entries(DOMAIN)) == 0
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.homematicip_cloud.hap.HomematicipHAP.async_connect",
|
||||
):
|
||||
assert await async_setup_component(
|
||||
hass, HMIPC_DOMAIN, {HMIPC_DOMAIN: entry_config}
|
||||
)
|
||||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: entry_config})
|
||||
|
||||
# config_entry created for access point
|
||||
config_entries = hass.config_entries.async_entries(HMIPC_DOMAIN)
|
||||
config_entries = hass.config_entries.async_entries(DOMAIN)
|
||||
assert len(config_entries) == 1
|
||||
assert config_entries[0].data == {
|
||||
"authtoken": "123",
|
||||
@ -60,10 +58,10 @@ async def test_config_already_registered_not_passed_to_config_entry(
|
||||
"""Test that an already registered accesspoint does not get imported."""
|
||||
|
||||
mock_config = {HMIPC_AUTHTOKEN: "123", HMIPC_HAPID: "ABC123", HMIPC_NAME: "name"}
|
||||
MockConfigEntry(domain=HMIPC_DOMAIN, data=mock_config).add_to_hass(hass)
|
||||
MockConfigEntry(domain=DOMAIN, data=mock_config).add_to_hass(hass)
|
||||
|
||||
# one config_entry exists
|
||||
config_entries = hass.config_entries.async_entries(HMIPC_DOMAIN)
|
||||
config_entries = hass.config_entries.async_entries(DOMAIN)
|
||||
assert len(config_entries) == 1
|
||||
assert config_entries[0].data == {
|
||||
"authtoken": "123",
|
||||
@ -82,12 +80,10 @@ async def test_config_already_registered_not_passed_to_config_entry(
|
||||
with patch(
|
||||
"homeassistant.components.homematicip_cloud.hap.HomematicipHAP.async_connect",
|
||||
):
|
||||
assert await async_setup_component(
|
||||
hass, HMIPC_DOMAIN, {HMIPC_DOMAIN: entry_config}
|
||||
)
|
||||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: entry_config})
|
||||
|
||||
# no new config_entry created / still one config_entry
|
||||
config_entries = hass.config_entries.async_entries(HMIPC_DOMAIN)
|
||||
config_entries = hass.config_entries.async_entries(DOMAIN)
|
||||
assert len(config_entries) == 1
|
||||
assert config_entries[0].data == {
|
||||
"authtoken": "123",
|
||||
@ -114,7 +110,7 @@ async def test_load_entry_fails_due_to_connection_error(
|
||||
return_value=ConnectionContext(),
|
||||
),
|
||||
):
|
||||
assert await async_setup_component(hass, HMIPC_DOMAIN, {})
|
||||
assert await async_setup_component(hass, DOMAIN, {})
|
||||
|
||||
assert hmip_config_entry.runtime_data
|
||||
assert hmip_config_entry.state is ConfigEntryState.SETUP_RETRY
|
||||
@ -132,7 +128,7 @@ async def test_load_entry_fails_due_to_generic_exception(
|
||||
side_effect=Exception,
|
||||
),
|
||||
):
|
||||
assert await async_setup_component(hass, HMIPC_DOMAIN, {})
|
||||
assert await async_setup_component(hass, DOMAIN, {})
|
||||
|
||||
assert hmip_config_entry.runtime_data
|
||||
assert hmip_config_entry.state is ConfigEntryState.SETUP_ERROR
|
||||
@ -141,7 +137,7 @@ async def test_load_entry_fails_due_to_generic_exception(
|
||||
async def test_unload_entry(hass: HomeAssistant) -> None:
|
||||
"""Test being able to unload an entry."""
|
||||
mock_config = {HMIPC_AUTHTOKEN: "123", HMIPC_HAPID: "ABC123", HMIPC_NAME: "name"}
|
||||
MockConfigEntry(domain=HMIPC_DOMAIN, data=mock_config).add_to_hass(hass)
|
||||
MockConfigEntry(domain=DOMAIN, data=mock_config).add_to_hass(hass)
|
||||
|
||||
with patch("homeassistant.components.homematicip_cloud.HomematicipHAP") as mock_hap:
|
||||
instance = mock_hap.return_value
|
||||
@ -153,11 +149,11 @@ async def test_unload_entry(hass: HomeAssistant) -> None:
|
||||
instance.home.currentAPVersion = "mock-ap-version"
|
||||
instance.async_reset = AsyncMock(return_value=True)
|
||||
|
||||
assert await async_setup_component(hass, HMIPC_DOMAIN, {})
|
||||
assert await async_setup_component(hass, DOMAIN, {})
|
||||
|
||||
assert mock_hap.return_value.mock_calls[0][0] == "async_setup"
|
||||
|
||||
config_entries = hass.config_entries.async_entries(HMIPC_DOMAIN)
|
||||
config_entries = hass.config_entries.async_entries(DOMAIN)
|
||||
assert len(config_entries) == 1
|
||||
assert config_entries[0].runtime_data
|
||||
assert config_entries[0].state is ConfigEntryState.LOADED
|
||||
@ -183,7 +179,7 @@ async def test_hmip_dump_hap_config_services(
|
||||
async def test_setup_services_and_unload_services(hass: HomeAssistant) -> None:
|
||||
"""Test setup services and unload services."""
|
||||
mock_config = {HMIPC_AUTHTOKEN: "123", HMIPC_HAPID: "ABC123", HMIPC_NAME: "name"}
|
||||
MockConfigEntry(domain=HMIPC_DOMAIN, data=mock_config).add_to_hass(hass)
|
||||
MockConfigEntry(domain=DOMAIN, data=mock_config).add_to_hass(hass)
|
||||
|
||||
with patch("homeassistant.components.homematicip_cloud.HomematicipHAP") as mock_hap:
|
||||
instance = mock_hap.return_value
|
||||
@ -195,18 +191,18 @@ async def test_setup_services_and_unload_services(hass: HomeAssistant) -> None:
|
||||
instance.home.currentAPVersion = "mock-ap-version"
|
||||
instance.async_reset = AsyncMock(return_value=True)
|
||||
|
||||
assert await async_setup_component(hass, HMIPC_DOMAIN, {})
|
||||
assert await async_setup_component(hass, DOMAIN, {})
|
||||
|
||||
# Check services are created
|
||||
hmipc_services = hass.services.async_services()[HMIPC_DOMAIN]
|
||||
hmipc_services = hass.services.async_services()[DOMAIN]
|
||||
assert len(hmipc_services) == 9
|
||||
|
||||
config_entries = hass.config_entries.async_entries(HMIPC_DOMAIN)
|
||||
config_entries = hass.config_entries.async_entries(DOMAIN)
|
||||
assert len(config_entries) == 1
|
||||
|
||||
await hass.config_entries.async_unload(config_entries[0].entry_id)
|
||||
# Check services are removed
|
||||
assert not hass.services.async_services().get(HMIPC_DOMAIN)
|
||||
assert not hass.services.async_services().get(DOMAIN)
|
||||
|
||||
|
||||
async def test_setup_two_haps_unload_one_by_one(hass: HomeAssistant) -> None:
|
||||
@ -214,10 +210,10 @@ async def test_setup_two_haps_unload_one_by_one(hass: HomeAssistant) -> None:
|
||||
|
||||
# Setup AP1
|
||||
mock_config = {HMIPC_AUTHTOKEN: "123", HMIPC_HAPID: "ABC123", HMIPC_NAME: "name"}
|
||||
MockConfigEntry(domain=HMIPC_DOMAIN, data=mock_config).add_to_hass(hass)
|
||||
MockConfigEntry(domain=DOMAIN, data=mock_config).add_to_hass(hass)
|
||||
# Setup AP2
|
||||
mock_config2 = {HMIPC_AUTHTOKEN: "123", HMIPC_HAPID: "ABC1234", HMIPC_NAME: "name2"}
|
||||
MockConfigEntry(domain=HMIPC_DOMAIN, data=mock_config2).add_to_hass(hass)
|
||||
MockConfigEntry(domain=DOMAIN, data=mock_config2).add_to_hass(hass)
|
||||
|
||||
with patch("homeassistant.components.homematicip_cloud.HomematicipHAP") as mock_hap:
|
||||
instance = mock_hap.return_value
|
||||
@ -229,22 +225,22 @@ async def test_setup_two_haps_unload_one_by_one(hass: HomeAssistant) -> None:
|
||||
instance.home.currentAPVersion = "mock-ap-version"
|
||||
instance.async_reset = AsyncMock(return_value=True)
|
||||
|
||||
assert await async_setup_component(hass, HMIPC_DOMAIN, {})
|
||||
assert await async_setup_component(hass, DOMAIN, {})
|
||||
|
||||
hmipc_services = hass.services.async_services()[HMIPC_DOMAIN]
|
||||
hmipc_services = hass.services.async_services()[DOMAIN]
|
||||
assert len(hmipc_services) == 9
|
||||
|
||||
config_entries = hass.config_entries.async_entries(HMIPC_DOMAIN)
|
||||
config_entries = hass.config_entries.async_entries(DOMAIN)
|
||||
assert len(config_entries) == 2
|
||||
# unload the first AP
|
||||
await hass.config_entries.async_unload(config_entries[0].entry_id)
|
||||
|
||||
# services still exists
|
||||
hmipc_services = hass.services.async_services()[HMIPC_DOMAIN]
|
||||
hmipc_services = hass.services.async_services()[DOMAIN]
|
||||
assert len(hmipc_services) == 9
|
||||
|
||||
# unload the second AP
|
||||
await hass.config_entries.async_unload(config_entries[1].entry_id)
|
||||
|
||||
# Check services are removed
|
||||
assert not hass.services.async_services().get(HMIPC_DOMAIN)
|
||||
assert not hass.services.async_services().get(DOMAIN)
|
||||
|
@ -6,7 +6,7 @@ import pytest
|
||||
|
||||
from homeassistant.components.humidifier import (
|
||||
ATTR_HUMIDITY,
|
||||
DOMAIN as HUMIDIFIER_DOMAIN,
|
||||
DOMAIN,
|
||||
MODE_ECO,
|
||||
MODE_NORMAL,
|
||||
SERVICE_SET_HUMIDITY,
|
||||
@ -77,7 +77,7 @@ async def test_humidity_validation(
|
||||
)
|
||||
|
||||
setup_test_component_platform(
|
||||
hass, HUMIDIFIER_DOMAIN, entities=[test_humidifier], from_config_entry=True
|
||||
hass, DOMAIN, entities=[test_humidifier], from_config_entry=True
|
||||
)
|
||||
await hass.config_entries.async_setup(register_test_integration.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
@ -90,7 +90,7 @@ async def test_humidity_validation(
|
||||
match="Provided humidity 1 is not valid. Accepted range is 50 to 60",
|
||||
) as exc:
|
||||
await hass.services.async_call(
|
||||
HUMIDIFIER_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_SET_HUMIDITY,
|
||||
{
|
||||
"entity_id": "humidifier.test",
|
||||
@ -107,7 +107,7 @@ async def test_humidity_validation(
|
||||
match="Provided humidity 70 is not valid. Accepted range is 50 to 60",
|
||||
) as exc:
|
||||
await hass.services.async_call(
|
||||
HUMIDIFIER_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_SET_HUMIDITY,
|
||||
{
|
||||
"entity_id": "humidifier.test",
|
||||
|
@ -14,16 +14,16 @@ async def test_repair_issue_is_created(
|
||||
) -> None:
|
||||
"""Test repair issue is created."""
|
||||
from homeassistant.components.keyboard import ( # pylint:disable=import-outside-toplevel
|
||||
DOMAIN as KEYBOARD_DOMAIN,
|
||||
DOMAIN,
|
||||
)
|
||||
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
KEYBOARD_DOMAIN,
|
||||
{KEYBOARD_DOMAIN: {}},
|
||||
DOMAIN,
|
||||
{DOMAIN: {}},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert (
|
||||
HOMEASSISTANT_DOMAIN,
|
||||
f"deprecated_system_packages_yaml_integration_{KEYBOARD_DOMAIN}",
|
||||
f"deprecated_system_packages_yaml_integration_{DOMAIN}",
|
||||
) in issue_registry.issues
|
||||
|
@ -26,7 +26,7 @@ from homeassistant.components.knx.const import (
|
||||
CONF_KNX_RATE_LIMIT,
|
||||
CONF_KNX_STATE_UPDATER,
|
||||
DEFAULT_ROUTING_IA,
|
||||
DOMAIN as KNX_DOMAIN,
|
||||
DOMAIN,
|
||||
)
|
||||
from homeassistant.components.knx.project import STORAGE_KEY as KNX_PROJECT_STORAGE_KEY
|
||||
from homeassistant.components.knx.storage.config_store import (
|
||||
@ -47,7 +47,7 @@ from tests.common import (
|
||||
)
|
||||
from tests.typing import WebSocketGenerator
|
||||
|
||||
FIXTURE_PROJECT_DATA = load_json_object_fixture("project.json", KNX_DOMAIN)
|
||||
FIXTURE_PROJECT_DATA = load_json_object_fixture("project.json", DOMAIN)
|
||||
|
||||
|
||||
class KNXTestKit:
|
||||
@ -117,19 +117,19 @@ class KNXTestKit:
|
||||
self.hass_storage[
|
||||
KNX_CONFIG_STORAGE_KEY
|
||||
] = await async_load_json_object_fixture(
|
||||
self.hass, config_store_fixture, KNX_DOMAIN
|
||||
self.hass, config_store_fixture, DOMAIN
|
||||
)
|
||||
|
||||
if add_entry_to_hass:
|
||||
self.mock_config_entry.add_to_hass(self.hass)
|
||||
|
||||
knx_config = {KNX_DOMAIN: yaml_config or {}}
|
||||
knx_config = {DOMAIN: yaml_config or {}}
|
||||
with patch(
|
||||
"xknx.xknx.knx_interface_factory",
|
||||
return_value=knx_ip_interface_mock(),
|
||||
side_effect=fish_xknx,
|
||||
):
|
||||
await async_setup_component(self.hass, KNX_DOMAIN, knx_config)
|
||||
await async_setup_component(self.hass, DOMAIN, knx_config)
|
||||
await self.hass.async_block_till_done()
|
||||
|
||||
########################
|
||||
@ -313,7 +313,7 @@ def mock_config_entry() -> MockConfigEntry:
|
||||
"""Return the default mocked config entry."""
|
||||
return MockConfigEntry(
|
||||
title="KNX",
|
||||
domain=KNX_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
data={
|
||||
CONF_KNX_CONNECTION_TYPE: CONF_KNX_AUTOMATIC,
|
||||
CONF_KNX_RATE_LIMIT: CONF_KNX_DEFAULT_RATE_LIMIT,
|
||||
|
@ -21,7 +21,7 @@ from homeassistant.components.knx.const import (
|
||||
CONF_KNX_SECURE_USER_PASSWORD,
|
||||
CONF_KNX_STATE_UPDATER,
|
||||
DEFAULT_ROUTING_IA,
|
||||
DOMAIN as KNX_DOMAIN,
|
||||
DOMAIN,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
@ -84,7 +84,7 @@ async def test_diagnostic_redact(
|
||||
"""Test diagnostics redacting data."""
|
||||
mock_config_entry: MockConfigEntry = MockConfigEntry(
|
||||
title="KNX",
|
||||
domain=KNX_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
data={
|
||||
CONF_KNX_CONNECTION_TYPE: CONF_KNX_AUTOMATIC,
|
||||
CONF_KNX_RATE_LIMIT: CONF_KNX_DEFAULT_RATE_LIMIT,
|
||||
|
@ -41,7 +41,7 @@ from homeassistant.components.knx.const import (
|
||||
CONF_KNX_TUNNELING,
|
||||
CONF_KNX_TUNNELING_TCP,
|
||||
CONF_KNX_TUNNELING_TCP_SECURE,
|
||||
DOMAIN as KNX_DOMAIN,
|
||||
DOMAIN,
|
||||
KNXConfigEntryData,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
@ -222,17 +222,15 @@ async def test_init_connection_handling(
|
||||
|
||||
config_entry = MockConfigEntry(
|
||||
title="KNX",
|
||||
domain=KNX_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
data=config_entry_data,
|
||||
)
|
||||
knx.mock_config_entry = config_entry
|
||||
await knx.setup_integration()
|
||||
|
||||
assert hass.data.get(KNX_DOMAIN) is not None
|
||||
assert hass.data.get(DOMAIN) is not None
|
||||
|
||||
original_connection_config = (
|
||||
hass.data[KNX_DOMAIN].connection_config().__dict__.copy()
|
||||
)
|
||||
original_connection_config = hass.data[DOMAIN].connection_config().__dict__.copy()
|
||||
del original_connection_config["secure_config"]
|
||||
|
||||
connection_config_dict = connection_config.__dict__.copy()
|
||||
@ -242,19 +240,19 @@ async def test_init_connection_handling(
|
||||
|
||||
if connection_config.secure_config is not None:
|
||||
assert (
|
||||
hass.data[KNX_DOMAIN].connection_config().secure_config.knxkeys_password
|
||||
hass.data[DOMAIN].connection_config().secure_config.knxkeys_password
|
||||
== connection_config.secure_config.knxkeys_password
|
||||
)
|
||||
assert (
|
||||
hass.data[KNX_DOMAIN].connection_config().secure_config.user_password
|
||||
hass.data[DOMAIN].connection_config().secure_config.user_password
|
||||
== connection_config.secure_config.user_password
|
||||
)
|
||||
assert (
|
||||
hass.data[KNX_DOMAIN].connection_config().secure_config.user_id
|
||||
hass.data[DOMAIN].connection_config().secure_config.user_id
|
||||
== connection_config.secure_config.user_id
|
||||
)
|
||||
assert (
|
||||
hass.data[KNX_DOMAIN]
|
||||
hass.data[DOMAIN]
|
||||
.connection_config()
|
||||
.secure_config.device_authentication_password
|
||||
== connection_config.secure_config.device_authentication_password
|
||||
@ -262,9 +260,7 @@ async def test_init_connection_handling(
|
||||
if connection_config.secure_config.knxkeys_file_path is not None:
|
||||
assert (
|
||||
connection_config.secure_config.knxkeys_file_path
|
||||
in hass.data[KNX_DOMAIN]
|
||||
.connection_config()
|
||||
.secure_config.knxkeys_file_path
|
||||
in hass.data[DOMAIN].connection_config().secure_config.knxkeys_file_path
|
||||
)
|
||||
|
||||
|
||||
@ -276,9 +272,7 @@ async def _init_switch_and_wait_for_first_state_updater_run(
|
||||
config_entry_data: KNXConfigEntryData,
|
||||
) -> None:
|
||||
"""Return a config entry with default data."""
|
||||
config_entry = MockConfigEntry(
|
||||
title="KNX", domain=KNX_DOMAIN, data=config_entry_data
|
||||
)
|
||||
config_entry = MockConfigEntry(title="KNX", domain=DOMAIN, data=config_entry_data)
|
||||
knx.mock_config_entry = config_entry
|
||||
await knx.setup_integration()
|
||||
await create_ui_entity(
|
||||
@ -348,7 +342,7 @@ async def test_async_remove_entry(
|
||||
"""Test async_setup_entry (for coverage)."""
|
||||
config_entry = MockConfigEntry(
|
||||
title="KNX",
|
||||
domain=KNX_DOMAIN,
|
||||
domain=DOMAIN,
|
||||
data={
|
||||
CONF_KNX_KNXKEY_FILENAME: "knx/testcase.knxkeys",
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user