mirror of
https://github.com/trussed-dev/fido2-tests.git
synced 2026-06-20 04:16:30 -07:00
improve applicability of some tests
This commit is contained in:
@@ -154,7 +154,7 @@ class TestMakeCredential(object):
|
||||
with pytest.raises(CtapError) as e:
|
||||
device.sendMC(*req.toMC())
|
||||
|
||||
assert e.value.code == CtapError.ERR.MISSING_PARAMETER
|
||||
assert e.value.code in [CtapError.ERR.MISSING_PARAMETER, CtapError.ERR.UNSUPPORTED_ALGORITHM]
|
||||
|
||||
def test_bad_type_pubKeyCredParams_alg(self, device, MCRes):
|
||||
req = FidoRequest(MCRes, key_params=[{"alg": "7", "type": "public-key"}])
|
||||
@@ -213,7 +213,7 @@ class TestMakeCredential(object):
|
||||
with pytest.raises(CtapError) as e:
|
||||
device.sendMC(*req.toMC())
|
||||
|
||||
def test_bad_type_exclude_list_type(self, device, MCRes, GARes):
|
||||
def test_exclude_list_excluded(self, device, MCRes, GARes):
|
||||
req = FidoRequest(MCRes, exclude_list=GARes.request.allow_list)
|
||||
|
||||
with pytest.raises(CtapError) as e:
|
||||
|
||||
@@ -188,11 +188,15 @@ class TestResidentKey(object):
|
||||
|
||||
@pytest.mark.skipif('trezor' in sys.argv, reason="Trezor does not support get_next_assertion() because it has a display.")
|
||||
@pytest.mark.skipif('solokeys' in sys.argv, reason="Initial SoloKeys model truncates displayName")
|
||||
def test_rk_maximum_list_capacity_per_rp_nodisplay(self, device, MC_RK_Res):
|
||||
def test_rk_maximum_list_capacity_per_rp_nodisplay(self, info, device, MC_RK_Res):
|
||||
"""
|
||||
Test maximum returned capacity of the RK for the given RP
|
||||
"""
|
||||
RK_CAPACITY_PER_RP = 19
|
||||
|
||||
# Try to determine from get_info, or default to 19.
|
||||
RK_CAPACITY_PER_RP = info.max_creds_in_list
|
||||
if not RK_CAPACITY_PER_RP: RK_CAPACITY_PER_RP = 19
|
||||
|
||||
users = []
|
||||
|
||||
def get_user():
|
||||
|
||||
@@ -46,15 +46,32 @@ class TestHID(object):
|
||||
r = device.send_data(CTAPHID.WINK, "")
|
||||
|
||||
def test_cbor_no_payload(self, device):
|
||||
with pytest.raises(CtapError) as e:
|
||||
r = device.send_data(CTAPHID.CBOR, "")
|
||||
assert e.value.code == CtapError.ERR.INVALID_LENGTH
|
||||
payload = b"\x11\x11\x11\x11\x11\x11\x11\x11"
|
||||
r = device.send_data(CTAPHID.INIT, payload)
|
||||
capabilities = r[16]
|
||||
|
||||
|
||||
if (capabilities ^ 0x04) != 0:
|
||||
print('Implements CBOR.')
|
||||
with pytest.raises(CtapError) as e:
|
||||
r = device.send_data(CTAPHID.CBOR, "")
|
||||
assert e.value.code == CtapError.ERR.INVALID_LENGTH
|
||||
else:
|
||||
print('CBOR is not implemented.')
|
||||
|
||||
def test_no_data_in_u2f_msg(self, device):
|
||||
with pytest.raises(CtapError) as e:
|
||||
r = device.send_data(CTAPHID.MSG, "")
|
||||
print(hexlify(r))
|
||||
assert e.value.code == CtapError.ERR.INVALID_LENGTH
|
||||
payload = b"\x11\x11\x11\x11\x11\x11\x11\x11"
|
||||
r = device.send_data(CTAPHID.INIT, payload)
|
||||
capabilities = r[16]
|
||||
|
||||
if (capabilities ^ 0x08) == 0:
|
||||
print("U2F implemented.")
|
||||
with pytest.raises(CtapError) as e:
|
||||
r = device.send_data(CTAPHID.MSG, "")
|
||||
print(hexlify(r))
|
||||
assert e.value.code == CtapError.ERR.INVALID_LENGTH
|
||||
else:
|
||||
print("U2F not implemented.")
|
||||
|
||||
def test_invalid_hid_cmd(self, device):
|
||||
r = device.send_data(CTAPHID.INIT, "\x11\x22\x33\x44\x55\x66\x77\x88")
|
||||
|
||||
Reference in New Issue
Block a user