operation_tests2.cpp: Fix set_expiration logic in some tests broken by parent commit
Fixed tests: withdraw_permission_nominal_case, withdraw_permission_test, proposal_owner_authority_complete
This commit is contained in:
parent
86456ba6e0
commit
d33e64e407
2 changed files with 11 additions and 7 deletions
|
|
@ -832,6 +832,7 @@ BOOST_FIXTURE_TEST_CASE( proposal_owner_authority_complete, database_fixture )
|
|||
uop.proposal = prop.id;
|
||||
uop.key_approvals_to_add.insert(dan.active.key_auths.begin()->first);
|
||||
trx.operations.push_back(uop);
|
||||
set_expiration( db, trx );
|
||||
trx.sign(nathan_key);
|
||||
trx.sign(dan_key);
|
||||
PUSH_TX( db, trx );
|
||||
|
|
@ -841,6 +842,7 @@ BOOST_FIXTURE_TEST_CASE( proposal_owner_authority_complete, database_fixture )
|
|||
|
||||
std::swap(uop.key_approvals_to_add, uop.key_approvals_to_remove);
|
||||
trx.operations.push_back(uop);
|
||||
trx.expiration += fc::seconds(1); // Survive trx dupe check
|
||||
trx.sign(nathan_key);
|
||||
trx.sign(dan_key);
|
||||
PUSH_TX( db, trx );
|
||||
|
|
@ -849,10 +851,8 @@ BOOST_FIXTURE_TEST_CASE( proposal_owner_authority_complete, database_fixture )
|
|||
BOOST_CHECK_EQUAL(prop.available_key_approvals.size(), 0);
|
||||
|
||||
std::swap(uop.key_approvals_to_add, uop.key_approvals_to_remove);
|
||||
// Survive trx dupe check
|
||||
set_expiration( db, trx );
|
||||
trx.set_reference_block( db.head_block_id() );
|
||||
trx.operations.push_back(uop);
|
||||
trx.expiration += fc::seconds(1); // Survive trx dupe check
|
||||
trx.sign(nathan_key);
|
||||
trx.sign(dan_key);
|
||||
PUSH_TX( db, trx );
|
||||
|
|
@ -863,6 +863,7 @@ BOOST_FIXTURE_TEST_CASE( proposal_owner_authority_complete, database_fixture )
|
|||
uop.key_approvals_to_add.clear();
|
||||
uop.owner_approvals_to_add.insert(nathan.get_id());
|
||||
trx.operations.push_back(uop);
|
||||
trx.expiration += fc::seconds(1); // Survive trx dupe check
|
||||
trx.sign(nathan_key);
|
||||
PUSH_TX( db, trx );
|
||||
trx.clear();
|
||||
|
|
|
|||
|
|
@ -108,6 +108,8 @@ BOOST_AUTO_TEST_CASE( withdraw_permission_test )
|
|||
op.withdraw_from_account = nathan_id;
|
||||
op.withdraw_to_account = dan_id;
|
||||
op.amount_to_withdraw = asset(1);
|
||||
set_expiration( db, trx );
|
||||
|
||||
trx.operations.push_back(op);
|
||||
//Throws because we haven't entered the first withdrawal period yet.
|
||||
GRAPHENE_REQUIRE_THROW(PUSH_TX( db, trx ), fc::exception);
|
||||
|
|
@ -121,6 +123,7 @@ BOOST_AUTO_TEST_CASE( withdraw_permission_test )
|
|||
REQUIRE_THROW_WITH_VALUE(op, withdraw_to_account, account_id_type());
|
||||
REQUIRE_THROW_WITH_VALUE(op, amount_to_withdraw, asset(10));
|
||||
REQUIRE_THROW_WITH_VALUE(op, amount_to_withdraw, asset(6));
|
||||
set_expiration( db, trx );
|
||||
trx.clear();
|
||||
trx.operations.push_back(op);
|
||||
trx.sign(dan_private_key);
|
||||
|
|
@ -165,12 +168,14 @@ BOOST_AUTO_TEST_CASE( withdraw_permission_test )
|
|||
op.withdraw_to_account = dan_id;
|
||||
op.amount_to_withdraw = asset(5);
|
||||
trx.operations.push_back(op);
|
||||
set_expiration( db, trx );
|
||||
trx.sign(dan_private_key);
|
||||
//Throws because nathan doesn't have the money
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx ), fc::exception);
|
||||
op.amount_to_withdraw = asset(1);
|
||||
trx.clear();
|
||||
trx.operations = {op};
|
||||
set_expiration( db, trx );
|
||||
trx.sign(dan_private_key);
|
||||
PUSH_TX( db, trx );
|
||||
}
|
||||
|
|
@ -200,6 +205,7 @@ BOOST_AUTO_TEST_CASE( withdraw_permission_test )
|
|||
op.withdraw_to_account = dan_id;
|
||||
op.amount_to_withdraw = asset(5);
|
||||
trx.operations.push_back(op);
|
||||
set_expiration( db, trx );
|
||||
trx.sign(dan_private_key);
|
||||
//Throws because the permission has expired
|
||||
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx ), fc::exception);
|
||||
|
|
@ -215,7 +221,6 @@ BOOST_AUTO_TEST_CASE( withdraw_permission_nominal_case )
|
|||
account_id_type nathan_id = get_account("nathan").id;
|
||||
account_id_type dan_id = get_account("dan").id;
|
||||
withdraw_permission_id_type permit;
|
||||
set_expiration( db, trx );
|
||||
|
||||
while(true)
|
||||
{
|
||||
|
|
@ -227,9 +232,7 @@ BOOST_AUTO_TEST_CASE( withdraw_permission_nominal_case )
|
|||
op.withdraw_to_account = dan_id;
|
||||
op.amount_to_withdraw = asset(5);
|
||||
trx.operations.push_back(op);
|
||||
// expiration is timestamp, so treat it as a rollable nonce
|
||||
// so tx's have different txid's
|
||||
trx.expiration += fc::seconds(1);
|
||||
set_expiration( db, trx );
|
||||
trx.sign(dan_private_key);
|
||||
PUSH_TX( db, trx );
|
||||
// tx's involving withdraw_permissions can't delete it even
|
||||
|
|
|
|||
Loading…
Reference in a new issue