create test skeleton

This commit is contained in:
einhornimmond 2021-07-13 14:30:00 +02:00
parent 913a4deff1
commit 9f1809624b
2 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,40 @@
#include "TestJsonCreateTransaction.h"
#include "JSONInterface/JsonCreateTransaction.h"
void TestJsonCreateTransaction::SetUp()
{
auto sm = SessionManager::getInstance();
//sm->init();
mUserSession = sm->getNewSession();
auto user = controller::User::create();
user->load("Jeet_bb@gmail.com");
mUserSession->setUser(user);
}
void TestJsonCreateTransaction::TearDown()
{
auto sm = SessionManager::getInstance();
if (!mUserSession) {
sm->releaseSession(mUserSession);
}
}
Poco::JSON::Object::Ptr TestJsonCreateTransaction::basisSetup()
{
Poco::JSON::Object::Ptr params = new Poco::JSON::Object;
params->set("session_id", mUserSession->getHandle());
return params;
}
TEST_F(TestJsonCreateTransaction, Creation)
{
JsonCreateTransaction jsonCall;
auto params = basisSetup();
params->set("transaction_type", "creation");
auto result = jsonCall.handle(params);
}

View File

@ -0,0 +1,23 @@
#ifndef __GRADIDO_LOGIN_SERVER_TEST_JSON_INTERFACE_TEST_JSON_CREATE_TRANSACTION_H
#define __GRADIDO_LOGIN_SERVER_TEST_JSON_INTERFACE_TEST_JSON_CREATE_TRANSACTION_H
#include "gtest/gtest.h"
#include "SingletonManager/SessionManager.h"
#include "Poco/JSON/Object.h"
class TestJsonCreateTransaction : public ::testing::Test
{
protected:
void SetUp() override;
void TearDown() override;
Poco::JSON::Object::Ptr basisSetup();
Session* mUserSession;
std::string mEmail;
};
#endif //__GRADIDO_LOGIN_SERVER_TEST_JSON_INTERFACE_TEST_JSON_CREATE_TRANSACTION_H