aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-12-09 11:09:45 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2016-12-09 14:06:49 +0100
commite75f9a54e0a696de47f00dce980b1a3b9feddee2 (patch)
treedbccf8a175147d3a366d748b12f2a94204883e64
parent60d744fec7d20fb93b5152f3a7db0101009831cb (diff)
downloadlibnitrokey-e75f9a54e0a696de47f00dce980b1a3b9feddee2.tar.gz
libnitrokey-e75f9a54e0a696de47f00dce980b1a3b9feddee2.tar.bz2
Code reformat in library test
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r--unittest/test_library.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/unittest/test_library.py b/unittest/test_library.py
index bd44e89..ec00a5a 100644
--- a/unittest/test_library.py
+++ b/unittest/test_library.py
@@ -3,6 +3,7 @@ import pytest
from misc import ffi, gs, to_hex, is_pro_rtm_07, is_long_OTP_secret_handled
from constants import DefaultPasswords, DeviceErrorCode, RFC_SECRET, LibraryErrors
+
def test_too_long_strings(C):
new_password = '123123123'
long_string = 'a' * 100
@@ -35,6 +36,7 @@ def test_invalid_slot(C):
assert gs(C.NK_get_password_safe_slot_login(invalid_slot)) == ''
assert C.NK_get_last_command_status() == LibraryErrors.INVALID_SLOT
+
@pytest.mark.parametrize("invalid_hex_string",
['text', '00 ', '0xff', 'zzzzzzzzzzzz', 'fff', 'f' * 257, 'f' * 258])
def test_invalid_secret_hex_string_for_OTP_write(C, invalid_hex_string):
@@ -48,7 +50,6 @@ def test_invalid_secret_hex_string_for_OTP_write(C, invalid_hex_string):
assert C.NK_write_totp_slot(1, 'python_test', invalid_hex_string, 30, True, False, False, "",
DefaultPasswords.ADMIN_TEMP) == LibraryErrors.INVALID_HEX_STRING
-
def test_warning_binary_bigger_than_secret_buffer(C):
invalid_hex_string = to_hex('1234567890') * 3
if is_long_OTP_secret_handled(C):