[gnome-bluetooth/wip/hadess/lib-changes: 11/19] tests: Verify the default-adapter-setup-mode property works




commit b606f8796251f49a337771b777e3a4102a10e54e
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Nov 25 18:05:22 2021 +0100

    tests: Verify the default-adapter-setup-mode property works

 tests/integration-test | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
---
diff --git a/tests/integration-test b/tests/integration-test
index e8f0d1e6..77b1afbd 100755
--- a/tests/integration-test
+++ b/tests/integration-test
@@ -224,10 +224,19 @@ class OopTests(dbusmock.DBusTestCase):
         self.assertIsNotNone(device)
         self.assertEqual(device.get_property('address'), '22:33:44:55:66:77')
 
+        # Set default adapter in setup mode
+        self.assertEqual (self.client.get_property('default-adapter-setup-mode'), False)
+        default_adapter_path = self.client.get_property('default-adapter')
+        self.client.set_property('default-adapter-setup-mode', True)
+        self.wait_for_mainloop()
+        self.assertEqual(self.client.get_property('default-adapter-setup-mode'), True)
+
         # Remove default adapter
         dbusmock_bluez.RemoveAdapter('hci1')
         self.wait_for_condition(lambda: self.client.get_property('num-adapters') != 2)
         self.assertEqual(self.client.get_property('num-adapters'), 1)
+        self.assertNotEqual(self.client.get_property('default-adapter'), default_adapter_path)
+        self.assertEqual(self.client.get_property('default-adapter-setup-mode'), False)
 
         # GtkTreeModel
         path = Gtk.TreePath([0])
@@ -244,6 +253,21 @@ class OopTests(dbusmock.DBusTestCase):
         self.assertIsNotNone(device)
         self.assertEqual(device.get_property('address'), '11:22:33:44:55:66')
 
+        # Re-add the old adapter, device is still there
+        dbusmock_bluez.AddAdapter('hci1', 'my-computer #2')
+
+        # GtkTreeModel
+        path = Gtk.TreePath([0])
+        treeiter = model.get_iter(path)
+        self.assertEqual(model.get_value(treeiter, GnomeBluetoothPriv.Column.DEFAULT), True)
+        self.assertEqual(model.get_value(treeiter, GnomeBluetoothPriv.Column.NAME), 'my-computer')
+
+        # GListModel
+        self.assertEqual(list_store.get_n_items(), 1)
+        device = list_store.get_item(0)
+        self.assertIsNotNone(device)
+        self.assertEqual(device.get_property('address'), '11:22:33:44:55:66')
+
     def _pair_cb(self, client, result, user_data=None):
         success, path = client.setup_device_finish(result)
         self.assertEqual(success, True)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]