From 9f1809624ba29ea235f7e1dadba4da0b42af7c42 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Tue, 13 Jul 2021 14:30:00 +0200 Subject: [PATCH] create test skeleton --- .../TestJsonCreateTransaction.cpp | 40 +++++++++++++++++++ .../JSONInterface/TestJsonCreateTransaction.h | 23 +++++++++++ 2 files changed, 63 insertions(+) create mode 100644 login_server/src/cpp/test/JSONInterface/TestJsonCreateTransaction.cpp create mode 100644 login_server/src/cpp/test/JSONInterface/TestJsonCreateTransaction.h diff --git a/login_server/src/cpp/test/JSONInterface/TestJsonCreateTransaction.cpp b/login_server/src/cpp/test/JSONInterface/TestJsonCreateTransaction.cpp new file mode 100644 index 000000000..81a6ab25b --- /dev/null +++ b/login_server/src/cpp/test/JSONInterface/TestJsonCreateTransaction.cpp @@ -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); +} \ No newline at end of file diff --git a/login_server/src/cpp/test/JSONInterface/TestJsonCreateTransaction.h b/login_server/src/cpp/test/JSONInterface/TestJsonCreateTransaction.h new file mode 100644 index 000000000..53a3202f4 --- /dev/null +++ b/login_server/src/cpp/test/JSONInterface/TestJsonCreateTransaction.h @@ -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 \ No newline at end of file