aboutsummaryrefslogtreecommitdiff
path: root/unittest/test_offline.py
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2019-01-15 14:48:02 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2019-01-15 14:48:02 +0100
commit4078bf60135e9ad161eefa775e90dca3cced2730 (patch)
treeb0ca724e3b161507e65969fabd35ceaa7105e176 /unittest/test_offline.py
parentc284da21d2eb9e9cbdc30cd82e9dd46ea4528683 (diff)
downloadlibnitrokey-4078bf60135e9ad161eefa775e90dca3cced2730.tar.gz
libnitrokey-4078bf60135e9ad161eefa775e90dca3cced2730.tar.bz2
Add Python offline tests
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'unittest/test_offline.py')
-rw-r--r--unittest/test_offline.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/unittest/test_offline.py b/unittest/test_offline.py
new file mode 100644
index 0000000..ae2638f
--- /dev/null
+++ b/unittest/test_offline.py
@@ -0,0 +1,39 @@
+"""
+Copyright (c) 2019 Nitrokey UG
+
+This file is part of libnitrokey.
+
+libnitrokey is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+any later version.
+
+libnitrokey is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with libnitrokey. If not, see <http://www.gnu.org/licenses/>.
+
+SPDX-License-Identifier: LGPL-3.0
+"""
+
+from misc import gs
+import re
+
+
+def test_offline(C_offline):
+ libnk_version = gs(C_offline.NK_get_library_version())
+ assert libnk_version
+ print(libnk_version)
+
+ # v3.4.1-29-g1f3d
+ search = re.search(b'v\d\.\d(\.\d)?', libnk_version)
+ assert search is not None
+
+ C_offline.NK_set_debug(False)
+ C_offline.NK_set_debug_level(4)
+ assert C_offline.NK_get_major_library_version() == 3
+ assert C_offline.NK_get_minor_library_version() >= 3
+ assert C_offline.NK_login_auto() == 0