[folks/nielsdg/Fix-bluez-tests] tests/bluez: Follow PairDevice() API change




commit 29fbfd292b55257d234e5faef55128210402e8ed
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Tue Oct 11 20:27:41 2022 +0200

    tests/bluez: Follow PairDevice() API change
    
    Upstream python-dbusmock changed its API for `PairDevice()` to include a
    class parameter. For Python code, this API break was solved by providing
    a default value for the argument. Since we rely on the D-Bus interface
    however and D-Bus doesn't have a concept of default arguments, this just
    broke with an error:
    
    > Error setting up mock BlueZ device:
    > GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Invalid arguments:
    > More items found in D-Bus signature than in Python arguments
    
    Add the same default argument in our Vala interface to work around the
    problem.
    
    Related links:
    * https://github.com/martinpitt/python-dbusmock/pull/45
    * https://github.com/martinpitt/python-dbusmock/issues/123

 tests/lib/bluez/backend.vala | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/tests/lib/bluez/backend.vala b/tests/lib/bluez/backend.vala
index 023117e6..b2fafa87 100644
--- a/tests/lib/bluez/backend.vala
+++ b/tests/lib/bluez/backend.vala
@@ -39,7 +39,7 @@ namespace org
 
             [DBus (name = "PairDevice")]
             public abstract void pair_device (string adapter_device_name,
-                string device_address) throws GLib.Error;
+                string device_address, int class_=5898764) throws GLib.Error;
 
             [DBus (name = "BlockDevice")]
             public abstract void block_device (string adapter_device_name,
@@ -240,16 +240,20 @@ public class BluezTest.Backend
     {
       try
         {
+            message("ADDING ADAPTER");
           /* Set up a Bluetooth adapter and a single persona store. */
           adapter_path = this.mock_bluez.add_adapter ("hci0", "Test System");
+            message("ADDING DEVICE");
           device_path =
               this.mock_bluez.add_device ("hci0", this.primary_device_address,
                   "My Phone");
 
           /* Pair with the phone. */
+            message("PAIRING DEVICE");
           this.mock_bluez.pair_device ("hci0", this.primary_device_address);
 
           /* Set the vCard to be returned for all transfers. */
+            message("SET SIMPLE DEVICE");
           return this.set_simple_device_vcard (vcard);
         }
       catch (GLib.Error e1)


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