tests: Verify PAM VerifyStop/disconnect behaviour

For verify-match, the PAM module should simply drop off the bus. In
other cases it should correctly run VerifyStop and Release the device.
Verify this for verify-match and verify-no-match.
This commit is contained in:
Benjamin Berg
2021-07-31 10:13:21 +02:00
parent bb23b7e9d0
commit 37e6939fa9

View File

@ -143,6 +143,12 @@ class TestPamFprintd(dbusmock.DBusTestCase):
self.assertRegex(res.info[0], r'Swipe your left little finger across the fingerprint reader') self.assertRegex(res.info[0], r'Swipe your left little finger across the fingerprint reader')
self.assertEqual(len(res.errors), 0) self.assertEqual(len(res.errors), 0)
# Check that we can stop verification and release the device. i.e.
# this has not been done by PAM already (the real fprintd would notice
# the disconnect, the mock service does not).
self.device_mock.VerifyStop()
self.device_mock.Release()
def test_pam_fprintd_no_fingers(self): def test_pam_fprintd_no_fingers(self):
self.setup_device() self.setup_device()
self.device_mock.SetEnrolledFingers('toto', dbus.Array(set([]), signature='s')) self.device_mock.SetEnrolledFingers('toto', dbus.Array(set([]), signature='s'))
@ -199,6 +205,13 @@ class TestPamFprintd(dbusmock.DBusTestCase):
self.assertRegex(res.errors[0], r'Failed to match fingerprint') self.assertRegex(res.errors[0], r'Failed to match fingerprint')
self.assertRegex(res.errors[0], r'Failed to match fingerprint') self.assertRegex(res.errors[0], r'Failed to match fingerprint')
# Check that we can cannot stop verification or release the device. i.e.
# PAM should have correctly done this after verification was done.
with self.assertRaisesRegex(dbus.exceptions.DBusException, r'net\.reactivated\.Fprint\.Error\.NoActionInProgress'):
self.device_mock.VerifyStop()
with self.assertRaisesRegex(dbus.exceptions.DBusException, r'net\.reactivated\.Fprint\.Error\.ClaimDevice'):
self.device_mock.Release()
def test_pam_fprintd_blocks_unexpected_auth2(self): def test_pam_fprintd_blocks_unexpected_auth2(self):
self.setup_device() self.setup_device()
script = [ script = [