From 4435706d20d15978c46f1ca43d965afe81292ea0 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Sat, 5 Dec 2020 00:56:26 +0100 Subject: [PATCH] tests: Add test that PAM gives up when daemon disappears --- tests/pam/test_pam_fprintd.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/pam/test_pam_fprintd.py b/tests/pam/test_pam_fprintd.py index d40bb96..fd7ab0d 100755 --- a/tests/pam/test_pam_fprintd.py +++ b/tests/pam/test_pam_fprintd.py @@ -273,6 +273,19 @@ class TestPamFprintd(dbusmock.DBusTestCase): res = pypamtest.run_pamtest("toto", "fprintd-pam-test", [tc], [ 'unused' ]) self.assertRegex(res.info[1], r'Verification timed out') + def test_pam_notices_fprintd_disappearing(self): + self.setup_device() + + script = [ + ( 'MOCK: quit', True, 0 ), + ] + self.device_mock.SetVerifyScript(script) + + tc = pypamtest.TestCase(pypamtest.PAMTEST_AUTHENTICATE, expected_rv=PAM_AUTHINFO_UNAVAIL) + res = pypamtest.run_pamtest("toto", "fprintd-pam-test", [tc], [ 'unused' ]) + self.assertEqual(len(res.errors), 0) + self.assertEqual(len(res.info), 0) + if __name__ == '__main__': if 'PAM_WRAPPER_SERVICE_DIR' not in os.environ: print('Cannot run test without environment set correctly, run "meson test" instead')