Use remove_device helper in tests (2/2) (#116442)

Use remove_device helper in tests (part 2)
This commit is contained in:
epenet 2024-04-30 12:50:35 +02:00 committed by GitHub
parent d84d2109c2
commit a3942e019b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 79 additions and 347 deletions

View file

@ -17,7 +17,7 @@ from homeassistant.core import HomeAssistant
from homeassistant.helpers import device_registry as dr, entity_registry as er
from homeassistant.setup import async_setup_component
from .common import CONFIG, VACUUM_ENTITY_ID, remove_device
from .common import CONFIG, VACUUM_ENTITY_ID
from .conftest import setup_integration
from tests.common import MockConfigEntry
@ -87,20 +87,13 @@ async def test_device_remove_devices(
assert entity.unique_id == "LR3C012345-litter_box"
device_entry = device_registry.async_get(entity.device_id)
assert (
await remove_device(
await hass_ws_client(hass), device_entry.id, config_entry.entry_id
)
is False
)
client = await hass_ws_client(hass)
response = await client.remove_device(device_entry.id, config_entry.entry_id)
assert not response["success"]
dead_device_entry = device_registry.async_get_or_create(
config_entry_id=config_entry.entry_id,
identifiers={(litterrobot.DOMAIN, "test-serial", "remove-serial")},
)
assert (
await remove_device(
await hass_ws_client(hass), dead_device_entry.id, config_entry.entry_id
)
is True
)
response = await client.remove_device(dead_device_entry.id, config_entry.entry_id)
assert response["success"]