Use registry fixtures in tests (o-p) (#118292)
This commit is contained in:
parent
ead0e797c1
commit
301c17cba7
20 changed files with 116 additions and 99 deletions
|
@ -9,13 +9,15 @@ from homeassistant.helpers import device_registry as dr, entity_registry as er
|
|||
|
||||
|
||||
async def test_cleanup_orphaned_devices(
|
||||
hass: HomeAssistant, entry, setup_plex_server
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
entity_registry: er.EntityRegistry,
|
||||
entry,
|
||||
setup_plex_server,
|
||||
) -> None:
|
||||
"""Test cleaning up orphaned devices on startup."""
|
||||
test_device_id = {(DOMAIN, "temporary_device_123")}
|
||||
|
||||
device_registry = dr.async_get(hass)
|
||||
entity_registry = er.async_get(hass)
|
||||
entry.add_to_hass(hass)
|
||||
|
||||
test_device = device_registry.async_get_or_create(
|
||||
|
@ -45,6 +47,8 @@ async def test_cleanup_orphaned_devices(
|
|||
|
||||
async def test_migrate_transient_devices(
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
entity_registry: er.EntityRegistry,
|
||||
entry,
|
||||
setup_plex_server,
|
||||
requests_mock: requests_mock.Mocker,
|
||||
|
@ -55,8 +59,6 @@ async def test_migrate_transient_devices(
|
|||
non_plexweb_device_id = {(DOMAIN, "1234567890123456-com-plexapp-android")}
|
||||
plex_client_service_device_id = {(DOMAIN, "plex.tv-clients")}
|
||||
|
||||
device_registry = dr.async_get(hass)
|
||||
entity_registry = er.async_get(hass)
|
||||
entry.add_to_hass(hass)
|
||||
|
||||
# Pre-create devices and entities to test device migration
|
||||
|
|
|
@ -74,6 +74,7 @@ class MockPlexTVEpisode(MockPlexMedia):
|
|||
|
||||
async def test_library_sensor_values(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
setup_plex_server,
|
||||
mock_websocket,
|
||||
|
@ -118,7 +119,6 @@ async def test_library_sensor_values(
|
|||
assert hass.states.get("sensor.plex_server_1_library_tv_shows") is None
|
||||
|
||||
# Enable sensor and validate values
|
||||
entity_registry = er.async_get(hass)
|
||||
entity_registry.async_update_entity(
|
||||
entity_id="sensor.plex_server_1_library_tv_shows", disabled_by=None
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue