aboutsummaryrefslogtreecommitdiff
path: root/unittest
diff options
context:
space:
mode:
authorRobin Krahl <me@robin-krahl.de>2019-01-13 12:06:16 +0100
committerRobin Krahl <me@robin-krahl.de>2019-01-13 13:27:52 +0100
commite9cfa720d39e0c540fe530f907a84e9a4b5d1240 (patch)
tree0e9c3a8b4678c6f5f1bbcfcf5460a8c20bf91555 /unittest
parentcf32902131d4f7bd68622ca9d243fdff5a5ed519 (diff)
downloadlibnitrokey-e9cfa720d39e0c540fe530f907a84e9a4b5d1240.tar.gz
libnitrokey-e9cfa720d39e0c540fe530f907a84e9a4b5d1240.tar.bz2
Add test for NK_connect_with_path
As we cannot read the output of NK_list_devices in the Python tests at the moment, this test case uses NK_list_devices_by_cpuID instead.
Diffstat (limited to 'unittest')
-rw-r--r--unittest/test_multiple.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/unittest/test_multiple.py b/unittest/test_multiple.py
index 902234f..821a3b7 100644
--- a/unittest/test_multiple.py
+++ b/unittest/test_multiple.py
@@ -44,6 +44,25 @@ def test_list_devices(C):
@pytest.mark.other
@pytest.mark.info
+def test_connect_with_path(C):
+ ids = gs(C.NK_list_devices_by_cpuID())
+ # NK_list_devices_by_cpuID already opened the devices, so we have to close
+ # them before trying to reconnect
+ assert C.NK_logout() == 0
+
+ devices_list = ids.split(b';')
+ for value in devices_list:
+ parts = value.split(b'_p_')
+ assert len(parts) < 3
+ if len(parts) == 2:
+ path = parts[1]
+ else:
+ path = parts[0]
+ assert C.NK_connect_with_path(path) == 1
+
+
+@pytest.mark.other
+@pytest.mark.info
def test_get_status_storage_multiple(C):
ids = gs(C.NK_list_devices_by_cpuID())
print(ids)