Use registry fixtures in tests (s) (#118295)
This commit is contained in:
parent
90500c4b97
commit
e58d060f82
56 changed files with 377 additions and 318 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue