summaryrefslogtreecommitdiff
path: root/unittest/test_pro.py
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-11-19 14:16:44 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2016-12-03 16:01:51 +0100
commitfbe8f668eb3ceb02a23f943d5db5070b0cafc401 (patch)
tree1b204ffe397d88a442433ae0d7bd6167fedada7d /unittest/test_pro.py
parentb33681083348588caa3db3885c811a3c42d5b094 (diff)
downloadlibnitrokey-fbe8f668eb3ceb02a23f943d5db5070b0cafc401.tar.gz
libnitrokey-fbe8f668eb3ceb02a23f943d5db5070b0cafc401.tar.bz2
Test to configure getting HOTP codes through special key double press
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'unittest/test_pro.py')
-rw-r--r--unittest/test_pro.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/unittest/test_pro.py b/unittest/test_pro.py
index b8109f2..aaf884f 100644
--- a/unittest/test_pro.py
+++ b/unittest/test_pro.py
@@ -631,6 +631,25 @@ def test_HOTP_secrets(C, secret):
assert dev_res == lib_res
+def test_special_double_press(C):
+ """
+ requires manual check after function run
+ double press each of num-, scroll-, caps-lock and check inserted OTP codes (each 1st should be 755224)
+ on nkpro 0.7 scrolllock should do nothing, on nkpro 0.8+ should return OTP code
+ """
+ secret = RFC_SECRET
+ counter = 0
+ PIN_protection = False
+ use_8_digits = False
+ assert C.NK_first_authenticate(DefaultPasswords.ADMIN, DefaultPasswords.ADMIN_TEMP) == DeviceErrorCode.STATUS_OK
+ assert C.NK_write_config(0, 1, 2, PIN_protection, not PIN_protection,
+ DefaultPasswords.ADMIN_TEMP) == DeviceErrorCode.STATUS_OK
+ for slot_number in range(3):
+ assert C.NK_first_authenticate(DefaultPasswords.ADMIN, DefaultPasswords.ADMIN_TEMP) == DeviceErrorCode.STATUS_OK
+ assert C.NK_write_hotp_slot(slot_number, 'double' + str(slot_number), secret, counter, use_8_digits, False, False, "",
+ DefaultPasswords.ADMIN_TEMP) == DeviceErrorCode.STATUS_OK
+ # requires manual check
+
def test_edit_OTP_slot(C):
"""
should change slots counter and name without changing its secret (using null secret for second update)