From 8d8c181f315f1a32cda03fc360527940e4cfe0ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Sat, 23 Jan 2021 21:22:10 +0100 Subject: [PATCH] tests/fprintd: Check that errors happening after we got a result are ignored --- tests/fprintd.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/fprintd.py b/tests/fprintd.py index 1f586e8..d40ba77 100644 --- a/tests/fprintd.py +++ b/tests/fprintd.py @@ -558,8 +558,14 @@ class FPrintdVirtualDeviceBaseTest(FPrintdTest): super().tearDown() - def wait_for_result(self, expected=None): + def wait_for_result(self, expected=None, max_wait=-1): self._abort = False + + if max_wait > 0: + def abort_timeout(): + self._abort = True + GLib.timeout_add(max_wait, abort_timeout) + while not self._abort: ctx.iteration(True) @@ -2078,6 +2084,19 @@ class FPrintdVirtualDeviceVerificationTests(FPrintdVirtualDeviceBaseTest): self.assertIn(GLib.Variant('()', ()), self.get_all_async_replies()) + def test_verify_error_ignored_after_report(self): + with Connection(self.sockaddr) as con: + self.send_finger_automatic(False, con=con) + self.send_finger_report(True, con=con) + self.send_image('whorl', con=con) + self.wait_for_result() + + self.assertTrue(self._verify_stopped) + self.assertEqual(self._last_result, 'verify-match') + + self.send_error(con=con) + self.wait_for_result(max_wait=200, expected='verify-match') + class FPrintdVirtualDeviceIdentificationTests(FPrintdVirtualDeviceVerificationTests): '''This class will just repeat the tests of FPrintdVirtualDeviceVerificationTests