Use area_registry fixture in component tests (#118236)

This commit is contained in:
epenet 2024-05-27 12:40:08 +02:00 committed by GitHub
parent 46158f5c14
commit fa038bef92
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 6 deletions

View file

@ -192,10 +192,9 @@ async def test_onboarding_user(
hass: HomeAssistant,
hass_storage: dict[str, Any],
hass_client_no_auth: ClientSessionGenerator,
area_registry: ar.AreaRegistry,
) -> None:
"""Test creating a new user."""
area_registry = ar.async_get(hass)
# Create an existing area to mimic an integration creating an area
# before onboarding is done.
area_registry.async_create("Living Room")

View file

@ -25,10 +25,11 @@ async def test_async_get_node_status_sensor_entity_id(hass: HomeAssistant) -> No
assert async_get_node_status_sensor_entity_id(hass, device.id) is None
async def test_async_get_nodes_from_area_id(hass: HomeAssistant) -> None:
async def test_async_get_nodes_from_area_id(
hass: HomeAssistant, area_registry: ar.AreaRegistry
) -> None:
"""Test async_get_nodes_from_area_id."""
area_reg = ar.async_get(hass)
area = area_reg.async_create("test")
area = area_registry.async_create("test")
assert not async_get_nodes_from_area_id(hass, area.id)

View file

@ -353,6 +353,7 @@ async def test_existing_node_not_replaced_when_not_ready(
zp3111_state,
client,
integration,
area_registry: ar.AreaRegistry,
) -> None:
"""Test when a node added event with a non-ready node is received.
@ -360,7 +361,7 @@ async def test_existing_node_not_replaced_when_not_ready(
"""
dev_reg = dr.async_get(hass)
er_reg = er.async_get(hass)
kitchen_area = ar.async_get(hass).async_create("Kitchen")
kitchen_area = area_registry.async_create("Kitchen")
device_id = f"{client.driver.controller.home_id}-{zp3111.node_id}"
device_id_ext = (