From 8bb2db3778b42d8ed4e8aeb09d6599f3ec17c13f Mon Sep 17 00:00:00 2001 From: xuxinyu Date: Thu, 5 Jan 2023 17:58:04 +0800 Subject: [PATCH] tests: Fix dbusmock AddDevice calls to include optional argument Signed-off-by: xuxinyu --- ...ck-AddDevice-calls-to-include-option.patch | 67 +++++++++++++++++++ fprintd.spec | 6 +- 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 0002-tests-Fix-dbusmock-AddDevice-calls-to-include-option.patch diff --git a/0002-tests-Fix-dbusmock-AddDevice-calls-to-include-option.patch b/0002-tests-Fix-dbusmock-AddDevice-calls-to-include-option.patch new file mode 100644 index 0000000..8fced46 --- /dev/null +++ b/0002-tests-Fix-dbusmock-AddDevice-calls-to-include-option.patch @@ -0,0 +1,67 @@ +From ae04fa989720279e5558c3b8ff9ebe1959b1cf36 Mon Sep 17 00:00:00 2001 +From: Benjamin Berg +Date: Tue, 3 May 2022 12:01:37 +0200 +Subject: [PATCH 02/14] tests: Fix dbusmock AddDevice calls to include optional + argument + +The dbusmock code checks that all parameters wanted by the dbus +signature are given. As such, pass them, even though the parameters is +optional on the python side. +--- + tests/pam/test_pam_fprintd.py | 8 ++++---- + tests/test_fprintd_utils.py | 2 +- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/tests/pam/test_pam_fprintd.py b/tests/pam/test_pam_fprintd.py +index 99f8259..bd43497 100644 +--- a/tests/pam/test_pam_fprintd.py ++++ b/tests/pam/test_pam_fprintd.py +@@ -82,7 +82,7 @@ class TestPamFprintd(dbusmock.DBusTestCase): + self.p_mock.wait() + + def setup_device(self): +- device_path = self.obj_fprintd_mock.AddDevice('FDO Trigger Finger Laser Reader', 3, 'swipe') ++ device_path = self.obj_fprintd_mock.AddDevice('FDO Trigger Finger Laser Reader', 3, 'swipe', False) + self.device_mock = self.dbus_con.get_object('net.reactivated.Fprint', device_path) + self.device_mock.SetEnrolledFingers('toto', ['left-little-finger', 'right-little-finger']) + +@@ -232,7 +232,7 @@ class TestPamFprintd(dbusmock.DBusTestCase): + self.assertRegex(res.errors[0], r'Failed to match fingerprint') + + def test_pam_fprintd_dual_reader_auth(self): +- device_path = self.obj_fprintd_mock.AddDevice('FDO Sandpaper Reader', 3, 'press') ++ device_path = self.obj_fprintd_mock.AddDevice('FDO Sandpaper Reader', 3, 'press', False) + sandpaper_device_mock = self.dbus_con.get_object('net.reactivated.Fprint', device_path) + sandpaper_device_mock.SetEnrolledFingers('toto', ['left-middle-finger', 'right-middle-finger']) + script = [ +@@ -251,12 +251,12 @@ class TestPamFprintd(dbusmock.DBusTestCase): + + def test_pam_fprintd_multi_reader_not_all_enrolled(self): + # Add a 1st device with actual enrolled prints +- device_path = self.obj_fprintd_mock.AddDevice('FDO Empty reader', 3, 'press') ++ device_path = self.obj_fprintd_mock.AddDevice('FDO Empty reader', 3, 'press', False) + empty_reader = self.dbus_con.get_object('net.reactivated.Fprint', device_path) + empty_reader.SetEnrolledFingers('toto', dbus.Array(set([]), signature='s')) + + # Add a 2nd device with actual enrolled prints +- device_path = self.obj_fprintd_mock.AddDevice('FDO Most Used Reader', 3, 'press') ++ device_path = self.obj_fprintd_mock.AddDevice('FDO Most Used Reader', 3, 'press', False) + sandpaper_device_mock = self.dbus_con.get_object('net.reactivated.Fprint', device_path) + sandpaper_device_mock.SetEnrolledFingers('toto', ['left-middle-finger', 'right-middle-finger']) + script = [ +diff --git a/tests/test_fprintd_utils.py b/tests/test_fprintd_utils.py +index f10d4b0..efa5893 100755 +--- a/tests/test_fprintd_utils.py ++++ b/tests/test_fprintd_utils.py +@@ -88,7 +88,7 @@ class TestFprintdUtilsBase(dbusmock.DBusTestCase): + + def setup_device(self): + self.device_path = self.obj_fprintd_mock.AddDevice( +- 'FDO Trigger Finger Laser Reader', 3, 'swipe') ++ 'FDO Trigger Finger Laser Reader', 3, 'swipe', False) + self.device_mock = self.dbus_con.get_object('net.reactivated.Fprint', + self.device_path) + self.set_enrolled_fingers(['left-little-finger', 'right-little-finger']) +-- +2.37.1.windows.1 + diff --git a/fprintd.spec b/fprintd.spec index 30eb00b..9f3b7a4 100644 --- a/fprintd.spec +++ b/fprintd.spec @@ -1,6 +1,6 @@ Name: fprintd Version: 1.94.2 -Release: 2 +Release: 3 Summary: D-Bus service for Fingerprint reader access License: GPLv2+ @@ -8,6 +8,7 @@ Source0: https://gitlab.freedesktop.org/libfprint/fprintd/-/archive/v%{version}/ Url: http://www.freedesktop.org/wiki/Software/fprint/fprintd ExcludeArch: s390 s390x Patch0001: 0001-Don-t-try-to-clear-storage-on-devices-without-intern.patch +Patch0002: 0002-tests-Fix-dbusmock-AddDevice-calls-to-include-option.patch BuildRequires: meson BuildRequires: gcc @@ -94,6 +95,9 @@ fi %{_mandir}/man8/pam_fprintd.8.gz %changelog +* Thu Jan 05 2023 xuxinyu - 1.94.2-3 +- tests: Fix dbusmock AddDevice calls to include optional argument + * Thu Jan 05 2023 xuxinyu - 1.94.2-2 - Don't try to clear storage on devices without internal - storage This change prevents warnings like 'Failed to clear