[gnome-bluetooth/wip/hadess/remove-gtk-tree: 12/19] tests: Add test for _connect_service() API
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth/wip/hadess/remove-gtk-tree: 12/19] tests: Add test for _connect_service() API
- Date: Wed, 1 Dec 2021 16:43:24 +0000 (UTC)
commit ebd3146a5fe9e59e46b41ad772cc82142eda0fea
Author: Bastien Nocera <hadess hadess net>
Date: Wed Dec 1 16:16:58 2021 +0100
tests: Add test for _connect_service() API
tests/integration-test | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
---
diff --git a/tests/integration-test b/tests/integration-test
index 71f6092c..a0590167 100755
--- a/tests/integration-test
+++ b/tests/integration-test
@@ -280,6 +280,25 @@ class OopTests(dbusmock.DBusTestCase):
self.wait_for_condition(lambda: device.props.trusted == False)
self.assertEqual(device.props.trusted, False)
+ def test_connect(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.connected, False)
+
+ self.client.connect_service(device.get_object_path(), True)
+ self.wait_for_condition(lambda: device.props.connected == True)
+ self.assertEqual(device.props.connected, True)
+
+ self.client.connect_service(device.get_object_path(), False)
+ self.wait_for_condition(lambda: device.props.connected == False)
+ self.assertEqual(device.props.connected, False)
+
def test_agent(self):
agent = GnomeBluetoothPriv.Agent.new ('/org/gnome/bluetooth/integration_test')
self.assertIsNotNone(agent)
@@ -367,6 +386,11 @@ class Tests(dbusmock.DBusTestCase):
self.dbusmock_bluez.AddDevice('hci0', '11:22:33:44:55:66', 'My Phone')
self.run_test_process()
+ def test_connect(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]