tests/fprintd: Verify that each enroll stage happens

Instead of automatically replying with the 'whorl' image for every enroll
state signal with result 'enroll-stage-passed', only perform the number
of required enroll stages and ensure that we get the expected results.

This also will allow to manually perform enroll steps in other tests.
This commit is contained in:
Marco Trevisan (Treviño)
2020-02-07 21:18:57 +01:00
committed by Bastien Nocera
parent dbabd4d7d3
commit c12778ec5b

View File

@ -307,8 +307,9 @@ class FPrintdVirtualDeviceTest(FPrintdTest):
self._abort = params[1]
self._last_result = params[0]
if not self._abort and self._last_result == 'enroll-stage-passed':
self.send_image('whorl')
if not self._abort and self._last_result.startswith('enroll-'):
# Exit wait loop, onto next enroll state (if any)
self._abort = True
elif self._abort:
pass
else:
@ -354,8 +355,13 @@ class FPrintdVirtualDeviceTest(FPrintdTest):
def enroll_image(self, img, finger='right-index-finger'):
self.device.EnrollStart('(s)', finger)
self.send_image(img)
self.wait_for_result()
stages = self.device.get_cached_property('num-enroll-stages').unpack()
for stage in range(stages):
self.send_image(img)
if stage < stages - 1:
self.wait_for_result('enroll-stage-passed')
else:
self.wait_for_result('enroll-completed')
self.device.EnrollStop()
self.assertEqual(self._last_result, 'enroll-completed')