diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2019-01-29 16:37:22 +0100 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2019-01-29 16:37:22 +0100 |
commit | 1bf90425d2006558ce4f4aac0ed5680d31b77918 (patch) | |
tree | c6789df5d10d1b5f6b83c5d1c7c2889e5ad2a6d9 /unittest/test_pro.py | |
parent | b0d1d6a1a44210a25b3d0e6950ec08f551714ccf (diff) | |
parent | dc9dd81105634aeb100c47637fedef425f0ac6f9 (diff) | |
download | libnitrokey-1bf90425d2006558ce4f4aac0ed5680d31b77918.tar.gz libnitrokey-1bf90425d2006558ce4f4aac0ed5680d31b77918.tar.bz2 |
Merge branch 'pr_155'
Add Status structure, and a general command for using it as a result.
Usable to limit calls to the device, when multiple status fields are
required at given time.
Tested on Nitrokey Pro v0.7 and v0.10.
Run offline tests as well (C++ and Python).
Fixes #155
Diffstat (limited to 'unittest/test_pro.py')
-rw-r--r-- | unittest/test_pro.py | 18 |
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 |