Fix user presence by not overwriting error with OK() (#521)

* Fix user presence by not overwriting error with OK()

* revert debugging change to TOUCH_TIMEOUT_MS

* fix up incomplete merge

* rename variable to more understandable name

* Add tests to test user_presence
This commit is contained in:
Liam Murphy
2022-08-02 19:38:02 +10:00
committed by GitHub
parent 253d27d612
commit 6276904a42
3 changed files with 46 additions and 8 deletions

View File

@@ -341,16 +341,22 @@ class CancelTests(unittest.TestCase):
self.fido,
'https://example.com',
user_interaction=CliInteraction(cid + 1, connection))
# TODO(https://github.com/google/OpenSK/issues/519): This should be an
# exception
client.make_credential(self.create_options['publicKey'])
with self.assertRaises(ClientError) as context:
client.make_credential(self.create_options['publicKey'])
self.assertEqual(context.exception.code, ClientError.ERR.TIMEOUT)
self.assertEqual(context.exception.cause.code,
ctap.CtapError.ERR.USER_ACTION_TIMEOUT)
def test_timeout(self):
client = Fido2Client(
self.fido, 'https://example.com', user_interaction=CliInteraction())
# TODO(https://github.com/google/OpenSK/issues/519): This should be an
# exception
client.make_credential(self.create_options['publicKey'])
with self.assertRaises(ClientError) as context:
client.make_credential(self.create_options['publicKey'])
self.assertEqual(context.exception.code, ClientError.ERR.TIMEOUT)
self.assertEqual(context.exception.cause.code,
ctap.CtapError.ERR.USER_ACTION_TIMEOUT)
if __name__ == '__main__':