Skip to content

Commit

Permalink
Revert "Adapt to solana-labs/solana#13355"
Browse files Browse the repository at this point in the history
This reverts commit 9a383e2.
  • Loading branch information
mvines authored and mergify[bot] committed Nov 3, 2020
1 parent 20551f9 commit f2da427
Showing 1 changed file with 14 additions and 29 deletions.
43 changes: 14 additions & 29 deletions associated-token-account/program/tests/functional.rs
@@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit f2da427

Please sign in to comment.