aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2019-01-28 12:12:01 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2019-01-29 16:37:05 +0100
commit06bc6a5ff449a69b218ca1233c41d8b9d534505d (patch)
tree47b392fe7fc01ae7f87df2234a3128b0fac210dc
parentb2f35949dec2251aeb162324864292cdd7596c9b (diff)
downloadlibnitrokey-06bc6a5ff449a69b218ca1233c41d8b9d534505d.tar.gz
libnitrokey-06bc6a5ff449a69b218ca1233c41d8b9d534505d.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