Use registry fixtures in tests (t-u) (#118297)

This commit is contained in:
epenet 2024-05-28 14:23:01 +02:00 committed by GitHub
parent ef6c7621cf
commit 2545b7d3bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 254 additions and 191 deletions

View file

@ -9,10 +9,11 @@ from tests.components.trend.conftest import ComponentSetup
async def test_setup_and_remove_config_entry(
hass: HomeAssistant, config_entry: MockConfigEntry
hass: HomeAssistant,
entity_registry: er.EntityRegistry,
config_entry: MockConfigEntry,
) -> None:
"""Test setting up and removing a config entry."""
registry = er.async_get(hass)
trend_entity_id = "binary_sensor.my_trend"
# Set up the config entry
@ -21,7 +22,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(trend_entity_id) is not None
assert entity_registry.async_get(trend_entity_id) is not None
# Remove the config entry
assert await hass.config_entries.async_remove(config_entry.entry_id)
@ -29,7 +30,7 @@ async def test_setup_and_remove_config_entry(
# Check the state and entity registry entry are removed
assert hass.states.get(trend_entity_id) is None
assert registry.async_get(trend_entity_id) is None
assert entity_registry.async_get(trend_entity_id) is None
async def test_reload_config_entry(