Skip to content

Commit 2a77a16

Browse files
committed
Add test for deleted credential cleanup
1 parent cefbf87 commit 2a77a16

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

python_tests/ctap/test_credprotect.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,35 @@ def test_low_sec_credprotect(self):
212212
})
213213

214214

215+
class CredProtectDeletionTestCase(CredManagementBaseTestCase):
216+
@parameterized.expand([
217+
("Level 3R", CredProtectExtension.POLICY.REQUIRED),
218+
("Level 2R", CredProtectExtension.POLICY.OPTIONAL_WITH_LIST),
219+
("Level 1R", CredProtectExtension.POLICY.OPTIONAL),
220+
])
221+
def test_deleted_creds_are_gone(self, _, policy):
222+
client = self.get_high_level_client(extensions=[CredProtectExtension],
223+
user_interaction=FixedPinUserInteraction(self.pin))
224+
resident_key = ResidentKeyRequirement.REQUIRED
225+
226+
cred = client.make_credential(options=self.get_high_level_make_cred_options(
227+
resident_key,
228+
{
229+
"credentialProtectionPolicy": policy
230+
}
231+
))
232+
233+
cm = self.get_credential_management()
234+
cm.delete_cred(self.get_descriptor_from_cred(cred))
235+
236+
with self.assertRaises(ClientError) as e:
237+
client.get_assertion(self.get_high_level_assertion_opts_from_cred(cred))
238+
self.assertEqual(CtapError.ERR.NO_CREDENTIALS, e.exception.cause.code)
239+
240+
with self.assertRaises(ClientError) as e:
241+
client.get_assertion(self.get_high_level_assertion_opts_from_cred(cred=None, rp_id=self.rp_id))
242+
self.assertEqual(CtapError.ERR.NO_CREDENTIALS, e.exception.cause.code)
243+
215244

216245
class CredProtectRKVisTestCase(CredManagementBaseTestCase):
217246
@parameterized.expand([

0 commit comments

Comments
 (0)