mirror of
https://github.com/QuasarApp/easyssl.git
synced 2025-04-26 04:54:33 +00:00
Merge branch 'task_1' of github.com:QuasarApp/easyssl into task_1
This commit is contained in:
commit
9f1245cbfa
@ -8,9 +8,11 @@
|
||||
#include <QtTest>
|
||||
#include "cryptotest.h"
|
||||
#include "authtest.h"
|
||||
#include "crttest.h"
|
||||
#include "easyssl/rsassl.h"
|
||||
#include <easyssl/ecdsassl.h>
|
||||
|
||||
|
||||
// Use This macros for initialize your own test classes.
|
||||
// Check exampletests
|
||||
#define TestCase(name, testClass) \
|
||||
@ -18,6 +20,9 @@
|
||||
initTest(new testClass()); \
|
||||
}
|
||||
|
||||
using CrtTestX509RSA = CrtTest<EasySSL::X509, EasySSL::RSASSL>;
|
||||
using CrtTestX509ECDSA = CrtTest<EasySSL::X509, EasySSL::ECDSASSL>;
|
||||
|
||||
/**
|
||||
* @brief The tstMain class - this is main test class
|
||||
*/
|
||||
@ -33,11 +38,12 @@ public:
|
||||
|
||||
private slots:
|
||||
|
||||
|
||||
// BEGIN TESTS CASES
|
||||
TestCase(authTest, AuthTest)
|
||||
TestCase(cryptoTestESDSA, CryptoTest<EasySSL::ECDSASSL>)
|
||||
TestCase(cryptoTestRSA, CryptoTest<EasySSL::RSASSL>)
|
||||
TestCase(crtTestX509RSA, CrtTestX509RSA)
|
||||
TestCase(crtTestX509ECDSA, CrtTestX509ECDSA)
|
||||
|
||||
// END TEST CASES
|
||||
|
||||
|
0
tests/units/crttest.cpp
Normal file
0
tests/units/crttest.cpp
Normal file
48
tests/units/crttest.h
Normal file
48
tests/units/crttest.h
Normal file
@ -0,0 +1,48 @@
|
||||
//#
|
||||
//# Copyright (C) 2020-2023 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
|
||||
#ifndef CRTTEST_H
|
||||
#define CRTTEST_H
|
||||
|
||||
#include "qtestcase.h"
|
||||
#include "test.h"
|
||||
#include "testutils.h"
|
||||
#include <easyssl/icertificate.h>
|
||||
#include <easyssl/x509.h>
|
||||
|
||||
|
||||
/**
|
||||
* @brief The CrtTest class is bse test class for the testin all certificate generators
|
||||
* @tparam CrtGenerator This any class inheret of ICertificate interface.
|
||||
*
|
||||
* @example
|
||||
* @code{cpp}
|
||||
* #include "x509.h"
|
||||
* #include "CrtTest"
|
||||
*
|
||||
* TestCase(cryptoTestRSA, CrtTest<EasySSL::x509, EasySSL::RSASSL>)
|
||||
* @endcode
|
||||
*/
|
||||
template <class CrtGenerator, class Algorithm>
|
||||
class CrtTest: public Test, protected TestUtils
|
||||
{
|
||||
public:
|
||||
CrtTest() = default;
|
||||
void test() override {
|
||||
|
||||
CrtGenerator gen(QSharedPointer<Algorithm>::create());
|
||||
EasySSL::SslSrtData data;
|
||||
|
||||
auto crt = gen.create(data);
|
||||
QVERIFY2(!crt.crt.isNull(), "Failed to generate certificate.");
|
||||
QVERIFY2(!crt.key.isNull(), "Failed to generate private key for certificate.");
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CRTTEST_H
|
Loading…
x
Reference in New Issue
Block a user