mirror of
https://github.com/home-assistant/core.git
synced 2025-07-31 11:18:00 +02:00
Use registry fixtures in scaffold (#118308)
This commit is contained in:
@ -12,11 +12,11 @@ from tests.common import MockConfigEntry
|
|||||||
@pytest.mark.parametrize("platform", ["sensor"])
|
@pytest.mark.parametrize("platform", ["sensor"])
|
||||||
async def test_setup_and_remove_config_entry(
|
async def test_setup_and_remove_config_entry(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
entity_registry: er.EntityRegistry,
|
||||||
platform: str,
|
platform: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test setting up and removing a config entry."""
|
"""Test setting up and removing a config entry."""
|
||||||
input_sensor_entity_id = "sensor.input"
|
input_sensor_entity_id = "sensor.input"
|
||||||
registry = er.async_get(hass)
|
|
||||||
NEW_DOMAIN_entity_id = f"{platform}.my_NEW_DOMAIN"
|
NEW_DOMAIN_entity_id = f"{platform}.my_NEW_DOMAIN"
|
||||||
|
|
||||||
# Setup the config entry
|
# Setup the config entry
|
||||||
@ -34,7 +34,7 @@ async def test_setup_and_remove_config_entry(
|
|||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
# Check the entity is registered in the entity registry
|
# 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
|
# Check the platform is setup correctly
|
||||||
state = hass.states.get(NEW_DOMAIN_entity_id)
|
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
|
# Check the state and entity registry entry are removed
|
||||||
assert hass.states.get(NEW_DOMAIN_entity_id) is None
|
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
|
||||||
|
Reference in New Issue
Block a user