mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Update a-c* tests to use entity & device registry fixtures (#103793)
* Update a-c* tests to use entity & device registry fixtures * Revert some changes * Revert formatting * retrigger CI
This commit is contained in:
committed by
GitHub
parent
abb1328a67
commit
9ab1cb83d8
@@ -120,11 +120,10 @@ async def test_sync_entities(mock_conf, hass: HomeAssistant, cloud_prefs) -> Non
|
||||
|
||||
|
||||
async def test_google_update_expose_trigger_sync(
|
||||
hass: HomeAssistant, cloud_prefs
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry, cloud_prefs
|
||||
) -> None:
|
||||
"""Test Google config responds to updating exposed entities."""
|
||||
assert await async_setup_component(hass, "homeassistant", {})
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
# Enable exposing new entities to Google
|
||||
expose_new(hass, True)
|
||||
@@ -176,10 +175,12 @@ async def test_google_update_expose_trigger_sync(
|
||||
|
||||
|
||||
async def test_google_entity_registry_sync(
|
||||
hass: HomeAssistant, mock_cloud_login, cloud_prefs
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
mock_cloud_login,
|
||||
cloud_prefs,
|
||||
) -> None:
|
||||
"""Test Google config responds to entity registry."""
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
# Enable exposing new entities to Google
|
||||
expose_new(hass, True)
|
||||
@@ -246,19 +247,25 @@ async def test_google_entity_registry_sync(
|
||||
|
||||
|
||||
async def test_google_device_registry_sync(
|
||||
hass: HomeAssistant, mock_cloud_login, cloud_prefs
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
mock_cloud_login,
|
||||
cloud_prefs,
|
||||
) -> None:
|
||||
"""Test Google config responds to device registry."""
|
||||
config = CloudGoogleConfig(
|
||||
hass, GACTIONS_SCHEMA({}), "mock-user-id", cloud_prefs, hass.data["cloud"]
|
||||
)
|
||||
ent_reg = er.async_get(hass)
|
||||
|
||||
# Enable exposing new entities to Google
|
||||
expose_new(hass, True)
|
||||
|
||||
entity_entry = ent_reg.async_get_or_create("light", "hue", "1234", device_id="1234")
|
||||
entity_entry = ent_reg.async_update_entity(entity_entry.entity_id, area_id="ABCD")
|
||||
entity_entry = entity_registry.async_get_or_create(
|
||||
"light", "hue", "1234", device_id="1234"
|
||||
)
|
||||
entity_entry = entity_registry.async_update_entity(
|
||||
entity_entry.entity_id, area_id="ABCD"
|
||||
)
|
||||
|
||||
with patch.object(config, "async_sync_entities_all"):
|
||||
await config.async_initialize()
|
||||
@@ -293,7 +300,7 @@ async def test_google_device_registry_sync(
|
||||
|
||||
assert len(mock_sync.mock_calls) == 0
|
||||
|
||||
ent_reg.async_update_entity(entity_entry.entity_id, area_id=None)
|
||||
entity_registry.async_update_entity(entity_entry.entity_id, area_id=None)
|
||||
|
||||
# Device registry updated with relevant changes
|
||||
# but entity has area ID so not impacted
|
||||
|
||||
Reference in New Issue
Block a user