Skip to content

Commit

Permalink
add tests for direct and indirect attestations
Browse files Browse the repository at this point in the history
  • Loading branch information
YSaxon authored and bodik committed Jun 9, 2023
1 parent 759b628 commit 769011f
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion tests/test_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,30 @@ def test_create():
assert device.rp_id == 'example.org'


def test_create_direct_attestation():
"""test for internal class check"""

device = SoftWebauthnDevice()
pkcco = copy.deepcopy(PKCCO)
pkcco['publicKey']['attestation'] = 'direct'
attestation = device.create(pkcco, 'https://example.org')
assert attestation
assert device.private_key
assert device.rp_id == 'example.org'


def test_create_indirect_attestation():
"""test that indirect returns same as direct (as allowed by spec))"""

device = SoftWebauthnDevice()
pkcco = copy.deepcopy(PKCCO)
pkcco['publicKey']['attestation'] = 'indirect'
attestation = device.create(pkcco, 'https://example.org')
assert attestation
assert device.private_key
assert device.rp_id == 'example.org'


def test_create_not_supported_type():
"""test for internal class check"""

Expand All @@ -74,7 +98,7 @@ def test_create_not_supported_attestation():

device = SoftWebauthnDevice()
pkcco = copy.deepcopy(PKCCO)
pkcco['publicKey']['attestation'] = 'direct'
pkcco['publicKey']['attestation'] = 'enterprise'

with pytest.raises(ValueError):
device.create(pkcco, 'https://example.org')
Expand Down

0 comments on commit 769011f

Please sign in to comment.