From 4dbe7113cf374454f681736308d87e27403c147b Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Mon, 28 Jan 2019 12:12:01 +0100 Subject: Add unit test for NK_get_status --- unittest/test_pro.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/unittest/test_pro.py b/unittest/test_pro.py index afa9505..6ab7c1d 100644 --- a/unittest/test_pro.py +++ b/unittest/test_pro.py @@ -674,11 +674,23 @@ def test_factory_reset(C): @pytest.mark.status -def test_get_status(C): - status = C.NK_status() +def test_get_status_as_string(C): + status = C.NK_get_status_as_string() s = gs(status) assert len(s) > 0 + +@pytest.mark.status +def test_get_status(C): + status_st = ffi.new('struct NK_status *') + if not status_st: + raise Exception("Could not allocate status") + err = C.NK_get_status(status_st) + assert err == 0 + assert status_st.firmware_version_major == 0 + assert status_st.firmware_version_minor != 0 + + @pytest.mark.status def test_get_serial_number(C): sn = C.NK_device_serial_number() @@ -926,4 +938,4 @@ 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 \ No newline at end of file + # assert C.NK_get_device_model() != C.NK_DISCONNECTED -- cgit v1.2.1