mirror of
https://github.com/home-assistant/supervisor.git
synced 2026-04-17 23:33:35 +01:00
Fix D-Bus enum type conversions for NetworkManager (#6325)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -184,3 +184,20 @@ async def test_interface_becomes_unmanaged(
|
||||
assert wireless.is_connected is False
|
||||
assert eth0.connection is None
|
||||
assert connection.is_connected is False
|
||||
|
||||
|
||||
async def test_unknown_device_type(
|
||||
device_eth0_service: DeviceService, dbus_session_bus: MessageBus
|
||||
):
|
||||
"""Test unknown device types are handled gracefully."""
|
||||
interface = NetworkInterface("/org/freedesktop/NetworkManager/Devices/1")
|
||||
await interface.connect(dbus_session_bus)
|
||||
|
||||
# Emit an unknown device type (e.g., 1000 which doesn't exist in the enum)
|
||||
device_eth0_service.emit_properties_changed({"DeviceType": 1000})
|
||||
await device_eth0_service.ping()
|
||||
|
||||
# Should return UNKNOWN instead of crashing
|
||||
assert interface.type == DeviceType.UNKNOWN
|
||||
# Wireless should be None since it's not a wireless device
|
||||
assert interface.wireless is None
|
||||
|
||||
Reference in New Issue
Block a user