mirror of
https://github.com/home-assistant/core.git
synced 2025-11-12 20:40:18 +00:00
Use registry fixtures in tests (s) (#118295)
This commit is contained in:
@@ -76,15 +76,16 @@ async def test_setup_no_data_fails_with_recovery(
|
||||
assert state.state == "Current Version: 2021.12.10"
|
||||
|
||||
|
||||
async def test_setup_config_no_configuration(hass: HomeAssistant) -> None:
|
||||
async def test_setup_config_no_configuration(
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
||||
) -> None:
|
||||
"""Test setup from yaml missing configuration options."""
|
||||
config = {DOMAIN: None}
|
||||
|
||||
assert await async_setup_component(hass, DOMAIN, config)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
entities = er.async_get(hass)
|
||||
assert entities.entities == {}
|
||||
assert entity_registry.entities == {}
|
||||
|
||||
|
||||
async def test_setup_config_no_sensors(
|
||||
@@ -131,15 +132,15 @@ async def test_unload_entry(hass: HomeAssistant, loaded_entry: MockConfigEntry)
|
||||
|
||||
async def test_device_remove_devices(
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
entity_registry: er.EntityRegistry,
|
||||
loaded_entry: MockConfigEntry,
|
||||
hass_ws_client: WebSocketGenerator,
|
||||
) -> None:
|
||||
"""Test we can only remove a device that no longer exists."""
|
||||
assert await async_setup_component(hass, "config", {})
|
||||
registry: er.EntityRegistry = er.async_get(hass)
|
||||
entity = registry.entities["sensor.current_version"]
|
||||
entity = entity_registry.entities["sensor.current_version"]
|
||||
|
||||
device_registry = dr.async_get(hass)
|
||||
device_entry = device_registry.async_get(entity.device_id)
|
||||
client = await hass_ws_client(hass)
|
||||
response = await client.remove_device(device_entry.id, loaded_entry.entry_id)
|
||||
|
||||
Reference in New Issue
Block a user