From b084e6b1e47a11a1c71cf686ccdc35b08b4e17b4 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Wed, 4 Oct 2017 18:36:50 +0200 Subject: Make sure hidden volumes are created before unlocking them Signed-off-by: Szczepan Zalega --- unittest/test_storage.py | 14 +++++++++++--- 1 file 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) -- cgit v1.2.3