From e46646d09c2167faf63e65c8557b4da820d152c2 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Thu, 13 Jun 2019 13:56:37 +0200 Subject: Add Python tests Signed-off-by: Szczepan Zalega --- unittest/test_pro.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 -- cgit v1.2.3