Commit a1a437d7 authored by Bastien Nocera's avatar Bastien Nocera

linux: Add test for Appearance property being missing

Similar test to the test_bluetooth_le_mouse() one, but without an
appearance property.
parent 27541a61
Pipeline #72792 passed with stage
in 5 minutes and 57 seconds
......@@ -1596,6 +1596,50 @@ class Tests(dbusmock.DBusTestCase):
self.assertEqual(self.get_dbus_dev_property(mouse_bat0_up, 'Type'), UP_DEVICE_KIND_MOUSE)
self.stop_daemon()
def test_bluetooth_le_device(self):
'''Bluetooth LE Device'''
'''See https://gitlab.freedesktop.org/upower/upower/issues/100'''
self.start_bluez()
# Add an adapter to both bluez and udev
adapter_name = 'hci0'
path = self.bluez_obj.AddAdapter(adapter_name, 'my-computer')
self.assertEqual(path, '/org/bluez/' + adapter_name)
dev = self.testbed.add_device('bluetooth',
'usb2/bluetooth/hci0/hci0:1',
None,
[], [])
# Add a device to both bluez and udev
address = '11:22:33:44:55:66'
alias = 'Satechi M1 Mouse'
path = self.bluez_obj.AddDevice(adapter_name, address, alias)
device = self.dbus_con.get_object('org.bluez', path)
properties = {
'Percentage': dbus.Byte(99, variant_level=1),
}
device.AddProperties(BATTERY_IFACE, properties)
self.start_daemon()
# process = subprocess.Popen(['gdbus', 'introspect', '--system', '--dest', 'org.bluez', '--object-path', '/org/bluez/hci0/dev_11_22_33_44_55_66'])
# Wait for UPower to process the new device
time.sleep(0.5)
devs = self.proxy.EnumerateDevices()
self.assertEqual(len(devs), 1)
mouse_bat0_up = devs[0]
self.assertEqual(self.get_dbus_dev_property(mouse_bat0_up, 'Model'), 'Satechi M1 Mouse')
self.assertEqual(self.get_dbus_dev_property(mouse_bat0_up, 'Percentage'), 99)
self.assertEqual(self.get_dbus_dev_property(mouse_bat0_up, 'PowerSupply'), False)
self.assertEqual(self.get_dbus_dev_property(mouse_bat0_up, 'Type'), UP_DEVICE_KIND_UNKNOWN)
self.stop_daemon()
#
# libupower-glib tests (through introspection)
#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment