aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-12-20 20:00:05 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2018-02-23 15:42:38 +0100
commitc0ee79f93a97b511661f99d45606e2c433d15344 (patch)
treeba8bd31452557ed7aa51a5567129cfef1d056a4a
parent87478e8a8a5329a4f5e4a59364bd1f7f359b71e6 (diff)
downloadlibnitrokey-c0ee79f93a97b511661f99d45606e2c433d15344.tar.gz
libnitrokey-c0ee79f93a97b511661f99d45606e2c433d15344.tar.bz2
Do not run C_API tests if not connected
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r--unittest/test_C_API.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/unittest/test_C_API.cpp b/unittest/test_C_API.cpp
index d5076c4..be47f08 100644
--- a/unittest/test_C_API.cpp
+++ b/unittest/test_C_API.cpp
@@ -28,8 +28,10 @@ static const int TOO_LONG_STRING = 200;
#include "log.h"
#include "../NK_C_API.h"
+int login;
+
TEST_CASE("C API connect", "[BASIC]") {
- auto login = NK_login_auto();
+ login = NK_login_auto();
REQUIRE(login != 0);
NK_logout();
login = NK_login_auto();
@@ -40,11 +42,13 @@ TEST_CASE("C API connect", "[BASIC]") {
}
TEST_CASE("Check retry count", "[BASIC]") {
+ REQUIRE(login != 0);
REQUIRE(NK_get_admin_retry_count() == 3);
REQUIRE(NK_get_user_retry_count() == 3);
}
TEST_CASE("Check long strings", "[STANDARD]") {
+ REQUIRE(login != 0);
const char* longPin = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
const char* pin = "123123123";
auto result = NK_change_user_PIN(longPin, pin);