From d6c70be8227d2844ed4d78c60c9a90c7ee9021fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 3 Apr 2020 02:49:25 +0200 Subject: [PATCH] dbusmock/fprintd: Add ability to remove devices --- tests/dbusmock/fprintd.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/dbusmock/fprintd.py b/tests/dbusmock/fprintd.py index a3cea2d..51faa0b 100644 --- a/tests/dbusmock/fprintd.py +++ b/tests/dbusmock/fprintd.py @@ -146,6 +146,19 @@ def AddDevice(self, device_name, num_enroll_stages, scan_type): return path +@dbus.service.method(MANAGER_MOCK_IFACE, + in_signature='o') +def RemoveDevice(self, path): + # This isn't compatible with hotplugging devices, which fprintd doesn't + # support yet, but it's meant to remove devices added to the mock for + # testing purposes. + if not path: + raise dbus.exceptions.DBusException( + 'Invalid empty path.', + name='org.freedesktop.DBus.Error.InvalidArgs') + + self.RemoveObject(path) + @dbus.service.method(DEVICE_IFACE, in_signature='s', out_signature='as') def ListEnrolledFingers(device, user):