Skip to content

Commit

Permalink
Add registration service tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterKale committed Dec 5, 2024
1 parent 108b658 commit c388eb4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions _app/homepage/tests/test_registration_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from webauthn.helpers.cose import COSEAlgorithmIdentifier
from webauthn.helpers.structs import (
PublicKeyCredentialParameters,
PublicKeyCredentialHint,
AttestationConveyancePreference,
AuthenticatorAttachment,
ResidentKeyRequirement,
Expand Down Expand Up @@ -72,3 +73,24 @@ def test_options_pub_key_alg_ed25519_is_first(self):
options.pub_key_cred_params[0],
PublicKeyCredentialParameters(alg=COSEAlgorithmIdentifier.EDDSA, type="public-key"),
)

def test_parse_hints(self) -> None:
options = self.service.generate_registration_options(
username="mmiller",
algorithms=["ed25519", "es256"],
attachment="all",
attestation="direct",
discoverable_credential="required",
existing_credentials=[],
user_verification="discouraged",
hints=["client-device", "security-key", "hybrid"],
)

self.assertEqual(
options.hints,
[
PublicKeyCredentialHint.CLIENT_DEVICE,
PublicKeyCredentialHint.SECURITY_KEY,
PublicKeyCredentialHint.HYBRID,
],
)

0 comments on commit c388eb4

Please sign in to comment.