From 3277bb2f92686a258601a3c11fb207ff84228852 Mon Sep 17 00:00:00 2001 From: Mauro Lacy Date: Sun, 30 Aug 2020 08:05:09 +0200 Subject: [PATCH 1/2] Remove unused variable / Add contract version check --- contracts/cw1-subkeys/src/contract.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/contracts/cw1-subkeys/src/contract.rs b/contracts/cw1-subkeys/src/contract.rs index a416b3897..bf80b5fe0 100644 --- a/contracts/cw1-subkeys/src/contract.rs +++ b/contracts/cw1-subkeys/src/contract.rs @@ -311,7 +311,7 @@ mod tests { use cosmwasm_std::testing::{mock_dependencies, mock_env, MOCK_CONTRACT_ADDR}; use cosmwasm_std::{coin, coins, StakingMsg}; use cw1_whitelist::msg::AdminListResponse; - use cw2::get_contract_version; + use cw2::{get_contract_version, ContractVersion}; // this will set up the init for other tests fn setup_test_case( @@ -351,7 +351,6 @@ mod tests { let spender1 = HumanAddr::from("spender0001"); let spender2 = HumanAddr::from("spender0002"); - let spender3 = HumanAddr::from("spender0003"); let initial_spenders = vec![spender1.clone(), spender2.clone()]; // Same allowances for all spenders, for simplicity @@ -375,8 +374,11 @@ mod tests { ); assert_eq!( - get_contract_version(&deps.storage).unwrap().contract, - CONTRACT_NAME + ContractVersion { + contract: CONTRACT_NAME.to_string(), + version: CONTRACT_VERSION.to_string(), + }, + get_contract_version(&deps.storage).unwrap() ) } From 2a32fbd84db594b6d7ec3b1529fb06d78c62a671 Mon Sep 17 00:00:00 2001 From: Mauro Lacy Date: Sun, 30 Aug 2020 08:10:32 +0200 Subject: [PATCH 2/2] Remove unneeded contract balance --- contracts/cw1-subkeys/src/contract.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/contracts/cw1-subkeys/src/contract.rs b/contracts/cw1-subkeys/src/contract.rs index bf80b5fe0..2765e1d28 100644 --- a/contracts/cw1-subkeys/src/contract.rs +++ b/contracts/cw1-subkeys/src/contract.rs @@ -344,7 +344,7 @@ mod tests { #[test] fn get_contract_version_works() { - let mut deps = mock_dependencies(20, &coins(1111, "token1")); + let mut deps = mock_dependencies(20, &[]); let owner = HumanAddr::from("admin0001"); let admins = vec![owner.clone(), HumanAddr::from("admin0002")]; @@ -384,7 +384,7 @@ mod tests { #[test] fn query_allowance_works() { - let mut deps = mock_dependencies(20, &coins(1111, "token1")); + let mut deps = mock_dependencies(20, &[]); let owner = HumanAddr::from("admin0001"); let admins = vec![owner.clone(), HumanAddr::from("admin0002")]; @@ -439,7 +439,7 @@ mod tests { #[test] fn query_all_allowances_works() { - let mut deps = mock_dependencies(20, &coins(1111, "token1")); + let mut deps = mock_dependencies(20, &[]); let owner = HumanAddr::from("admin0001"); let admins = vec![owner.clone(), HumanAddr::from("admin0002")]; @@ -507,7 +507,7 @@ mod tests { #[test] fn update_admins_and_query() { - let mut deps = mock_dependencies(20, &coins(1111, "token1")); + let mut deps = mock_dependencies(20, &[]); let owner = HumanAddr::from("admin0001"); let admin2 = HumanAddr::from("admin0002"); @@ -593,7 +593,7 @@ mod tests { #[test] fn increase_allowances() { - let mut deps = mock_dependencies(20, &coins(1111, "token1")); + let mut deps = mock_dependencies(20, &[]); let owner = HumanAddr::from("admin0001"); let admins = vec![owner.clone(), HumanAddr::from("admin0002")]; @@ -708,7 +708,7 @@ mod tests { #[test] fn decrease_allowances() { - let mut deps = mock_dependencies(20, &coins(1111, "token1")); + let mut deps = mock_dependencies(20, &[]); let owner = HumanAddr::from("admin0001"); let admins = vec![owner.clone(), HumanAddr::from("admin0002")]; @@ -849,7 +849,7 @@ mod tests { #[test] fn execute_checks() { - let mut deps = mock_dependencies(20, &coins(1111, "token1")); + let mut deps = mock_dependencies(20, &[]); let owner = HumanAddr::from("admin0001"); let admins = vec![owner.clone(), HumanAddr::from("admin0002")]; @@ -941,7 +941,7 @@ mod tests { #[test] fn can_send_query_works() { - let mut deps = mock_dependencies(20, &coins(1111, "token1")); + let mut deps = mock_dependencies(20, &[]); let owner = HumanAddr::from("admin007"); let spender = HumanAddr::from("spender808");