moved server config init into global test main, instead per test. ServerConfig can't handle multiple initializing calls, from every test case

This commit is contained in:
Dario 2020-06-09 10:00:19 +02:00
parent c44184f823
commit c617ed7173
3 changed files with 20 additions and 8 deletions

View File

@ -9,13 +9,6 @@
void TestAuthenticatedEncryption::SetUp()
{
if (!ServerConfig::g_CryptoAppSecret) {
ServerConfig::g_CryptoAppSecret = DataTypeConverter::hexToBin("21ffbbc616fe");
}
if (!ServerConfig::g_ServerCryptoKey) {
auto serverKey = DataTypeConverter::hexToBin("a51ef8ac7ef1abf162fb7a65261acd7a");
ServerConfig::g_ServerCryptoKey = new ObfusArray(serverKey->size(), *serverKey);
}
}
TEST_F(TestAuthenticatedEncryption, encryptDecryptTest) {

View File

@ -84,7 +84,7 @@ void PassphraseTest::SetUp()
wordIndices3
));
ServerConfig::loadMnemonicWordLists();
}
TEST_F(PassphraseTest, detectMnemonic) {

View File

@ -3,6 +3,10 @@
#include <list>
#include "gtest/gtest.h"
#include "Poco/Util/PropertyFileConfiguration.h"
std::list<Test*> gTests;
void fillTests()
@ -16,6 +20,21 @@ void fillTests()
int load() {
// init server config, init seed array
Poco::AutoPtr<Poco::Util::LayeredConfiguration> test_config(new Poco::Util::LayeredConfiguration);
auto cfg = new Poco::Util::PropertyFileConfiguration("Gradido_LoginServer_Test.properties");
test_config->add(cfg);
if (!ServerConfig::initServerCrypto(*test_config)) {
//printf("[Gradido_LoginServer::%s] error init server crypto\n", __FUNCTION__);
printf("[load] error init server crypto");
return -1;
}
if (!ServerConfig::loadMnemonicWordLists()) {
printf("[load] error in loadMnemonicWordLists");
return -2;
}
fillTests();
for (std::list<Test*>::iterator it = gTests.begin(); it != gTests.end(); it++)
{