Clean up unnecessary registry mocks from Core tests (#87726)
This commit is contained in:
parent
899adef590
commit
51a9f65a01
50 changed files with 882 additions and 1455 deletions
|
@ -15,7 +15,7 @@ from homeassistant.components.device_automation import (
|
|||
from homeassistant.components.websocket_api.const import TYPE_RESULT
|
||||
from homeassistant.const import CONF_PLATFORM, STATE_OFF, STATE_ON
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
@ -23,27 +23,13 @@ from tests.common import (
|
|||
MockConfigEntry,
|
||||
MockModule,
|
||||
async_mock_service,
|
||||
mock_device_registry,
|
||||
mock_integration,
|
||||
mock_platform,
|
||||
mock_registry,
|
||||
)
|
||||
from tests.components.blueprint.conftest import stub_blueprint_populate # noqa: F401
|
||||
from tests.typing import WebSocketGenerator
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def device_reg(hass):
|
||||
"""Return an empty, loaded, registry."""
|
||||
return mock_device_registry(hass)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def entity_reg(hass):
|
||||
"""Return an empty, loaded, registry."""
|
||||
return mock_registry(hass)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def fake_integration(hass):
|
||||
"""Set up a mock integration with device automation support."""
|
||||
|
@ -108,17 +94,17 @@ def fake_integration(hass):
|
|||
|
||||
|
||||
async def test_websocket_get_actions(
|
||||
hass, hass_ws_client, device_reg, entity_reg, fake_integration
|
||||
hass, hass_ws_client, device_registry, entity_registry, fake_integration
|
||||
):
|
||||
"""Test we get the expected actions through websocket."""
|
||||
await async_setup_component(hass, "device_automation", {})
|
||||
config_entry = MockConfigEntry(domain="test", data={})
|
||||
config_entry.add_to_hass(hass)
|
||||
device_entry = device_reg.async_get_or_create(
|
||||
device_entry = device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry.entry_id,
|
||||
connections={(device_registry.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
connections={(dr.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
)
|
||||
entity_reg.async_get_or_create(
|
||||
entity_registry.async_get_or_create(
|
||||
"fake_integration", "test", "5678", device_id=device_entry.id
|
||||
)
|
||||
expected_actions = [
|
||||
|
@ -159,17 +145,17 @@ async def test_websocket_get_actions(
|
|||
|
||||
|
||||
async def test_websocket_get_conditions(
|
||||
hass, hass_ws_client, device_reg, entity_reg, fake_integration
|
||||
hass, hass_ws_client, device_registry, entity_registry, fake_integration
|
||||
):
|
||||
"""Test we get the expected conditions through websocket."""
|
||||
await async_setup_component(hass, "device_automation", {})
|
||||
config_entry = MockConfigEntry(domain="test", data={})
|
||||
config_entry.add_to_hass(hass)
|
||||
device_entry = device_reg.async_get_or_create(
|
||||
device_entry = device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry.entry_id,
|
||||
connections={(device_registry.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
connections={(dr.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
)
|
||||
entity_reg.async_get_or_create(
|
||||
entity_registry.async_get_or_create(
|
||||
"fake_integration", "test", "5678", device_id=device_entry.id
|
||||
)
|
||||
expected_conditions = [
|
||||
|
@ -209,17 +195,17 @@ async def test_websocket_get_conditions(
|
|||
|
||||
|
||||
async def test_websocket_get_triggers(
|
||||
hass, hass_ws_client, device_reg, entity_reg, fake_integration
|
||||
hass, hass_ws_client, device_registry, entity_registry, fake_integration
|
||||
):
|
||||
"""Test we get the expected triggers through websocket."""
|
||||
await async_setup_component(hass, "device_automation", {})
|
||||
config_entry = MockConfigEntry(domain="test", data={})
|
||||
config_entry.add_to_hass(hass)
|
||||
device_entry = device_reg.async_get_or_create(
|
||||
device_entry = device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry.entry_id,
|
||||
connections={(device_registry.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
connections={(dr.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
)
|
||||
entity_reg.async_get_or_create(
|
||||
entity_registry.async_get_or_create(
|
||||
"fake_integration", "test", "5678", device_id=device_entry.id
|
||||
)
|
||||
expected_triggers = [
|
||||
|
@ -267,17 +253,17 @@ async def test_websocket_get_triggers(
|
|||
|
||||
|
||||
async def test_websocket_get_action_capabilities(
|
||||
hass, hass_ws_client, device_reg, entity_reg, fake_integration
|
||||
hass, hass_ws_client, device_registry, entity_registry, fake_integration
|
||||
):
|
||||
"""Test we get the expected action capabilities through websocket."""
|
||||
await async_setup_component(hass, "device_automation", {})
|
||||
config_entry = MockConfigEntry(domain="test", data={})
|
||||
config_entry.add_to_hass(hass)
|
||||
device_entry = device_reg.async_get_or_create(
|
||||
device_entry = device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry.entry_id,
|
||||
connections={(device_registry.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
connections={(dr.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
)
|
||||
entity_reg.async_get_or_create(
|
||||
entity_registry.async_get_or_create(
|
||||
"fake_integration", "test", "5678", device_id=device_entry.id
|
||||
)
|
||||
expected_capabilities = {
|
||||
|
@ -331,7 +317,7 @@ async def test_websocket_get_action_capabilities(
|
|||
|
||||
|
||||
async def test_websocket_get_action_capabilities_unknown_domain(
|
||||
hass, hass_ws_client, device_reg, entity_reg
|
||||
hass, hass_ws_client, device_registry, entity_registry
|
||||
):
|
||||
"""Test we get no action capabilities for a non existing domain."""
|
||||
await async_setup_component(hass, "device_automation", {})
|
||||
|
@ -354,7 +340,7 @@ async def test_websocket_get_action_capabilities_unknown_domain(
|
|||
|
||||
|
||||
async def test_websocket_get_action_capabilities_no_capabilities(
|
||||
hass, hass_ws_client, device_reg, entity_reg, fake_integration
|
||||
hass, hass_ws_client, device_registry, entity_registry, fake_integration
|
||||
):
|
||||
"""Test we get no action capabilities for a domain which has none.
|
||||
|
||||
|
@ -381,7 +367,7 @@ async def test_websocket_get_action_capabilities_no_capabilities(
|
|||
|
||||
|
||||
async def test_websocket_get_action_capabilities_bad_action(
|
||||
hass, hass_ws_client, device_reg, entity_reg, fake_integration
|
||||
hass, hass_ws_client, device_registry, entity_registry, fake_integration
|
||||
):
|
||||
"""Test we get no action capabilities when there is an error."""
|
||||
await async_setup_component(hass, "device_automation", {})
|
||||
|
@ -411,17 +397,17 @@ async def test_websocket_get_action_capabilities_bad_action(
|
|||
|
||||
|
||||
async def test_websocket_get_condition_capabilities(
|
||||
hass, hass_ws_client, device_reg, entity_reg, fake_integration
|
||||
hass, hass_ws_client, device_registry, entity_registry, fake_integration
|
||||
):
|
||||
"""Test we get the expected condition capabilities through websocket."""
|
||||
await async_setup_component(hass, "device_automation", {})
|
||||
config_entry = MockConfigEntry(domain="test", data={})
|
||||
config_entry.add_to_hass(hass)
|
||||
device_entry = device_reg.async_get_or_create(
|
||||
device_entry = device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry.entry_id,
|
||||
connections={(device_registry.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
connections={(dr.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
)
|
||||
entity_reg.async_get_or_create(
|
||||
entity_registry.async_get_or_create(
|
||||
"fake_integration", "test", "5678", device_id=device_entry.id
|
||||
)
|
||||
expected_capabilities = {
|
||||
|
@ -475,7 +461,7 @@ async def test_websocket_get_condition_capabilities(
|
|||
|
||||
|
||||
async def test_websocket_get_condition_capabilities_unknown_domain(
|
||||
hass, hass_ws_client, device_reg, entity_reg
|
||||
hass, hass_ws_client, device_registry, entity_registry
|
||||
):
|
||||
"""Test we get no condition capabilities for a non existing domain."""
|
||||
await async_setup_component(hass, "device_automation", {})
|
||||
|
@ -498,7 +484,7 @@ async def test_websocket_get_condition_capabilities_unknown_domain(
|
|||
|
||||
|
||||
async def test_websocket_get_condition_capabilities_no_capabilities(
|
||||
hass, hass_ws_client, device_reg, entity_reg, fake_integration
|
||||
hass, hass_ws_client, device_registry, entity_registry, fake_integration
|
||||
):
|
||||
"""Test we get no condition capabilities for a domain which has none.
|
||||
|
||||
|
@ -529,7 +515,7 @@ async def test_websocket_get_condition_capabilities_no_capabilities(
|
|||
|
||||
|
||||
async def test_websocket_get_condition_capabilities_bad_condition(
|
||||
hass, hass_ws_client, device_reg, entity_reg, fake_integration
|
||||
hass, hass_ws_client, device_registry, entity_registry, fake_integration
|
||||
):
|
||||
"""Test we get no condition capabilities when there is an error."""
|
||||
await async_setup_component(hass, "device_automation", {})
|
||||
|
@ -563,17 +549,19 @@ async def test_websocket_get_condition_capabilities_bad_condition(
|
|||
|
||||
|
||||
async def test_async_get_device_automations_single_device_trigger(
|
||||
hass, device_reg, entity_reg
|
||||
hass, device_registry, entity_registry
|
||||
):
|
||||
"""Test we get can fetch the triggers for a device id."""
|
||||
await async_setup_component(hass, "device_automation", {})
|
||||
config_entry = MockConfigEntry(domain="test", data={})
|
||||
config_entry.add_to_hass(hass)
|
||||
device_entry = device_reg.async_get_or_create(
|
||||
device_entry = device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry.entry_id,
|
||||
connections={(device_registry.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
connections={(dr.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
)
|
||||
entity_registry.async_get_or_create(
|
||||
"light", "test", "5678", device_id=device_entry.id
|
||||
)
|
||||
entity_reg.async_get_or_create("light", "test", "5678", device_id=device_entry.id)
|
||||
result = await device_automation.async_get_device_automations(
|
||||
hass, device_automation.DeviceAutomationType.TRIGGER, [device_entry.id]
|
||||
)
|
||||
|
@ -582,17 +570,19 @@ async def test_async_get_device_automations_single_device_trigger(
|
|||
|
||||
|
||||
async def test_async_get_device_automations_all_devices_trigger(
|
||||
hass, device_reg, entity_reg
|
||||
hass, device_registry, entity_registry
|
||||
):
|
||||
"""Test we get can fetch all the triggers when no device id is passed."""
|
||||
await async_setup_component(hass, "device_automation", {})
|
||||
config_entry = MockConfigEntry(domain="test", data={})
|
||||
config_entry.add_to_hass(hass)
|
||||
device_entry = device_reg.async_get_or_create(
|
||||
device_entry = device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry.entry_id,
|
||||
connections={(device_registry.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
connections={(dr.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
)
|
||||
entity_registry.async_get_or_create(
|
||||
"light", "test", "5678", device_id=device_entry.id
|
||||
)
|
||||
entity_reg.async_get_or_create("light", "test", "5678", device_id=device_entry.id)
|
||||
result = await device_automation.async_get_device_automations(
|
||||
hass, device_automation.DeviceAutomationType.TRIGGER
|
||||
)
|
||||
|
@ -601,17 +591,19 @@ async def test_async_get_device_automations_all_devices_trigger(
|
|||
|
||||
|
||||
async def test_async_get_device_automations_all_devices_condition(
|
||||
hass, device_reg, entity_reg
|
||||
hass, device_registry, entity_registry
|
||||
):
|
||||
"""Test we get can fetch all the conditions when no device id is passed."""
|
||||
await async_setup_component(hass, "device_automation", {})
|
||||
config_entry = MockConfigEntry(domain="test", data={})
|
||||
config_entry.add_to_hass(hass)
|
||||
device_entry = device_reg.async_get_or_create(
|
||||
device_entry = device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry.entry_id,
|
||||
connections={(device_registry.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
connections={(dr.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
)
|
||||
entity_registry.async_get_or_create(
|
||||
"light", "test", "5678", device_id=device_entry.id
|
||||
)
|
||||
entity_reg.async_get_or_create("light", "test", "5678", device_id=device_entry.id)
|
||||
result = await device_automation.async_get_device_automations(
|
||||
hass, device_automation.DeviceAutomationType.CONDITION
|
||||
)
|
||||
|
@ -620,17 +612,19 @@ async def test_async_get_device_automations_all_devices_condition(
|
|||
|
||||
|
||||
async def test_async_get_device_automations_all_devices_action(
|
||||
hass, device_reg, entity_reg
|
||||
hass, device_registry, entity_registry
|
||||
):
|
||||
"""Test we get can fetch all the actions when no device id is passed."""
|
||||
await async_setup_component(hass, "device_automation", {})
|
||||
config_entry = MockConfigEntry(domain="test", data={})
|
||||
config_entry.add_to_hass(hass)
|
||||
device_entry = device_reg.async_get_or_create(
|
||||
device_entry = device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry.entry_id,
|
||||
connections={(device_registry.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
connections={(dr.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
)
|
||||
entity_registry.async_get_or_create(
|
||||
"light", "test", "5678", device_id=device_entry.id
|
||||
)
|
||||
entity_reg.async_get_or_create("light", "test", "5678", device_id=device_entry.id)
|
||||
result = await device_automation.async_get_device_automations(
|
||||
hass, device_automation.DeviceAutomationType.ACTION
|
||||
)
|
||||
|
@ -639,17 +633,19 @@ async def test_async_get_device_automations_all_devices_action(
|
|||
|
||||
|
||||
async def test_async_get_device_automations_all_devices_action_exception_throw(
|
||||
hass, device_reg, entity_reg, caplog
|
||||
hass, device_registry, entity_registry, caplog
|
||||
):
|
||||
"""Test we get can fetch all the actions when no device id is passed and can handle one throwing an exception."""
|
||||
await async_setup_component(hass, "device_automation", {})
|
||||
config_entry = MockConfigEntry(domain="test", data={})
|
||||
config_entry.add_to_hass(hass)
|
||||
device_entry = device_reg.async_get_or_create(
|
||||
device_entry = device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry.entry_id,
|
||||
connections={(device_registry.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
connections={(dr.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
)
|
||||
entity_registry.async_get_or_create(
|
||||
"light", "test", "5678", device_id=device_entry.id
|
||||
)
|
||||
entity_reg.async_get_or_create("light", "test", "5678", device_id=device_entry.id)
|
||||
with patch(
|
||||
"homeassistant.components.light.device_trigger.async_get_triggers",
|
||||
side_effect=KeyError,
|
||||
|
@ -663,17 +659,17 @@ async def test_async_get_device_automations_all_devices_action_exception_throw(
|
|||
|
||||
|
||||
async def test_websocket_get_trigger_capabilities(
|
||||
hass, hass_ws_client, device_reg, entity_reg, fake_integration
|
||||
hass, hass_ws_client, device_registry, entity_registry, fake_integration
|
||||
):
|
||||
"""Test we get the expected trigger capabilities through websocket."""
|
||||
await async_setup_component(hass, "device_automation", {})
|
||||
config_entry = MockConfigEntry(domain="test", data={})
|
||||
config_entry.add_to_hass(hass)
|
||||
device_entry = device_reg.async_get_or_create(
|
||||
device_entry = device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry.entry_id,
|
||||
connections={(device_registry.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
connections={(dr.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
)
|
||||
entity_reg.async_get_or_create(
|
||||
entity_registry.async_get_or_create(
|
||||
"fake_integration", "test", "5678", device_id=device_entry.id
|
||||
)
|
||||
expected_capabilities = {
|
||||
|
@ -727,7 +723,7 @@ async def test_websocket_get_trigger_capabilities(
|
|||
|
||||
|
||||
async def test_websocket_get_trigger_capabilities_unknown_domain(
|
||||
hass, hass_ws_client, device_reg, entity_reg
|
||||
hass, hass_ws_client, device_registry, entity_registry
|
||||
):
|
||||
"""Test we get no trigger capabilities for a non existing domain."""
|
||||
await async_setup_component(hass, "device_automation", {})
|
||||
|
@ -750,7 +746,7 @@ async def test_websocket_get_trigger_capabilities_unknown_domain(
|
|||
|
||||
|
||||
async def test_websocket_get_trigger_capabilities_no_capabilities(
|
||||
hass, hass_ws_client, device_reg, entity_reg, fake_integration
|
||||
hass, hass_ws_client, device_registry, entity_registry, fake_integration
|
||||
):
|
||||
"""Test we get no trigger capabilities for a domain which has none.
|
||||
|
||||
|
@ -781,7 +777,7 @@ async def test_websocket_get_trigger_capabilities_no_capabilities(
|
|||
|
||||
|
||||
async def test_websocket_get_trigger_capabilities_bad_trigger(
|
||||
hass, hass_ws_client, device_reg, entity_reg, fake_integration
|
||||
hass, hass_ws_client, device_registry, entity_registry, fake_integration
|
||||
):
|
||||
"""Test we get no trigger capabilities when there is an error."""
|
||||
await async_setup_component(hass, "device_automation", {})
|
||||
|
@ -870,7 +866,7 @@ async def test_automation_with_device_action(hass, caplog, fake_integration):
|
|||
|
||||
|
||||
async def test_automation_with_dynamically_validated_action(
|
||||
hass, caplog, device_reg, fake_integration
|
||||
hass, caplog, device_registry, fake_integration
|
||||
):
|
||||
"""Test device automation with an action which is dynamically validated."""
|
||||
|
||||
|
@ -881,9 +877,9 @@ async def test_automation_with_dynamically_validated_action(
|
|||
config_entry = MockConfigEntry(domain="fake_integration", data={})
|
||||
config_entry.state = config_entries.ConfigEntryState.LOADED
|
||||
config_entry.add_to_hass(hass)
|
||||
device_entry = device_reg.async_get_or_create(
|
||||
device_entry = device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry.entry_id,
|
||||
connections={(device_registry.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
connections={(dr.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
)
|
||||
|
||||
assert await async_setup_component(
|
||||
|
@ -953,7 +949,7 @@ async def test_automation_with_device_condition(hass, caplog, fake_integration):
|
|||
|
||||
|
||||
async def test_automation_with_dynamically_validated_condition(
|
||||
hass, caplog, device_reg, fake_integration
|
||||
hass, caplog, device_registry, fake_integration
|
||||
):
|
||||
"""Test device automation with a condition which is dynamically validated."""
|
||||
|
||||
|
@ -964,9 +960,9 @@ async def test_automation_with_dynamically_validated_condition(
|
|||
config_entry = MockConfigEntry(domain="fake_integration", data={})
|
||||
config_entry.state = config_entries.ConfigEntryState.LOADED
|
||||
config_entry.add_to_hass(hass)
|
||||
device_entry = device_reg.async_get_or_create(
|
||||
device_entry = device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry.entry_id,
|
||||
connections={(device_registry.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
connections={(dr.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
)
|
||||
|
||||
assert await async_setup_component(
|
||||
|
@ -1046,7 +1042,7 @@ async def test_automation_with_device_trigger(hass, caplog, fake_integration):
|
|||
|
||||
|
||||
async def test_automation_with_dynamically_validated_trigger(
|
||||
hass, caplog, device_reg, entity_reg, fake_integration
|
||||
hass, caplog, device_registry, entity_registry, fake_integration
|
||||
):
|
||||
"""Test device automation with a trigger which is dynamically validated."""
|
||||
|
||||
|
@ -1058,11 +1054,11 @@ async def test_automation_with_dynamically_validated_trigger(
|
|||
config_entry = MockConfigEntry(domain="fake_integration", data={})
|
||||
config_entry.state = config_entries.ConfigEntryState.LOADED
|
||||
config_entry.add_to_hass(hass)
|
||||
device_entry = device_reg.async_get_or_create(
|
||||
device_entry = device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry.entry_id,
|
||||
connections={(device_registry.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
connections={(dr.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
)
|
||||
entity_reg.async_get_or_create(
|
||||
entity_registry.async_get_or_create(
|
||||
"fake_integration", "test", "5678", device_id=device_entry.id
|
||||
)
|
||||
|
||||
|
@ -1395,7 +1391,7 @@ async def test_automation_with_unknown_device(hass, caplog, fake_integration):
|
|||
|
||||
|
||||
async def test_automation_with_device_wrong_domain(
|
||||
hass, caplog, device_reg, fake_integration
|
||||
hass, caplog, device_registry, fake_integration
|
||||
):
|
||||
"""Test device automation where the device doesn't have the right config entry."""
|
||||
|
||||
|
@ -1403,9 +1399,9 @@ async def test_automation_with_device_wrong_domain(
|
|||
module = module_cache["fake_integration.device_trigger"]
|
||||
module.async_validate_trigger_config = AsyncMock()
|
||||
|
||||
device_entry = device_reg.async_get_or_create(
|
||||
device_entry = device_registry.async_get_or_create(
|
||||
config_entry_id="not_fake_integration_config_entry",
|
||||
connections={(device_registry.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
connections={(dr.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
)
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
|
@ -1432,7 +1428,7 @@ async def test_automation_with_device_wrong_domain(
|
|||
|
||||
|
||||
async def test_automation_with_device_component_not_loaded(
|
||||
hass, caplog, device_reg, fake_integration
|
||||
hass, caplog, device_registry, fake_integration
|
||||
):
|
||||
"""Test device automation where the device's config entry is not loaded."""
|
||||
|
||||
|
@ -1443,9 +1439,9 @@ async def test_automation_with_device_component_not_loaded(
|
|||
|
||||
config_entry = MockConfigEntry(domain="fake_integration", data={})
|
||||
config_entry.add_to_hass(hass)
|
||||
device_entry = device_reg.async_get_or_create(
|
||||
device_entry = device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry.entry_id,
|
||||
connections={(device_registry.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
connections={(dr.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
)
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue