!18 tests: Fix dbusmock AddDevice calls to include optional argument

From: @xuiny 
Reviewed-by: @Charlie_li 
Signed-off-by: @Charlie_li
This commit is contained in:
openeuler-ci-bot 2023-01-05 13:01:47 +00:00 committed by Gitee
commit e798fab76d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 72 additions and 1 deletions

View File

@ -0,0 +1,67 @@
From ae04fa989720279e5558c3b8ff9ebe1959b1cf36 Mon Sep 17 00:00:00 2001
From: Benjamin Berg <bberg@redhat.com>
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

View File

@ -1,6 +1,6 @@
Name: fprintd Name: fprintd
Version: 1.94.2 Version: 1.94.2
Release: 2 Release: 3
Summary: D-Bus service for Fingerprint reader access Summary: D-Bus service for Fingerprint reader access
License: GPLv2+ 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 Url: http://www.freedesktop.org/wiki/Software/fprint/fprintd
ExcludeArch: s390 s390x ExcludeArch: s390 s390x
Patch0001: 0001-Don-t-try-to-clear-storage-on-devices-without-intern.patch 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: meson
BuildRequires: gcc BuildRequires: gcc
@ -94,6 +95,9 @@ fi
%{_mandir}/man8/pam_fprintd.8.gz %{_mandir}/man8/pam_fprintd.8.gz
%changelog %changelog
* Thu Jan 05 2023 xuxinyu <xuxinyu@xfusion.com> - 1.94.2-3
- tests: Fix dbusmock AddDevice calls to include optional argument
* Thu Jan 05 2023 xuxinyu <xuxinyu@xfusion.com> - 1.94.2-2 * Thu Jan 05 2023 xuxinyu <xuxinyu@xfusion.com> - 1.94.2-2
- Don't try to clear storage on devices without internal - Don't try to clear storage on devices without internal
- storage This change prevents warnings like 'Failed to clear - storage This change prevents warnings like 'Failed to clear