virtual-device: Make possible to inject sleep events while verifying/identifying

Each command should be separated by SLEEP to be considered as something
we want to perform during the current operation, otherwise will be used
by next operation consuming it.
This commit is contained in:
Marco Trevisan (Treviño)
2021-01-26 03:37:16 +01:00
parent 1dae6796f7
commit 7ffcc2f9e7
4 changed files with 110 additions and 8 deletions

View File

@@ -526,6 +526,25 @@ class VirtualDevice(unittest.TestCase):
self.assertFalse(self._verify_completed)
self.cancel_verify()
def test_device_sleep_before_completing_verify(self):
enrolled = self.enroll_print('foo-print', FPrint.Finger.LEFT_RING)
self.send_command('SLEEP', 100)
self.start_verify(enrolled, identify=self.dev.supports_identify())
self.send_command('SCAN', 'bar-print')
self.send_command('SLEEP', 800)
while not self._verify_reported:
ctx.iteration(False)
self.assertFalse(self._verify_completed)
self.wait_timeout(10)
self.assertFalse(self._verify_completed)
self.complete_verify()
self.assertTrue(self._verify_reported)
class VirtualDeviceStorage(VirtualDevice):
def tearDown(self):