aboutsummaryrefslogtreecommitdiff
path: root/unittest
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2018-11-22 12:40:41 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2018-11-22 12:40:41 +0100
commit57773ad5f7b6eb5e6a2020dd1bd4264bdd823808 (patch)
treed80d7a5da0d66c435e6d338aa8651f5a9ce76b25 /unittest
parentef171dfd5bf23da606597a251c327ad2c52ec7b8 (diff)
parent3a2ee6c368a8233946473e60baa05c54eb822802 (diff)
downloadlibnitrokey-57773ad5f7b6eb5e6a2020dd1bd4264bdd823808.tar.gz
libnitrokey-57773ad5f7b6eb5e6a2020dd1bd4264bdd823808.tar.bz2
Merge branch 'tests_update'
Adding corrections found while testing Storage v0.53 RC1.
Diffstat (limited to 'unittest')
-rw-r--r--unittest/constants.py1
-rw-r--r--unittest/test_pro.py3
-rw-r--r--unittest/test_storage.py5
3 files changed, 6 insertions, 3 deletions
diff --git a/unittest/constants.py b/unittest/constants.py
index 3fb444a..714c8c6 100644
--- a/unittest/constants.py
+++ b/unittest/constants.py
@@ -48,6 +48,7 @@ class DeviceErrorCode:
WRONG_PASSWORD = 4
STATUS_NOT_AUTHORIZED = 5
STATUS_AES_DEC_FAILED = 0xa
+ STATUS_UNKNOWN_ERROR = 100
class LibraryErrors:
diff --git a/unittest/test_pro.py b/unittest/test_pro.py
index 1c61399..afa9505 100644
--- a/unittest/test_pro.py
+++ b/unittest/test_pro.py
@@ -192,7 +192,8 @@ def test_enable_password_safe_after_factory_reset(C):
assert C.NK_clear_new_sd_card_warning(DefaultPasswords.ADMIN) == DeviceErrorCode.STATUS_OK
enable_password_safe_result = C.NK_enable_password_safe(DefaultPasswords.USER)
assert enable_password_safe_result == DeviceErrorCode.STATUS_AES_DEC_FAILED \
- or is_storage(C) and enable_password_safe_result == DeviceErrorCode.WRONG_PASSWORD
+ or is_storage(C) and enable_password_safe_result in \
+ [DeviceErrorCode.WRONG_PASSWORD, DeviceErrorCode.STATUS_UNKNOWN_ERROR] # UNKNOWN_ERROR since v0.51
assert C.NK_build_aes_key(DefaultPasswords.ADMIN) == DeviceErrorCode.STATUS_OK
assert C.NK_enable_password_safe(DefaultPasswords.USER) == DeviceErrorCode.STATUS_OK
diff --git a/unittest/test_storage.py b/unittest/test_storage.py
index 096709d..2aa8441 100644
--- a/unittest/test_storage.py
+++ b/unittest/test_storage.py
@@ -352,13 +352,14 @@ def test_change_update_password(C):
assert C.NK_change_update_password(DefaultPasswords.UPDATE_TEMP, DefaultPasswords.UPDATE) == DeviceErrorCode.STATUS_OK
-@pytest.mark.skip(reason='no reversing method added yet')
+# @pytest.mark.skip(reason='no reversing method added yet')
@pytest.mark.update
def test_enable_firmware_update(C):
skip_if_device_version_lower_than({'S': 50})
wrong_password = b'aaaaaaaaaaa'
assert C.NK_enable_firmware_update(wrong_password) == DeviceErrorCode.WRONG_PASSWORD
- assert C.NK_enable_firmware_update(DefaultPasswords.UPDATE) == DeviceErrorCode.STATUS_OK
+ # skip actual test - reason: no reversing method added yet
+ # assert C.NK_enable_firmware_update(DefaultPasswords.UPDATE) == DeviceErrorCode.STATUS_OK
@pytest.mark.other