diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2017-10-04 18:36:50 +0200 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2017-10-10 15:51:16 +0200 |
commit | b084e6b1e47a11a1c71cf686ccdc35b08b4e17b4 (patch) | |
tree | 1bac0aa650e4cba38b7d4e097aa8ccc74d563158 | |
parent | 328eb15d5a1bd170ac44b3daa612e80909311615 (diff) | |
download | libnitrokey-b084e6b1e47a11a1c71cf686ccdc35b08b4e17b4.tar.gz libnitrokey-b084e6b1e47a11a1c71cf686ccdc35b08b4e17b4.tar.bz2 |
Make sure hidden volumes are created before unlocking them
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r-- | unittest/test_storage.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/unittest/test_storage.py b/unittest/test_storage.py index ec4004f..2466779 100644 --- a/unittest/test_storage.py +++ b/unittest/test_storage.py @@ -219,11 +219,19 @@ def test_password_safe_slot_name_corruption(C): @pytest.mark.hidden def test_hidden_volume_corruption(C): # bug: this should return error without unlocking encrypted volume each hidden volume lock, but it does not - assert C.NK_lock_encrypted_volume() == DeviceErrorCode.STATUS_OK - assert C.NK_unlock_encrypted_volume(DefaultPasswords.USER) == DeviceErrorCode.STATUS_OK + skip_if_device_version_lower_than({'S': 43}) hidden_volume_password = b'hiddenpassword' p = lambda i: hidden_volume_password + bb(str(i)) - for i in range(4): + volumes_to_setup = 4 + for i in range(volumes_to_setup): + assert C.NK_create_hidden_volume(i, 20 + i * 10, 20 + i * 10 + i + 1, p(i)) == DeviceErrorCode.STATUS_OK + assert C.NK_unlock_hidden_volume(p(i)) == DeviceErrorCode.STATUS_OK + assert C.NK_lock_hidden_volume() == DeviceErrorCode.STATUS_OK + + assert C.NK_lock_encrypted_volume() == DeviceErrorCode.STATUS_OK + + assert C.NK_unlock_encrypted_volume(DefaultPasswords.USER) == DeviceErrorCode.STATUS_OK + for i in range(volumes_to_setup): assert C.NK_unlock_encrypted_volume(DefaultPasswords.USER) == DeviceErrorCode.STATUS_OK assert C.NK_unlock_hidden_volume(p(i)) == DeviceErrorCode.STATUS_OK wait(2) |