From 7a6850d5fe38b4e19f12d0dc658c8b05ad0ea3bb Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Wed, 24 Jan 2018 13:22:20 +0100 Subject: Move useful QTest template specializations to global header file Fix KDBX test linker errors on Windows --- tests/TestYkChallengeResponseKey.cpp | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'tests/TestYkChallengeResponseKey.cpp') diff --git a/tests/TestYkChallengeResponseKey.cpp b/tests/TestYkChallengeResponseKey.cpp index 558920f4a..276ba7325 100644 --- a/tests/TestYkChallengeResponseKey.cpp +++ b/tests/TestYkChallengeResponseKey.cpp @@ -18,36 +18,23 @@ */ #include "TestYkChallengeResponseKey.h" +#include "TestGlobal.h" +#include "crypto/Crypto.h" -#include #include -#include "crypto/Crypto.h" -#include "keys/YkChallengeResponseKey.h" - QTEST_GUILESS_MAIN(TestYubiKeyChalResp) void TestYubiKeyChalResp::initTestCase() { - m_detected = 0; - m_key = NULL; - // crypto subsystem needs to be initialized for YubiKey testing QVERIFY(Crypto::init()); } -void TestYubiKeyChalResp::cleanupTestCase() -{ - if (m_key) - delete m_key; -} - void TestYubiKeyChalResp::init() { - bool result = YubiKey::instance()->init(); - - if (!result) { - QSKIP("Unable to connect to YubiKey", SkipAll); + if (!YubiKey::instance()->init()) { + QSKIP("Unable to connect to YubiKey"); } } @@ -104,7 +91,7 @@ void TestYubiKeyChalResp::ykDetected(int slot, bool blocking) /* Key used for later testing */ if (!m_key) - m_key = new YkChallengeResponseKey(slot, blocking); + m_key.reset(new YkChallengeResponseKey(slot, blocking)); } void TestYubiKeyChalResp::deinit() -- cgit v1.2.3