mirror of
https://gitlab.com/mishakmak/pam-fprint-grosshack.git
synced 2026-04-08 20:03:34 +02:00
tests: Check that PAM stops if the device could not be claimed
This commit is contained in:
@ -429,3 +429,11 @@ def SetVerifyScript(device, script):
|
||||
'''
|
||||
|
||||
device.verify_script = script
|
||||
|
||||
@dbus.service.method(DEVICE_MOCK_IFACE,
|
||||
in_signature='s', out_signature='')
|
||||
def SetClaimed(device, user):
|
||||
if user == '':
|
||||
device.claimed_user = None
|
||||
else:
|
||||
device.claimed_user = user
|
||||
|
||||
@ -252,6 +252,20 @@ class TestPamFprintd(dbusmock.DBusTestCase):
|
||||
self.assertRegex(res.errors[1], r'Failed to match fingerprint')
|
||||
self.assertRegex(res.errors[2], r'Failed to match fingerprint')
|
||||
|
||||
def test_pam_already_claimed(self):
|
||||
self.setup_device()
|
||||
script = [
|
||||
( 'verify-match', True, 2 )
|
||||
]
|
||||
self.device_mock.SetVerifyScript(script)
|
||||
self.device_mock.SetClaimed('toto')
|
||||
|
||||
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.info), 0)
|
||||
self.assertEqual(len(res.errors), 0)
|
||||
|
||||
def test_pam_timeout(self):
|
||||
self.setup_device()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user