Changeset View
Changeset View
Standalone View
Standalone View
src/test/rpc_tests.cpp
| Show All 21 Lines | UniValue CallRPC(std::string args) { | ||||
| std::string strMethod = vArgs[0]; | std::string strMethod = vArgs[0]; | ||||
| vArgs.erase(vArgs.begin()); | vArgs.erase(vArgs.begin()); | ||||
| GlobalConfig config; | GlobalConfig config; | ||||
| JSONRPCRequest request; | JSONRPCRequest request; | ||||
| request.strMethod = strMethod; | request.strMethod = strMethod; | ||||
| request.params = RPCConvertValues(strMethod, vArgs); | request.params = RPCConvertValues(strMethod, vArgs); | ||||
| request.fHelp = false; | request.fHelp = false; | ||||
| BOOST_CHECK(tableRPC[strMethod]); | BOOST_CHECK(tableRPC[strMethod]); | ||||
| rpcfn_type method = tableRPC[strMethod]->actor; | |||||
| try { | try { | ||||
| UniValue result = (*method)(config, request); | UniValue result = tableRPC[strMethod]->call(config, request); | ||||
| return result; | return result; | ||||
| } catch (const UniValue &objError) { | } catch (const UniValue &objError) { | ||||
| throw std::runtime_error(find_value(objError, "message").get_str()); | throw std::runtime_error(find_value(objError, "message").get_str()); | ||||
| } | } | ||||
| } | } | ||||
| BOOST_FIXTURE_TEST_SUITE(rpc_tests, TestingSetup) | BOOST_FIXTURE_TEST_SUITE(rpc_tests, TestingSetup) | ||||
| ▲ Show 20 Lines • Show All 480 Lines • Show Last 20 Lines | |||||