aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-08-09 11:50:25 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-08-09 18:34:00 +0200
commit6ab42afc6924a329d17ee9a2e3dcf01aca63a02e (patch)
treeb53be4747ddc46cd2ee32464861efac8f9ab629b
parent07ff4e8e935ba36b93b228e7ec268340e71ada77 (diff)
downloadlibnitrokey-6ab42afc6924a329d17ee9a2e3dcf01aca63a02e.tar.gz
libnitrokey-6ab42afc6924a329d17ee9a2e3dcf01aca63a02e.tar.bz2
Test for too long PIN
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r--unittest/test_bindings.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/unittest/test_bindings.py b/unittest/test_bindings.py
index 7816f41..d072bfc 100644
--- a/unittest/test_bindings.py
+++ b/unittest/test_bindings.py
@@ -187,6 +187,11 @@ def test_user_PIN_change(C):
assert C.NK_change_user_PIN(new_password, DefaultPasswords.USER) == DeviceErrorCode.STATUS_OK
+def test_too_long_PIN(C):
+ new_password = '123123123'
+ assert C.NK_change_user_PIN('a' * 100, new_password) == DeviceErrorCode.WRONG_PASSWORD
+
+
def test_admin_retry_counts(C):
default_admin_retry_count = 3
assert C.NK_get_admin_retry_count() == default_admin_retry_count
@@ -356,6 +361,7 @@ def test_get_OTP_codes(C):
if code == 0:
assert C.NK_get_last_command_status() == DeviceErrorCode.NOT_PROGRAMMED
+
def test_get_OTP_code_from_not_programmed_slot(C):
assert C.NK_first_authenticate(DefaultPasswords.ADMIN, DefaultPasswords.ADMIN_TEMP) == DeviceErrorCode.STATUS_OK
assert C.NK_erase_hotp_slot(0, DefaultPasswords.ADMIN_TEMP) == DeviceErrorCode.STATUS_OK