diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2016-11-03 13:51:59 +0100 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2016-11-26 18:56:29 +0100 |
commit | fe36daa38ab1995c8c7fc6470d06b8595efd2385 (patch) | |
tree | 1dd4b5bf18537ed16ac31df331b0983fd9d08a65 /unittest | |
parent | 130a33311567a1f0f6a9a2d8707bff20a558eb20 (diff) | |
download | libnitrokey-fe36daa38ab1995c8c7fc6470d06b8595efd2385.tar.gz libnitrokey-fe36daa38ab1995c8c7fc6470d06b8595efd2385.tar.bz2 |
Tests: remake fill SD card test. Get progress bar value when busy.
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'unittest')
-rw-r--r-- | unittest/constants.py | 1 | ||||
-rw-r--r-- | unittest/test_storage.py | 15 |
2 files changed, 15 insertions, 1 deletions
diff --git a/unittest/constants.py b/unittest/constants.py index 258619e..78a219b 100644 --- a/unittest/constants.py +++ b/unittest/constants.py @@ -18,6 +18,7 @@ class DefaultPasswords(Enum): class DeviceErrorCode(Enum): STATUS_OK = 0 + BUSY = 1 # busy or busy progressbar in place of wrong_CRC status NOT_PROGRAMMED = 3 WRONG_PASSWORD = 4 STATUS_NOT_AUTHORIZED = 5 diff --git a/unittest/test_storage.py b/unittest/test_storage.py index b02b1eb..600faf2 100644 --- a/unittest/test_storage.py +++ b/unittest/test_storage.py @@ -83,7 +83,20 @@ def test_clear_new_sd_card_notification(C): @pytest.mark.skip def test_fill_SD_card(C): - assert C.NK_fill_SD_card_with_random_data(DefaultPasswords.ADMIN) == DeviceErrorCode.STATUS_OK + status = C.NK_fill_SD_card_with_random_data(DefaultPasswords.ADMIN) + assert status == DeviceErrorCode.STATUS_OK or status == DeviceErrorCode.BUSY + while 1: + value = C.NK_get_progress_bar_value() + if value == -1: break + assert 0 <= value <= 100 + assert C.NK_get_last_command_status() == DeviceErrorCode.STATUS_OK + wait(5) + + +def test_get_busy_progress_on_idle(C): + value = C.NK_get_progress_bar_value() + assert value == -1 + assert C.NK_get_last_command_status() == DeviceErrorCode.STATUS_OK def test_change_update_password(C): |