Added DB read write test

parent c3984af2
#ifndef SGXWALLET_SGXWALLETSERVER_HPP #ifndef SGXWALLET_SGXWALLETSERVER_HPP
#define SGXWALLET_SGXWALLETSERVER_HPP #define SGXWALLET_SGXWALLETSERVER_HPP
#include "abstractstubserver.h"
using namespace jsonrpc; using namespace jsonrpc;
using namespace std; using namespace std;
......
...@@ -39,6 +39,8 @@ ...@@ -39,6 +39,8 @@
#define WALLETDB_NAME "sgxwallet.db" #define WALLETDB_NAME "sgxwallet.db"
#define ENCLAVE_NAME "secure_enclave.signed.so"
......
...@@ -31,19 +31,25 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -31,19 +31,25 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <jsonrpccpp/server/connectors/httpserver.h>
#include "sgxwallet_common.h" #include "sgxwallet_common.h"
#include "create_enclave.h" #include "create_enclave.h"
#include "secure_enclave_u.h" #include "secure_enclave_u.h"
#include "sgx_detect.h" #include "sgx_detect.h"
#include <gmp.h> #include <gmp.h>
#include <sgx_urts.h> #include <sgx_urts.h>
#include <stdio.h>
#include "BLSCrypto.h" #include "BLSCrypto.h"
#include "ServerInit.h" #include "ServerInit.h"
#define ENCLAVE_NAME "secure_enclave.signed.so"
#include "RPCException.h"
#include "LevelDB.h"
#include "SGXWalletServer.hpp"
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
...@@ -219,11 +225,27 @@ TEST_CASE("BLS sign test", "[bls-sign]") { ...@@ -219,11 +225,27 @@ TEST_CASE("BLS sign test", "[bls-sign]") {
TEST_CASE("KeysDB test", "[dkg-gen]") { TEST_CASE("KeysDB test", "[keys-db]") {
reset_db(); reset_db();
init_all(); init_all();
string key = "SCHAIN:17:INDEX:5:KEY:1";
string value = TEST_KEY;
REQUIRE_THROWS(readKeyShare(key));
writeKeyShare(key, value);
REQUIRE(readKeyShare(key) != nullptr);
// put your test here // put your test here
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment