Skip to content

Commit

Permalink
Merge pull request #398 from CosmWasm/mt-msg-handling
Browse files Browse the repository at this point in the history
Implementing all messages handling in mutlitest App
  • Loading branch information
hashedone authored Sep 7, 2021
2 parents ee7fd08 + a3e574b commit a918a0f
Show file tree
Hide file tree
Showing 10 changed files with 478 additions and 205 deletions.
110 changes: 61 additions & 49 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions contracts/cw20-escrow/src/integration_test.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
#![cfg(test)]

use cosmwasm_std::testing::{mock_env, MockApi, MockStorage};
use cosmwasm_std::{coins, to_binary, Addr, Empty, Uint128};
use cw20::{Cw20Coin, Cw20Contract, Cw20ExecuteMsg};
use cw_multi_test::{App, BankKeeper, Contract, ContractWrapper, Executor};
use cw_multi_test::{App, AppBuilder, Contract, ContractWrapper, Executor};

use crate::msg::{CreateMsg, DetailsResponse, ExecuteMsg, InstantiateMsg, QueryMsg, ReceiveMsg};

fn mock_app() -> App {
let env = mock_env();
let api = MockApi::default();
let bank = BankKeeper::new();

App::new(api, env.block, bank, MockStorage::new())
AppBuilder::new().build()
}

pub fn contract_escrow() -> Box<dyn Contract<Empty>> {
Expand Down
9 changes: 2 additions & 7 deletions contracts/cw3-fixed-multisig/src/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,15 @@

use crate::contract::{execute, instantiate, query};
use crate::msg::{ExecuteMsg, InstantiateMsg, Voter};
use cosmwasm_std::testing::{mock_env, MockApi, MockStorage};
use cosmwasm_std::{to_binary, Addr, Empty, Uint128, WasmMsg};
use cw0::Duration;
use cw20::{BalanceResponse, MinterResponse};
use cw20_base::msg::QueryMsg;
use cw3::Vote;
use cw_multi_test::{App, BankKeeper, Contract, ContractWrapper, Executor};
use cw_multi_test::{App, AppBuilder, Contract, ContractWrapper, Executor};

fn mock_app() -> App {
let env = mock_env();
let api = MockApi::default();
let bank = BankKeeper::new();

App::new(api, env.block, bank, MockStorage::new())
AppBuilder::new().build()
}

pub fn contract_cw3_fixed_multisig() -> Box<dyn Contract<Empty>> {
Expand Down
9 changes: 2 additions & 7 deletions contracts/cw3-flex-multisig/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,14 +424,13 @@ fn list_voters(

#[cfg(test)]
mod tests {
use cosmwasm_std::testing::{mock_env, MockApi, MockStorage};
use cosmwasm_std::{coin, coins, Addr, BankMsg, Coin, Decimal, Timestamp};

use cw0::Duration;
use cw2::{query_contract_info, ContractVersion};
use cw4::{Cw4ExecuteMsg, Member};
use cw4_group::helpers::Cw4GroupContract;
use cw_multi_test::{next_block, App, BankKeeper, Contract, ContractWrapper, Executor};
use cw_multi_test::{next_block, App, AppBuilder, Contract, ContractWrapper, Executor};

use super::*;
use crate::msg::Threshold;
Expand Down Expand Up @@ -470,11 +469,7 @@ mod tests {
}

fn mock_app() -> App {
let env = mock_env();
let api = MockApi::default();
let bank = BankKeeper::new();

App::new(api, env.block, bank, MockStorage::new())
AppBuilder::new().build()
}

// uploads code and returns address of group contract
Expand Down
1 change: 1 addition & 0 deletions packages/multi-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ serde = { version = "1.0.103", default-features = false, features = ["derive"] }
prost = "0.8.0"
anyhow = "1"
thiserror = "1"
derivative = "2"
Loading

0 comments on commit a918a0f

Please sign in to comment.