From ba4d36c38c0017415129a5674c0f7133e6d76f9d Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Tue, 9 Aug 2016 15:33:26 +0200 Subject: Return error on invalid slot Signed-off-by: Szczepan Zalega --- unittest/test_bindings.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'unittest') 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): -- cgit v1.2.3