diff options
Diffstat (limited to 'unittest/test_bindings.py')
-rw-r--r-- | unittest/test_bindings.py | 12 |
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) - |