Skip to content

Commit

Permalink
Allow test to run on all FW versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
dainnilsson committed Jan 11, 2024
1 parent 42cee4e commit 98e6b72
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tests/device/cli/piv/test_pin_puk.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
NON_DEFAULT_PUK,
DEFAULT_MANAGEMENT_KEY,
)
from ... import condition
from ykman.piv import OBJECT_ID_PIVMAN_DATA, PivmanData

import pytest
Expand Down Expand Up @@ -98,7 +97,7 @@ def test_unblock_pin(self, ykman_cli):


class TestSetRetries:
def test_set_retries(self, ykman_cli):
def test_set_retries(self, ykman_cli, version):
ykman_cli(
"piv",
"access",
Expand All @@ -110,11 +109,22 @@ def test_set_retries(self, ykman_cli):

o = ykman_cli("piv", "info").output
assert re.search(r"PIN tries remaining:\s+5(/5)?", o)
if re.search(r"PUK tries remaining", o):
if version >= (5, 3):
assert re.search(r"PUK tries remaining:\s+6/6", o)

@condition.min_version(5, 3)
def test_set_retries_clears_puk_blocked(self, ykman_cli):
for _ in range(3):
with pytest.raises(SystemExit):
ykman_cli(
"piv",
"access",
"change-puk",
"-p",
NON_DEFAULT_PUK,
"-n",
DEFAULT_PUK,
)

pivman = PivmanData()
pivman.puk_blocked = True

Expand Down

0 comments on commit 98e6b72

Please sign in to comment.