mirror of
https://gitlab.freedesktop.org/libfprint/fprintd.git
synced 2026-05-05 01:47:58 +02:00
tests: Add device removal test
This commit is contained in:
parent
08fb209aed
commit
ab8118bde2
1 changed files with 26 additions and 0 deletions
|
|
@ -303,6 +303,11 @@ class FPrintdTest(dbusmock.DBusTestCase):
|
|||
with Connection(self.sockaddr) as con:
|
||||
con.sendall(struct.pack('ii', -2, error))
|
||||
|
||||
# From libfprint tests
|
||||
def send_remove(self):
|
||||
with Connection(self.sockaddr) as con:
|
||||
con.sendall(struct.pack('ii', -5, 0))
|
||||
|
||||
# From libfprint tests
|
||||
def send_image(self, image):
|
||||
img = self.prints[image]
|
||||
|
|
@ -682,6 +687,27 @@ class FPrintdVirtualDeviceTest(FPrintdVirtualDeviceBaseTest):
|
|||
|
||||
time.sleep(1)
|
||||
|
||||
def test_removal_during_enroll(self):
|
||||
self._polkitd_obj.SetAllowed(['net.reactivated.fprint.device.setusername',
|
||||
'net.reactivated.fprint.device.enroll'])
|
||||
self.device.Claim('(s)', 'testuser')
|
||||
self.device.EnrollStart('(s)', 'left-index-finger')
|
||||
|
||||
# Now remove the device while we are enrolling, which will cause an error
|
||||
self.send_remove()
|
||||
self.wait_for_result(expected='enroll-unknown-error')
|
||||
|
||||
# The device will still be there now until it is released
|
||||
devices = self.manager.GetDevices()
|
||||
self.assertIn(self.device.get_object_path(), devices)
|
||||
with self.assertFprintError('Internal'):
|
||||
self.device.Release()
|
||||
|
||||
# And now it will be gone
|
||||
devices = self.manager.GetDevices()
|
||||
self.assertNotIn(self.device.get_object_path(), devices)
|
||||
|
||||
|
||||
class FPrintdVirtualDeviceClaimedTest(FPrintdVirtualDeviceBaseTest):
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue