tests: Skip Gnuk only test.

This commit is contained in:
NIIBE Yutaka
2019-04-03 09:45:06 +09:00
parent fd493562c3
commit 2d50795d0a
2 changed files with 9 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
""" """
openpgp_card.py - a library for OpenPGP card openpgp_card.py - a library for OpenPGP card
Copyright (C) 2011, 2012, 2013, 2015, 2016, 2018 Copyright (C) 2011, 2012, 2013, 2015, 2016, 2018, 2019
Free Software Initiative of Japan Free Software Initiative of Japan
Author: NIIBE Yutaka <gniibe@fsij.org> Author: NIIBE Yutaka <gniibe@fsij.org>
@@ -59,6 +59,7 @@ class OpenPGP_Card(object):
self.__kdf_salt_user = None self.__kdf_salt_user = None
self.__kdf_salt_reset = None self.__kdf_salt_reset = None
self.__kdf_salt_admin = None self.__kdf_salt_admin = None
self.is_gnuk = (reader.get_string(2) == "Gnuk Token")
def configure_with_kdf(self): def configure_with_kdf(self):
kdf_data = self.cmd_get_data(0x00, 0xf9) kdf_data = self.cmd_get_data(0x00, 0xf9)

View File

@@ -1,7 +1,7 @@
""" """
test_004_reset_pw3.py - test resetting pw3 test_004_reset_pw3.py - test resetting pw3
Copyright (C) 2018 g10 Code GmbH Copyright (C) 2018, 2019 g10 Code GmbH
Author: NIIBE Yutaka <gniibe@fsij.org> Author: NIIBE Yutaka <gniibe@fsij.org>
This file is a part of Gnuk, a GnuPG USB Token implementation. This file is a part of Gnuk, a GnuPG USB Token implementation.
@@ -21,11 +21,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
""" """
from card_const import * from card_const import *
import pytest
# Gnuk specific feature of clear PW3 # Gnuk specific feature of clear PW3
def test_setup_pw3_null(card): def test_setup_pw3_null(card):
r = card.change_passwd(3, FACTORY_PASSPHRASE_PW3, None) if card.is_gnuk:
assert r r = card.change_passwd(3, FACTORY_PASSPHRASE_PW3, None)
assert r
else:
pytest.skip("Gnuk only feature of clearing PW3")
def test_verify_pw3(card): def test_verify_pw3(card):
v = card.verify(3, FACTORY_PASSPHRASE_PW3) v = card.verify(3, FACTORY_PASSPHRASE_PW3)