diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2016-08-09 15:33:26 +0200 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2016-08-09 18:34:00 +0200 |
commit | ba4d36c38c0017415129a5674c0f7133e6d76f9d (patch) | |
tree | 8f96d247300f66df1ec5bf5cba3e56db903509a4 /unittest/test_bindings.py | |
parent | 9d6e045a3143f8eb31c5033c9c4be59cc2f73336 (diff) | |
download | libnitrokey-ba4d36c38c0017415129a5674c0f7133e6d76f9d.tar.gz libnitrokey-ba4d36c38c0017415129a5674c0f7133e6d76f9d.tar.bz2 |
Return error on invalid slot
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'unittest/test_bindings.py')
-rw-r--r-- | unittest/test_bindings.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/unittest/test_bindings.py b/unittest/test_bindings.py index 9eebcb3..7b16a46 100644 --- a/unittest/test_bindings.py +++ b/unittest/test_bindings.py @@ -210,9 +210,19 @@ def test_too_long_strings(C): assert C.NK_get_last_command_status() == LibraryErrors.TOO_LONG_STRING -# def test_invalid_slot(C): -# invalid_slot = 255 -# assert C.NK_erase_totp_slot(invalid_slot, 'some password') == LibraryErrors.INVALID_SLOT +def test_invalid_slot(C): + invalid_slot = 255 + assert C.NK_erase_totp_slot(invalid_slot, 'some password') == LibraryErrors.INVALID_SLOT + assert C.NK_write_hotp_slot(invalid_slot, 'long_test', RFC_SECRET, 0, False, False, False, "", + 'aaa') == LibraryErrors.INVALID_SLOT + assert C.NK_get_hotp_code_PIN(invalid_slot, 'some password') == 0 + assert C.NK_get_last_command_status() == LibraryErrors.INVALID_SLOT + assert C.NK_erase_password_safe_slot(invalid_slot) == LibraryErrors.INVALID_SLOT + assert C.NK_enable_password_safe(DefaultPasswords.USER) == DeviceErrorCode.STATUS_OK + assert gs(C.NK_get_password_safe_slot_name(invalid_slot)) == '' + assert C.NK_get_last_command_status() == LibraryErrors.INVALID_SLOT + assert gs(C.NK_get_password_safe_slot_login(invalid_slot)) == '' + assert C.NK_get_last_command_status() == LibraryErrors.INVALID_SLOT def test_admin_retry_counts(C): |