From 87aaf6d08e8a348e3e227da4832a8d3a8574599c Mon Sep 17 00:00:00 2001 From: Jake Hartnell Date: Mon, 11 Sep 2023 13:39:14 -0700 Subject: [PATCH] Fix up integration tests --- .../src/tests/test_tube/integration_tests.rs | 16 ++++++++------ .../src/tests/test_tube/test_env.rs | 22 +++++++++++-------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/contracts/voting/dao-voting-token-staked/src/tests/test_tube/integration_tests.rs b/contracts/voting/dao-voting-token-staked/src/tests/test_tube/integration_tests.rs index 80555688a..e6216844a 100644 --- a/contracts/voting/dao-voting-token-staked/src/tests/test_tube/integration_tests.rs +++ b/contracts/voting/dao-voting-token-staked/src/tests/test_tube/integration_tests.rs @@ -1,6 +1,6 @@ use cosmwasm_std::{Coin, Uint128}; use cw_tokenfactory_issuer::msg::DenomUnit; -use dao_voting::threshold::ActiveThreshold; +use dao_voting::threshold::{ActiveThreshold, ActiveThresholdError}; use osmosis_std::types::cosmos::bank::v1beta1::QueryBalanceRequest; use osmosis_test_tube::{Account, OsmosisTestApp}; @@ -81,8 +81,8 @@ fn test_instantiate_no_dao_balance() { let vp_contract = env .instantiate( &InstantiateMsg { - token_issuer_code_id: tf_issuer_id, token_info: TokenInfo::New(NewTokenInfo { + token_issuer_code_id: tf_issuer_id, subdenom: "ucat".to_string(), metadata: Some(NewDenomMetadata { description: "Awesome token, get it meow!".to_string(), @@ -144,8 +144,8 @@ fn test_instantiate_no_metadata() { env.instantiate( &InstantiateMsg { - token_issuer_code_id: tf_issuer_id, token_info: TokenInfo::New(NewTokenInfo { + token_issuer_code_id: tf_issuer_id, subdenom: "ucat".to_string(), metadata: None, initial_balances: vec![InitialBalance { @@ -174,8 +174,8 @@ fn test_instantiate_invalid_metadata_fails() { env.instantiate( &InstantiateMsg { - token_issuer_code_id: tf_issuer_id, token_info: TokenInfo::New(NewTokenInfo { + token_issuer_code_id: tf_issuer_id, subdenom: "cat".to_string(), metadata: Some(NewDenomMetadata { description: "Awesome token, get it meow!".to_string(), @@ -216,8 +216,8 @@ fn test_instantiate_invalid_active_threshold_count_fails() { let err = env .instantiate( &InstantiateMsg { - token_issuer_code_id: tf_issuer_id, token_info: TokenInfo::New(NewTokenInfo { + token_issuer_code_id: tf_issuer_id, subdenom: "cat".to_string(), metadata: Some(NewDenomMetadata { description: "Awesome token, get it meow!".to_string(), @@ -248,7 +248,9 @@ fn test_instantiate_invalid_active_threshold_count_fails() { assert_eq!( err, - TfDaoVotingContract::execute_submessage_error(ContractError::InvalidAbsoluteCount {}) + TfDaoVotingContract::execute_submessage_error(ContractError::ActiveThresholdError( + ActiveThresholdError::InvalidAbsoluteCount {} + )) ); } @@ -264,8 +266,8 @@ fn test_instantiate_no_initial_balances_fails() { let err = env .instantiate( &InstantiateMsg { - token_issuer_code_id: tf_issuer_id, token_info: TokenInfo::New(NewTokenInfo { + token_issuer_code_id: tf_issuer_id, subdenom: "ucat".to_string(), metadata: Some(NewDenomMetadata { description: "Awesome token, get it meow!".to_string(), diff --git a/contracts/voting/dao-voting-token-staked/src/tests/test_tube/test_env.rs b/contracts/voting/dao-voting-token-staked/src/tests/test_tube/test_env.rs index 493f6a511..a65173cde 100644 --- a/contracts/voting/dao-voting-token-staked/src/tests/test_tube/test_env.rs +++ b/contracts/voting/dao-voting-token-staked/src/tests/test_tube/test_env.rs @@ -118,8 +118,8 @@ impl TestEnvBuilder { let vp_contract = TfDaoVotingContract::deploy( app, &InstantiateMsg { - token_issuer_code_id: issuer_id, token_info: TokenInfo::New(NewTokenInfo { + token_issuer_code_id: issuer_id, subdenom: DENOM.to_string(), metadata: Some(crate::msg::NewDenomMetadata { description: "Awesome token, get it meow!".to_string(), @@ -172,14 +172,18 @@ impl TestEnvBuilder { let issuer_addr = TfDaoVotingContract::query(&vp_contract, &QueryMsg::TokenContract {}).unwrap(); - let tf_issuer = TokenfactoryIssuer::new_with_values( - app, - self.instantiate_msg - .expect("instantiate msg not set") - .token_issuer_code_id, - issuer_addr, - ) - .unwrap(); + let issuer_id: u64; + if let TokenInfo::New(token) = self + .instantiate_msg + .expect("instantiate msg not set") + .token_info + { + issuer_id = token.token_issuer_code_id; + } else { + panic!("TokenInfo is not New"); + } + + let tf_issuer = TokenfactoryIssuer::new_with_values(app, issuer_id, issuer_addr).unwrap(); TestEnv { app,