summaryrefslogtreecommitdiff
path: root/unittest
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2019-06-13 13:56:37 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2019-06-13 15:00:44 +0200
commite46646d09c2167faf63e65c8557b4da820d152c2 (patch)
tree9d685d8b2e425aa738006b24d2735435f9c568f9 /unittest
parent35d73ac92b054d4b24b4fad3676001f29ee184a4 (diff)
downloadlibnitrokey-e46646d09c2167faf63e65c8557b4da820d152c2.tar.gz
libnitrokey-e46646d09c2167faf63e65c8557b4da820d152c2.tar.bz2
Add Python tests
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'unittest')
-rw-r--r--unittest/test_pro.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/unittest/test_pro.py b/unittest/test_pro.py
index d094dec..2d50c8e 100644
--- a/unittest/test_pro.py
+++ b/unittest/test_pro.py
@@ -939,3 +939,18 @@ def test_TOTP_codes_from_nitrokeyapp(secret, C):
def test_get_device_model(C):
assert C.NK_get_device_model() != 0
# assert C.NK_get_device_model() != C.NK_DISCONNECTED
+
+
+@pytest.mark.firmware
+def test_bootloader_password_change_pro(C):
+ assert C.NK_change_firmware_password_pro(b'zxcasd', b'zxcasd') == DeviceErrorCode.WRONG_PASSWORD
+
+ assert C.NK_change_firmware_password_pro(DefaultPasswords.UPDATE, DefaultPasswords.UPDATE_TEMP) == DeviceErrorCode.STATUS_OK
+ assert C.NK_change_firmware_password_pro(DefaultPasswords.UPDATE_TEMP, DefaultPasswords.UPDATE) == DeviceErrorCode.STATUS_OK
+
+
+@pytest.mark.firmware
+def test_bootloader_run_pro(C):
+ assert C.NK_enable_firmware_update_pro(DefaultPasswords.UPDATE_TEMP) == DeviceErrorCode.WRONG_PASSWORD
+ # Not enabled due to lack of side-effect removal at this point
+ # assert C.NK_enable_firmware_update_pro(DefaultPasswords.UPDATE) == DeviceErrorCode.STATUS_OK