mirror of
https://github.com/home-assistant/core.git
synced 2026-04-02 08:26:41 +01:00
Allow deleting UniFi client devices (#165505)
This commit is contained in:
@@ -76,9 +76,7 @@ async def async_remove_config_entry_device(
|
||||
"""Remove config entry from a device."""
|
||||
hub = config_entry.runtime_data
|
||||
return not any(
|
||||
identifier
|
||||
for _, identifier in device_entry.connections
|
||||
if identifier in hub.api.clients or identifier in hub.api.devices
|
||||
identifier in hub.api.devices for _, identifier in device_entry.connections
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -178,13 +178,13 @@ async def test_remove_config_entry_device(
|
||||
assert await async_setup_component(hass, "config", {})
|
||||
ws_client = await hass_ws_client(hass)
|
||||
|
||||
# Try to remove an active client from UI: not allowed
|
||||
# Try to remove an active client from UI: allowed
|
||||
device_entry = device_registry.async_get_device(
|
||||
connections={(dr.CONNECTION_NETWORK_MAC, client_payload[0]["mac"])}
|
||||
)
|
||||
response = await ws_client.remove_device(device_entry.id, config_entry.entry_id)
|
||||
assert not response["success"]
|
||||
assert device_registry.async_get_device(
|
||||
assert response["success"]
|
||||
assert not device_registry.async_get_device(
|
||||
connections={(dr.CONNECTION_NETWORK_MAC, client_payload[0]["mac"])}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user