Use registry fixtures in scaffold (#118308)

This commit is contained in:
epenet
2024-05-28 14:20:01 +02:00
committed by GitHub
parent 301c17cba7
commit ef6c7621cf

View File

@ -12,11 +12,11 @@ from tests.common import MockConfigEntry
@pytest.mark.parametrize("platform", ["sensor"])
async def test_setup_and_remove_config_entry(
hass: HomeAssistant,
entity_registry: er.EntityRegistry,
platform: str,
) -> None:
"""Test setting up and removing a config entry."""
input_sensor_entity_id = "sensor.input"
registry = er.async_get(hass)
NEW_DOMAIN_entity_id = f"{platform}.my_NEW_DOMAIN"
# Setup the config entry
@ -34,7 +34,7 @@ async def test_setup_and_remove_config_entry(
await hass.async_block_till_done()
# Check the entity is registered in the entity registry
assert registry.async_get(NEW_DOMAIN_entity_id) is not None
assert entity_registry.async_get(NEW_DOMAIN_entity_id) is not None
# Check the platform is setup correctly
state = hass.states.get(NEW_DOMAIN_entity_id)
@ -48,4 +48,4 @@ async def test_setup_and_remove_config_entry(
# Check the state and entity registry entry are removed
assert hass.states.get(NEW_DOMAIN_entity_id) is None
assert registry.async_get(NEW_DOMAIN_entity_id) is None
assert entity_registry.async_get(NEW_DOMAIN_entity_id) is None