This reverts commit 9a383e24a2792e4ae04a470a9c94a29e518f8945.
This commit is contained in:
Michael Vines 2020-11-02 19:08:17 -08:00 committed by mergify[bot]
parent 20551f9fbc
commit f2da427631
1 changed files with 14 additions and 29 deletions

View File

@ -1,4 +1,6 @@
use solana_program::{instruction::*, program_pack::Pack, pubkey::Pubkey, system_instruction};
use solana_program::{
instruction::*, program_pack::Pack, pubkey::Pubkey, system_instruction, sysvar::rent::Rent,
};
use solana_program_test::*;
use solana_sdk::{
signature::Signer,
@ -47,13 +49,9 @@ async fn test_associated_token_address() {
let associated_token_address =
get_associated_token_address(&wallet_address, &token_mint_address);
let StartOutputs {
mut banks_client,
payer,
recent_blockhash,
rent,
..
} = program_test().start().await;
let (mut banks_client, payer, recent_blockhash) =
program_test(token_mint_address).start().await;
let rent = Rent::default(); // <-- TODO: get Rent from `ProgramTest`
let expected_token_account_balance = rent.minimum_balance(spl_token::state::Account::LEN);
// Associated account does not exist
@ -97,13 +95,9 @@ async fn test_create_with_a_lamport() {
let associated_token_address =
get_associated_token_address(&wallet_address, &token_mint_address);
let StartOutputs {
mut banks_client,
payer,
recent_blockhash,
rent,
..
} = program_test().start().await;
let (mut banks_client, payer, recent_blockhash) =
program_test(token_mint_address).start().await;
let rent = Rent::default(); // <-- TOOD: get Rent from `ProgramTest`
let expected_token_account_balance = rent.minimum_balance(spl_token::state::Account::LEN);
// Transfer 1 lamport into `associated_token_address` before creating it
@ -154,13 +148,9 @@ async fn test_create_with_excess_lamports() {
let associated_token_address =
get_associated_token_address(&wallet_address, &token_mint_address);
let StartOutputs {
mut banks_client,
payer,
recent_blockhash,
rent,
..
} = program_test().start().await;
let (mut banks_client, payer, recent_blockhash) =
program_test(token_mint_address).start().await;
let rent = Rent::default(); // <-- TOOD: get Rent from `ProgramTest`
let expected_token_account_balance = rent.minimum_balance(spl_token::state::Account::LEN);
// Transfer 1 lamport into `associated_token_address` before creating it
@ -211,13 +201,8 @@ async fn test_create_account_mismatch() {
let _associated_token_address =
get_associated_token_address(&wallet_address, &token_mint_address);
let StartOutputs {
mut banks_client,
payer,
recent_blockhash,
..
} = program_test().start().await;
let expected_token_account_balance = rent.minimum_balance(spl_token::state::Account::LEN);
let (mut banks_client, payer, recent_blockhash) =
program_test(token_mint_address).start().await;
let mut instruction =
create_associated_token_account(&payer.pubkey(), &wallet_address, &token_mint_address);