aboutsummaryrefslogtreecommitdiff
path: root/unittest
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-07-26 22:11:10 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-08-01 13:54:57 +0200
commit1018b7a7d8d7da124d706bc5d6679c523e5f1d0f (patch)
treef859f7d8cd59c14131f58c6bc4c34c41e00604b8 /unittest
parent7d71398f4043c10c3870cb9deb2eae7bf1c5f0ee (diff)
downloadlibnitrokey-1018b7a7d8d7da124d706bc5d6679c523e5f1d0f.tar.gz
libnitrokey-1018b7a7d8d7da124d706bc5d6679c523e5f1d0f.tar.bz2
Handle password safe slots programmed status
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'unittest')
-rw-r--r--unittest/test_bindings.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/unittest/test_bindings.py b/unittest/test_bindings.py
index 4d749bd..9591751 100644
--- a/unittest/test_bindings.py
+++ b/unittest/test_bindings.py
@@ -90,12 +90,17 @@ def test_erase_password_safe_slot(C):
assert C.NK_enable_password_safe(DefaultPasswords.USER) == DeviceErrorCode.STATUS_OK
assert C.NK_erase_password_safe_slot(0) == DeviceErrorCode.STATUS_OK
assert gs(C.NK_get_password_safe_slot_name(0, DefaultPasswords.ADMIN_TEMP)) == ''
- assert C.NK_get_last_command_status() == DeviceErrorCode.STATUS_OK # TODO shouldn't be DeviceErrorCode.NOT_PROGRAMMED ?
+ assert C.NK_get_last_command_status() == DeviceErrorCode.STATUS_OK # TODO CHECK shouldn't this be DeviceErrorCode.NOT_PROGRAMMED ?
def test_password_safe_slot_status(C):
C.NK_set_debug(True)
- assert C.NK_get_password_safe_slot_status() == DeviceErrorCode.STATUS_OK
+ safe_slot_status = C.NK_get_password_safe_slot_status()
+ assert C.NK_get_last_command_status() == DeviceErrorCode.STATUS_OK
+ is_slot_programmed = list(ffi.cast("uint8_t [16]", safe_slot_status)[0:16])
+ print ((is_slot_programmed, len(is_slot_programmed)))
+ assert is_slot_programmed[0] == 0 # FIXME not programmed, assuming erased in preceeding test, add writing and erasing
+ assert is_slot_programmed[1] == 1 # FIXME assuming slot 1 is programmed, not writing there in this tests, same as ^
C.NK_set_debug(False)