aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2019-01-28 12:12:01 +0100
committerRobin Krahl <robin.krahl@ireas.org>2019-01-28 12:12:01 +0100
commit4dbe7113cf374454f681736308d87e27403c147b (patch)
tree47b392fe7fc01ae7f87df2234a3128b0fac210dc
parent290c1d82bf0f700248382808c9fe0fb1d190da14 (diff)
downloadlibnitrokey-4dbe7113cf374454f681736308d87e27403c147b.tar.gz
libnitrokey-4dbe7113cf374454f681736308d87e27403c147b.tar.bz2
Add unit test for NK_get_status
-rw-r--r--unittest/test_pro.py18
1 files 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