unit test for list_active_sons
This commit is contained in:
parent
22f76a04c0
commit
8c4eb579a7
1 changed files with 56 additions and 0 deletions
|
|
@ -530,6 +530,62 @@ BOOST_AUTO_TEST_CASE( related_functions )
|
||||||
BOOST_TEST_MESSAGE("SON-related functions cli wallet tests end");
|
BOOST_TEST_MESSAGE("SON-related functions cli wallet tests end");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_FIXTURE_TEST_CASE( cli_list_active_sons, cli_fixture )
|
||||||
|
{
|
||||||
|
BOOST_TEST_MESSAGE("SON cli wallet tests for list_active_sons begin");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
son_test_helper sth(*this);
|
||||||
|
|
||||||
|
signed_transaction vote_tx;
|
||||||
|
global_property_object gpo;
|
||||||
|
|
||||||
|
gpo = con.wallet_api_ptr->get_global_properties();
|
||||||
|
unsigned int son_number = gpo.parameters.maximum_son_count;
|
||||||
|
|
||||||
|
// create son accounts
|
||||||
|
for(unsigned int i = 0; i < son_number + 1; i++)
|
||||||
|
{
|
||||||
|
sth.create_son("sonaccount" + fc::to_pretty_string(i),
|
||||||
|
"http://son" + fc::to_pretty_string(i), false);
|
||||||
|
}
|
||||||
|
BOOST_CHECK(generate_maintenance_block());
|
||||||
|
|
||||||
|
BOOST_TEST_MESSAGE("Voting for SONs");
|
||||||
|
for(unsigned int i = 1; i < son_number + 1; i++)
|
||||||
|
{
|
||||||
|
std::string name = "sonaccount" + fc::to_pretty_string(i);
|
||||||
|
vote_tx = con.wallet_api_ptr->vote_for_son(name, name, true, true);
|
||||||
|
}
|
||||||
|
BOOST_CHECK(generate_maintenance_block());
|
||||||
|
|
||||||
|
for(unsigned int i = 1; i < son_number; i++)
|
||||||
|
{
|
||||||
|
std::string name1 = "sonaccount" + fc::to_pretty_string(i);
|
||||||
|
std::string name2 = "sonaccount" + fc::to_pretty_string(i + 1);
|
||||||
|
vote_tx = con.wallet_api_ptr->vote_for_son(name1, name2, true, true);
|
||||||
|
}
|
||||||
|
BOOST_CHECK(generate_maintenance_block());
|
||||||
|
gpo = con.wallet_api_ptr->get_global_properties();
|
||||||
|
BOOST_TEST_MESSAGE("gpo: " << gpo.active_sons.size());
|
||||||
|
|
||||||
|
BOOST_CHECK(gpo.active_sons.size() == son_number);
|
||||||
|
|
||||||
|
map<string, son_id_type> active_sons = con.wallet_api_ptr->list_active_sons();
|
||||||
|
BOOST_CHECK(active_sons.size() == son_number);
|
||||||
|
for(unsigned int i = 1; i < son_number + 1; i++)
|
||||||
|
{
|
||||||
|
std::string name = "sonaccount" + fc::to_pretty_string(i);
|
||||||
|
BOOST_CHECK(active_sons.find(name) != active_sons.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch( fc::exception& e ) {
|
||||||
|
BOOST_TEST_MESSAGE("SON cli wallet tests exception");
|
||||||
|
edump((e.to_detail_string()));
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
BOOST_TEST_MESSAGE("SON cli wallet tests for list_active_sons end");
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue