diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2016-08-05 09:58:51 +0200 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2016-08-05 10:19:25 +0200 |
commit | 7c68a2d027da456d1fc92c67c98bee77ffdc5097 (patch) | |
tree | 6a7c1e2c2384dedf76f3f0d06eeb4d047c1074c0 /unittest/test_bindings.py | |
parent | bc5261c18a4608806dcb866afb73f7a979e2e90f (diff) | |
download | libnitrokey-7c68a2d027da456d1fc92c67c98bee77ffdc5097.tar.gz libnitrokey-7c68a2d027da456d1fc92c67c98bee77ffdc5097.tar.bz2 |
Test user password unlock
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'unittest/test_bindings.py')
-rw-r--r-- | unittest/test_bindings.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/unittest/test_bindings.py b/unittest/test_bindings.py index 7aed44e..0290fd6 100644 --- a/unittest/test_bindings.py +++ b/unittest/test_bindings.py @@ -199,6 +199,25 @@ def test_user_retry_counts(C): assert C.NK_get_user_retry_count() == default_user_retry_count +def test_unlock_user_password(C): + C.NK_set_debug(True) + default_user_retry_count = 3 + default_admin_retry_count = 3 + new_password = '123123123' + assert C.NK_get_user_retry_count() == default_user_retry_count + assert C.NK_change_user_PIN('wrong_password', new_password) == DeviceErrorCode.WRONG_PASSWORD + assert C.NK_change_user_PIN('wrong_password', new_password) == DeviceErrorCode.WRONG_PASSWORD + assert C.NK_change_user_PIN('wrong_password', new_password) == DeviceErrorCode.WRONG_PASSWORD + assert C.NK_get_user_retry_count() == default_user_retry_count - 3 + assert C.NK_get_admin_retry_count() == default_admin_retry_count + + assert C.NK_unlock_user_password('wrong password', DefaultPasswords.USER) == DeviceErrorCode.WRONG_PASSWORD + assert C.NK_get_admin_retry_count() == default_admin_retry_count - 1 + assert C.NK_unlock_user_password(DefaultPasswords.ADMIN, DefaultPasswords.USER) == DeviceErrorCode.STATUS_OK + assert C.NK_get_user_retry_count() == default_user_retry_count + assert C.NK_get_admin_retry_count() == default_admin_retry_count + + def test_admin_auth(C): assert C.NK_first_authenticate('wrong_password', DefaultPasswords.ADMIN_TEMP) == DeviceErrorCode.WRONG_PASSWORD assert C.NK_first_authenticate(DefaultPasswords.ADMIN, DefaultPasswords.ADMIN_TEMP) == DeviceErrorCode.STATUS_OK |