[gnome-bluetooth/wip/hadess/remove-gtk-tree: 10/19] test: Add test for _set_trusted() API




commit 9beb149ddd5de73e989ed365963b06dded955ba4
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Dec 1 15:59:54 2021 +0100

    test: Add test for _set_trusted() API

 tests/integration-test | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
---
diff --git a/tests/integration-test b/tests/integration-test
index 16b1360e..71f6092c 100755
--- a/tests/integration-test
+++ b/tests/integration-test
@@ -261,6 +261,25 @@ class OopTests(dbusmock.DBusTestCase):
         self.assertEqual(device.props.paired, True)
         self.assertEqual(device.props.icon, 'phone')
 
+    def test_set_trusted(self):
+        self.wait_for_condition(lambda: self.client.props.num_adapters != 0)
+        self.assertEqual(self.client.props.num_adapters, 1)
+
+        model = self.client.get_devices()
+
+        # Get first device
+        device = model.get_item(0)
+        self.assertEqual(device.props.address, '11:22:33:44:55:66')
+        self.assertEqual(device.props.trusted, False)
+
+        self.client.set_trusted(device.get_object_path(), True)
+        self.wait_for_condition(lambda: device.props.trusted == True)
+        self.assertEqual(device.props.trusted, True)
+
+        self.client.set_trusted(device.get_object_path(), False)
+        self.wait_for_condition(lambda: device.props.trusted == False)
+        self.assertEqual(device.props.trusted, False)
+
     def test_agent(self):
         agent = GnomeBluetoothPriv.Agent.new ('/org/gnome/bluetooth/integration_test')
         self.assertIsNotNone(agent)
@@ -343,6 +362,11 @@ class Tests(dbusmock.DBusTestCase):
 
         self.run_test_process()
 
+    def test_set_trusted(self):
+        self.dbusmock_bluez.AddAdapter('hci0', 'my-computer')
+        self.dbusmock_bluez.AddDevice('hci0', '11:22:33:44:55:66', 'My Phone')
+        self.run_test_process()
+
     def test_agent(self):
         self.run_test_process()
 


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