summaryrefslogtreecommitdiff
path: root/unittest
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-08-05 19:48:32 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-08-05 20:32:45 +0200
commitb9b6eb6d618915a8ee693e345448d2bcd39779cc (patch)
treefbba8c4089236f82f65f36e8a35a9d678cfe48da /unittest
parente9c165399bc87e9d283845efdd2d667061b1e323 (diff)
downloadlibnitrokey-b9b6eb6d618915a8ee693e345448d2bcd39779cc.tar.gz
libnitrokey-b9b6eb6d618915a8ee693e345448d2bcd39779cc.tar.bz2
Use device autodetection in tests
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'unittest')
-rw-r--r--unittest/test_bindings.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/unittest/test_bindings.py b/unittest/test_bindings.py
index 5688adb..da5a4e4 100644
--- a/unittest/test_bindings.py
+++ b/unittest/test_bindings.py
@@ -42,7 +42,10 @@ def C(request):
C = ffi.dlopen("../build/libnitrokey.so")
C.NK_set_debug(False)
- C.NK_login('P')
+ nk_login = C.NK_login_auto()
+ if nk_login != 1:
+ print ('No devices detected!')
+ assert nk_login == 1 # returns 0 if not connected or wrong model or 1 when connected
# assert C.NK_first_authenticate(DefaultPasswords.ADMIN, DefaultPasswords.ADMIN_TEMP) == DeviceErrorCode.STATUS_OK
# assert C.NK_user_authenticate(DefaultPasswords.USER, DefaultPasswords.USER_TEMP) == DeviceErrorCode.STATUS_OK
@@ -116,7 +119,8 @@ def test_password_safe_slot_status(C):
assert is_slot_programmed[1] == 1
-@pytest.mark.xfail(run=False, reason="issue to register: device locks up after below commands sequence (reinsertion fixes), skipping for now")
+@pytest.mark.xfail(run=False, reason="issue to register: device locks up "
+ "after below commands sequence (reinsertion fixes), skipping for now")
def test_issue_device_locks_on_second_key_generation_in_sequence(C):
assert C.NK_build_aes_key(DefaultPasswords.ADMIN) == DeviceErrorCode.STATUS_OK
assert C.NK_build_aes_key(DefaultPasswords.ADMIN) == DeviceErrorCode.STATUS_OK