summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2021-12-01 15:59:54 +0100
committerBastien Nocera <hadess@hadess.net>2021-12-02 12:03:05 +0100
commit406cf79bf8f65791299e6893ba81522f1ac310cf (patch)
tree0cf0ac47e837f6d1abe9f465a606eb4542ee5b2f /tests
parent633456aa6012a3f275e9b3674f9abc7c637b7b51 (diff)
downloadgnome-bluetooth-406cf79bf8f65791299e6893ba81522f1ac310cf.tar.gz
tests: Add test for _set_trusted() API
Diffstat (limited to 'tests')
-rwxr-xr-xtests/integration-test24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/integration-test b/tests/integration-test
index aa94d156..c28b0884 100755
--- a/tests/integration-test
+++ b/tests/integration-test
@@ -263,6 +263,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)
@@ -346,6 +365,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()