[gnome-bluetooth/wip/hadess/remove-gtk-tree: 13/18] 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: 13/18] tests: Add test for _connect_service() API
- Date: Thu, 2 Dec 2021 11:03:44 +0000 (UTC)
commit 833aea1b43d7ff5822a4bbfc22d2ce786be5df21
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 c28b0884..131dcfe4 100755
--- a/tests/integration-test
+++ b/tests/integration-test
@@ -282,6 +282,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)
@@ -370,6 +389,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]