init test
This commit is contained in:
parent
0bdec0d71e
commit
e2b266eb08
2 changed files with 35 additions and 21 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
#include "son_fixture.hpp"
|
#include "son_fixture.hpp"
|
||||||
|
|
||||||
#include <graphene/peerplays_sidechain/peerplays_sidechain_plugin.hpp>
|
#include <graphene/peerplays_sidechain/peerplays_sidechain_plugin.hpp>
|
||||||
|
#include <graphene/utilities/key_conversion.hpp>
|
||||||
|
|
||||||
using namespace graphene;
|
using namespace graphene;
|
||||||
using namespace graphene::chain;
|
using namespace graphene::chain;
|
||||||
|
|
@ -20,8 +21,7 @@ BOOST_AUTO_TEST_CASE(init)
|
||||||
std::vector<fc::ecc::private_key> keys;
|
std::vector<fc::ecc::private_key> keys;
|
||||||
std::vector<son_id_type> sons;
|
std::vector<son_id_type> sons;
|
||||||
std::string test_url = "https://son_test";
|
std::string test_url = "https://son_test";
|
||||||
for(size_t i = 0; i < 16; i++)
|
for (size_t i = 0; i < 16; i++) {
|
||||||
{
|
|
||||||
fc::ecc::private_key privkey = generate_private_key(fc::to_string(i));
|
fc::ecc::private_key privkey = generate_private_key(fc::to_string(i));
|
||||||
keys.push_back(privkey);
|
keys.push_back(privkey);
|
||||||
fc::ecc::public_key pubkey = privkey.get_public_key();
|
fc::ecc::public_key pubkey = privkey.get_public_key();
|
||||||
|
|
@ -34,7 +34,39 @@ BOOST_AUTO_TEST_CASE(init)
|
||||||
// start plugin
|
// start plugin
|
||||||
peerplays_sidechain_plugin plugin;
|
peerplays_sidechain_plugin plugin;
|
||||||
boost::program_options::variables_map cfg;
|
boost::program_options::variables_map cfg;
|
||||||
plugin.plugin_initialize(cfg);
|
{
|
||||||
|
std::vector<std::string> data;
|
||||||
|
for (const auto& son_id: sons)
|
||||||
|
data.push_back("\"" + std::string(object_id_type(son_id)) + "\"");
|
||||||
|
cfg.emplace("son-id", boost::program_options::variable_value(data, false));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::vector<std::string> data;
|
||||||
|
for (const fc::ecc::private_key& key: keys) {
|
||||||
|
chain::public_key_type pubkey = key.get_public_key();
|
||||||
|
std::string value = "[\"" + std::string(pubkey) + "\", \"" + graphene::utilities::key_to_wif(key) + "\"]";
|
||||||
|
data.push_back(value);
|
||||||
|
}
|
||||||
|
cfg.emplace("peerplays-private-key", boost::program_options::variable_value(data, false));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
cfg.emplace("bitcoin-node-ip", boost::program_options::variable_value(std::string("99.79.189.95"), false));
|
||||||
|
cfg.emplace("bitcoin-node-zmq-port", boost::program_options::variable_value(uint32_t(11111), false));
|
||||||
|
cfg.emplace("bitcoin-node-rpc-port", boost::program_options::variable_value(uint32_t(22222), false));
|
||||||
|
cfg.emplace("bitcoin-node-rpc-user", boost::program_options::variable_value(std::string("1"), false));
|
||||||
|
cfg.emplace("bitcoin-node-rpc-password", boost::program_options::variable_value(std::string("1"), false));
|
||||||
|
std::vector<std::string> data;
|
||||||
|
for (const fc::ecc::private_key& key: keys) {
|
||||||
|
chain::public_key_type pubkey = key.get_public_key();
|
||||||
|
std::string value = "[\"" + std::string(pubkey) + "\", \"" + graphene::utilities::key_to_wif(key) + "\"]";
|
||||||
|
data.push_back(value);
|
||||||
|
}
|
||||||
|
cfg.emplace("bitcoin-private-key", boost::program_options::variable_value(data, false));
|
||||||
|
}
|
||||||
|
plugin.plugin_set_app(&app);
|
||||||
|
BOOST_CHECK_NO_THROW(plugin.plugin_initialize(cfg));
|
||||||
|
BOOST_CHECK_NO_THROW(plugin.plugin_startup());
|
||||||
|
BOOST_CHECK_NO_THROW(plugin.plugin_shutdown());
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
|
||||||
|
|
@ -110,24 +110,6 @@ son_fixture::son_fixture()
|
||||||
genesis_state.initial_parameters.current_fees->zero_all_fees();
|
genesis_state.initial_parameters.current_fees->zero_all_fees();
|
||||||
open_database();
|
open_database();
|
||||||
|
|
||||||
// add account tracking for ahplugin for special test case with track-account enabled
|
|
||||||
if( !options.count("track-account") && boost::unit_test::framework::current_test_case().p_name.value == "track_account") {
|
|
||||||
std::vector<std::string> track_account;
|
|
||||||
std::string track = "\"1.2.18\"";
|
|
||||||
track_account.push_back(track);
|
|
||||||
options.insert(std::make_pair("track-account", boost::program_options::variable_value(track_account, false)));
|
|
||||||
options.insert(std::make_pair("partial-operations", boost::program_options::variable_value(true, false)));
|
|
||||||
}
|
|
||||||
// account tracking 2 accounts
|
|
||||||
if( !options.count("track-account") && boost::unit_test::framework::current_test_case().p_name.value == "track_account2") {
|
|
||||||
std::vector<std::string> track_account;
|
|
||||||
std::string track = "\"1.2.0\"";
|
|
||||||
track_account.push_back(track);
|
|
||||||
track = "\"1.2.17\"";
|
|
||||||
track_account.push_back(track);
|
|
||||||
options.insert(std::make_pair("track-account", boost::program_options::variable_value(track_account, false)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// app.initialize();
|
// app.initialize();
|
||||||
ahplugin->plugin_set_app(&app);
|
ahplugin->plugin_set_app(&app);
|
||||||
ahplugin->plugin_initialize(options);
|
ahplugin->plugin_initialize(options);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue