virtual-device: Return an duplicated data error if trying to re-enroll a print
This commit is contained in:
parent
36304b736b
commit
d90ee96df8
2 changed files with 17 additions and 0 deletions
|
@ -558,6 +558,16 @@ dev_enroll (FpDevice *dev)
|
||||||
GVariant *data;
|
GVariant *data;
|
||||||
gboolean completed;
|
gboolean completed;
|
||||||
|
|
||||||
|
if (self->prints_storage && g_hash_table_contains (self->prints_storage, id))
|
||||||
|
{
|
||||||
|
if (should_wait_to_sleep (self, id, error))
|
||||||
|
return;
|
||||||
|
|
||||||
|
fpi_device_enroll_complete (dev, NULL,
|
||||||
|
fpi_device_error_new (FP_DEVICE_ERROR_DATA_DUPLICATE));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (self->enroll_stages_passed == 0)
|
if (self->enroll_stages_passed == 0)
|
||||||
{
|
{
|
||||||
fpi_print_set_type (print, FPI_PRINT_RAW);
|
fpi_print_set_type (print, FPI_PRINT_RAW);
|
||||||
|
|
|
@ -613,6 +613,13 @@ class VirtualDeviceStorage(VirtualDevice):
|
||||||
self.assertFalse(self.dev.supports_capture())
|
self.assertFalse(self.dev.supports_capture())
|
||||||
self.assertTrue(self.dev.has_storage())
|
self.assertTrue(self.dev.has_storage())
|
||||||
|
|
||||||
|
def test_duplicate_enroll(self):
|
||||||
|
self.enroll_print('testprint', FPrint.Finger.LEFT_LITTLE)
|
||||||
|
with self.assertRaises(GLib.Error) as error:
|
||||||
|
self.enroll_print('testprint', FPrint.Finger.LEFT_LITTLE)
|
||||||
|
self.assertTrue(error.exception.matches(FPrint.DeviceError.quark(),
|
||||||
|
FPrint.DeviceError.DATA_DUPLICATE))
|
||||||
|
|
||||||
def test_list_empty(self):
|
def test_list_empty(self):
|
||||||
self.assertFalse(self.dev.list_prints_sync())
|
self.assertFalse(self.dev.list_prints_sync())
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue