Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests #30

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,5 @@

fido2 >=1.1,<2
pexpect >=4,<5
pynitrokey ==0.4.38
pynitrokey ==0.4.40
pytest >=7,<8

# pyyaml is broken with cython 3
# see https://github.com/yaml/pyyaml/issues/724
pyyaml !=6.0.0,!=5.4.0,!=5.4.1
18 changes: 9 additions & 9 deletions tests/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def verify(self, fido2, credential):
fido2.authenticate([credential])


def test_fido2(touch_device):
TestFido2().run(touch_device)
def test_fido2(device):
TestFido2().run(device)


class TestFido2Resident(UpgradeTest):
Expand Down Expand Up @@ -85,8 +85,8 @@ def verify(self, device, credential):
p.expect("successfully deleted")


def test_fido2_resident(touch_device):
TestFido2Resident().run(touch_device)
def test_fido2_resident(device):
TestFido2Resident().run(device)


class TestSecrets(UpgradeTest):
Expand All @@ -98,7 +98,7 @@ def __init__(self):

def _spawn_with_pin(self, s):
p = spawn(s)
p.expect("Current Password")
p.expect("Current PIN")
p.sendline(self.pin)
return p

Expand Down Expand Up @@ -132,14 +132,14 @@ def prepare(self, device):
p.expect("Password set")

p = self._spawn_with_pin(
"nitropy nk3 secrets register --kind HOTP test_hotp "
"GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ"
"nitropy nk3 secrets register --kind HOTP --protect-with-pin "
"test_hotp GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ"
)
p.expect(EOF)

p = self._spawn_with_pin(
"nitropy nk3 secrets register --kind TOTP test_totp "
"GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ"
"nitropy nk3 secrets register --kind TOTP --protect-with-pin "
"test_totp GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ"
)
p.expect(EOF)

Expand Down
7 changes: 6 additions & 1 deletion tests/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,18 @@ def test(test: Type[ExecUpgradeTest], serial: str, ifs: str, efs: str) -> None:
test().run_upgrade(serial, ifs, efs)


@pytest.mark.virtual
def test_fido2(serial: str, ifs: str, efs: str) -> None:
tests.basic.TestFido2().run_upgrade(serial, ifs, efs)


@pytest.mark.virtual
def test_fido2_resident(serial: str, ifs: str, efs: str) -> None:
tests.basic.TestFido2Resident().run_upgrade(serial, ifs, efs)


@pytest.mark.virtual
def test_secrets_resident(serial: str, ifs: str, efs: str) -> None:
def test_secrets(serial: str, ifs: str, efs: str) -> None:
tests.basic.TestSecrets().run_upgrade(serial, ifs, efs)


Expand Down