From fbe8f668eb3ceb02a23f943d5db5070b0cafc401 Mon Sep 17 00:00:00 2001
From: Szczepan Zalega <szczepan@nitrokey.com>
Date: Sat, 19 Nov 2016 14:16:44 +0100
Subject: Test to configure getting HOTP codes through special key double press

Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
---
 unittest/test_pro.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

(limited to 'unittest')

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)
-- 
cgit v1.2.3