[gnome-bluetooth/wip/hadess/fix-shell-menu: 2/2] tests: Add test for device removal coalescing/quieting
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth/wip/hadess/fix-shell-menu: 2/2] tests: Add test for device removal coalescing/quieting
- Date: Wed, 23 Feb 2022 18:42:55 +0000 (UTC)
commit bf689736fba59235eb15b9dcbed6aea9fa3c67cf
Author: Bastien Nocera <hadess hadess net>
Date: Wed Feb 23 18:38:00 2022 +0100
tests: Add test for device removal coalescing/quieting
tests/integration-test.py | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
---
diff --git a/tests/integration-test.py b/tests/integration-test.py
index 4c780fa5..b22196ec 100755
--- a/tests/integration-test.py
+++ b/tests/integration-test.py
@@ -440,6 +440,29 @@ class OopTests(dbusmock.DBusTestCase):
self.assertEqual(device.props.connectable, False)
+ def test_adapter_removal(self):
+ bus = dbus.SystemBus()
+ bluez_server = bus.get_object('org.bluez', '/org/bluez')
+ dbusmock_bluez = dbus.Interface(bluez_server, 'org.bluez.Mock')
+
+ client = GnomeBluetoothPriv.Client.new()
+
+ self.wait_for_mainloop()
+ list_store = client.get_devices()
+ self.assertEqual(list_store.get_n_items(), 1)
+
+ num_devices = 1
+ def device_removed_cb(client, path):
+ nonlocal num_devices
+ num_devices -= 1
+ self.client.connect('device-removed', device_removed_cb)
+
+ dbusmock_bluez.RemoveAdapterWithDevices('hci0')
+ # Wait for 5 seconds or until we have the wrong result
+ self.wait_for_condition(lambda: num_devices == 0)
+ self.assertEqual(num_devices, 1)
+
+
class Tests(dbusmock.DBusTestCase):
@classmethod
@@ -621,5 +644,17 @@ class Tests(dbusmock.DBusTestCase):
self.run_test_process()
+ def test_adapter_removal(self):
+ self.dbusmock_bluez.AddAdapter('hci0', 'my-computer')
+ device = self.dbusmock_bluez.AddDevice('hci0', '11:22:33:44:55:66', 'LE Mouse')
+ device_obj = self.dbus_con.get_object('org.bluez', device)
+ device_obj.UpdateProperties('org.bluez.Device1', {
+ 'Connected': True,
+ 'Paired': True
+ })
+
+ self.run_test_process()
+
+
if __name__ == '__main__':
unittest.main()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]