[gnome-bluetooth/wip/hadess/powered-fixes: 4/4] lib: Add test for default-adapter-powered
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth/wip/hadess/powered-fixes: 4/4] lib: Add test for default-adapter-powered
- Date: Thu, 16 Dec 2021 14:05:01 +0000 (UTC)
commit cc66ba90861ff2e3cb94a8dc85f0be0d7930584e
Author: Bastien Nocera <hadess hadess net>
Date: Thu Dec 16 15:04:23 2021 +0100
lib: Add test for default-adapter-powered
tests/integration-test | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
---
diff --git a/tests/integration-test b/tests/integration-test
index 502c63e2..4a2adeca 100755
--- a/tests/integration-test
+++ b/tests/integration-test
@@ -235,6 +235,32 @@ class OopTests(dbusmock.DBusTestCase):
self.assertIsNotNone(device)
self.assertEqual(device.props.address, '11:22:33:44:55:66')
+ def test_default_adapter_powered(self):
+ bus = dbus.SystemBus()
+ dbusmock_bluez = dbus.Interface(bus.get_object('org.bluez', '/org/bluez/hci0'),
'org.freedesktop.DBus.Mock')
+ dbusprops_bluez = dbus.Interface(bus.get_object('org.bluez', '/org/bluez/hci0'),
'org.freedesktop.DBus.Properties')
+
+ self.assertEqual(dbusprops_bluez.Get('org.bluez.Adapter1', 'Powered'), False)
+ self.wait_for_condition(lambda: dbusprops_bluez.Get('org.bluez.Adapter1', 'Powered') == True)
+ self.assertEqual(self.client.props.num_adapters, 1)
+ self.assertEqual(dbusprops_bluez.Get('org.bluez.Adapter1', 'Powered'), True)
+ self.wait_for_mainloop()
+ self.assertEqual(self.client.props.default_adapter_powered, True)
+
+ self.client.props.default_adapter_powered = False
+ self.wait_for_condition(lambda: dbusprops_bluez.Get('org.bluez.Adapter1', 'Powered') == False)
+ self.assertEqual(dbusprops_bluez.Get('org.bluez.Adapter1', 'Powered'), False)
+ self.wait_for_mainloop()
+ self.assertEqual(self.client.props.default_adapter_powered, False)
+
+ dbusmock_bluez.UpdateProperties('org.bluez.Adapter1', {
+ 'Powered': True,
+ })
+ self.wait_for_condition(lambda: dbusprops_bluez.Get('org.bluez.Adapter1', 'Powered') == True)
+ self.assertEqual(dbusprops_bluez.Get('org.bluez.Adapter1', 'Powered'), True)
+ self.wait_for_mainloop()
+ self.assertEqual(self.client.props.default_adapter_powered, True)
+
def _pair_cb(self, client, result, user_data=None):
success, path = client.setup_device_finish(result)
self.assertEqual(success, True)
@@ -390,6 +416,15 @@ class Tests(dbusmock.DBusTestCase):
self.dbusmock_bluez.AddDevice('hci1', '22:33:44:55:66:77', 'My Mouse')
self.run_test_process()
+ def test_default_adapter_powered(self):
+ path = self.dbusmock_bluez.AddAdapter('hci0', 'my-computer')
+ bus = dbus.SystemBus()
+ dbusmock_adapter = dbus.Interface(bus.get_object('org.bluez', path), 'org.freedesktop.DBus.Mock')
+ dbusmock_adapter.UpdateProperties('org.bluez.Adapter1', {
+ 'Powered': False,
+ })
+ self.run_test_process()
+
def test_pairing(self):
adapter_name = 'hci0'
self.dbusmock_bluez.AddAdapter(adapter_name, 'my-computer')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]