aboutsummaryrefslogtreecommitdiff
path: root/unittest/test_137.cc
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2019-01-07 14:52:30 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2019-01-07 14:53:01 +0100
commitc802af2606ed7535a19d373a7b39e280255057b6 (patch)
tree4cfc5052142e31d600d7315e90a70a4a67238b67 /unittest/test_137.cc
parent1f3da5c76acb20b2183ac52373ed3b0b63e1151e (diff)
downloadlibnitrokey-c802af2606ed7535a19d373a7b39e280255057b6.tar.gz
libnitrokey-c802af2606ed7535a19d373a7b39e280255057b6.tar.bz2
Add test case mentioned in comment
See https://github.com/Nitrokey/libnitrokey/issues/137#issue-396187889 for details Issue #137 Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'unittest/test_137.cc')
-rw-r--r--unittest/test_137.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/unittest/test_137.cc b/unittest/test_137.cc
new file mode 100644
index 0000000..bc914d9
--- /dev/null
+++ b/unittest/test_137.cc
@@ -0,0 +1,12 @@
+#include <libnitrokey/NK_C_API.h>
+#include "catch2/catch.hpp"
+#include <cstring>
+
+TEST_CASE("Issue #137", "[fast]") {
+ REQUIRE(NK_login_auto() == 1);
+ REQUIRE(NK_user_authenticate("123456", "temppw") == 0);
+ auto s = NK_get_totp_code_PIN(0, 0, 0, 0, "temppw");
+ REQUIRE(s != 0);
+ REQUIRE(strnlen(s, 100) > 0 );
+ REQUIRE(NK_logout() == 0);
+}