summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-07-27 12:38:18 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-08-01 13:54:57 +0200
commit0eceea93c199bb93f1dd4524f73f35699ad261dd (patch)
treeec23c72cabd9d9cfcfb2848265fcc285990b0c67
parent547c02f0c5d4195a3efe454b9e98c0d0a84d739c (diff)
downloadlibnitrokey-0eceea93c199bb93f1dd4524f73f35699ad261dd.tar.gz
libnitrokey-0eceea93c199bb93f1dd4524f73f35699ad261dd.tar.bz2
Comments for unit test
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r--unittest/test_bindings.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/unittest/test_bindings.py b/unittest/test_bindings.py
index 5606f2f..32a2ee8 100644
--- a/unittest/test_bindings.py
+++ b/unittest/test_bindings.py
@@ -229,9 +229,19 @@ def cast_pointer_to_tuple(obj, typen, len):
def test_read_write_config(C):
C.NK_set_debug(True)
+
+ # let's set sample config with pin protection and disabled capslock
+ assert C.NK_first_authenticate(DefaultPasswords.ADMIN, DefaultPasswords.ADMIN_TEMP) == DeviceErrorCode.STATUS_OK
+ assert C.NK_write_config(True, False, True, True, False, DefaultPasswords.ADMIN_TEMP) == DeviceErrorCode.STATUS_OK
+ config_raw_data = C.NK_read_config()
+ assert C.NK_get_last_command_status() == DeviceErrorCode.STATUS_OK
+ config = cast_pointer_to_tuple(config_raw_data, 'uint8_t', 5)
+ assert config == (True, False, True, True, False)
+
+ # restore defaults and check
assert C.NK_first_authenticate(DefaultPasswords.ADMIN, DefaultPasswords.ADMIN_TEMP) == DeviceErrorCode.STATUS_OK
assert C.NK_write_config(True, True, True, False, True, DefaultPasswords.ADMIN_TEMP) == DeviceErrorCode.STATUS_OK
config_raw_data = C.NK_read_config()
+ assert C.NK_get_last_command_status() == DeviceErrorCode.STATUS_OK
config = cast_pointer_to_tuple(config_raw_data, 'uint8_t', 5)
assert config == (True, True, True, False, True)
-