tests: Fix KDF required handling.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2022-07-12 14:47:32 +09:00
parent 98ac78624d
commit af3ebbca50
3 changed files with 11 additions and 8 deletions

View File

@ -79,6 +79,11 @@ class OpenPGP_Card(object):
except:
string4 = None
self.is_gnuk2 = (self.is_gnuk and string4 and string4[0:9] == "release/2")
try:
string5 = reader.get_string(5)
except:
string5 = None
self.kdf_required = (self.is_gnuk and string5 and string5[-12:] == "kdf=required")
self.initialize_kdf()
def add_to_key_attrlist(self, no, attr):

6
tests/skip_if_kdfreq.py Normal file
View File

@ -0,0 +1,6 @@
import pytest
@pytest.fixture(scope="module",autouse=True)
def check_kdfreq(card):
if card.kdf_required:
pytest.skip("Token requires KDF setup", allow_module_level=True)

View File

@ -1,8 +0,0 @@
import pytest
@pytest.fixture(scope="module",autouse=True)
def check_kdfreq(card):
if card.is_emulated_gnuk:
pytest.skip("Emulation requires KDF setup", allow_module_level=True)
if card.is_gnuk2:
pytest.skip("Gnuk2 requires KDF setup", allow_module_level=True)