Skip to content

Commit

Permalink
move auth test to correct file.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbernal87 committed May 2, 2024
1 parent 5a3b27c commit bdb96e4
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ mod test_exchange;
mod test_exchange_derivative;
mod test_oracle;
mod type_helpers;
mod test_auth;
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
use crate::{
msg::{QueryMsg, QueryStargateResponse},
testing::type_helpers::{AuthParams, ParamResponse},
utils::{ExchangeType, Setup},
};
use injective_test_tube::{Account, Module, Wasm};
use cosmos_sdk_proto::cosmos::auth::v1beta1::QueryAccountRequest;
use crate::encode_helper::encode_proto_message;

#[test]
#[cfg_attr(not(feature = "integration"), ignore)]
fn test_query_auth_params() {
let env = Setup::new(ExchangeType::None);
let wasm = Wasm::new(&env.app);
let query_msg = QueryMsg::QueryStargate {
path: "/cosmos.auth.v1beta1.Query/Params".to_string(),
query_request: "".to_string(),
};

let contract_response: QueryStargateResponse = wasm.query(&env.contract_address, &query_msg).unwrap();
let contract_response = contract_response.value;
let response: ParamResponse<AuthParams> = serde_json::from_str(&contract_response).unwrap();
assert_eq!(response.params.max_memo_characters, "256");
}


#[test]
#[cfg_attr(not(feature = "integration"), ignore)]
fn test_query_auth_account() {
let env = Setup::new(ExchangeType::None);
let wasm = Wasm::new(&env.app);

let query_msg = QueryMsg::QueryStargate {
path: "/cosmos.auth.v1beta1.Query/Account".to_string(),
query_request: encode_proto_message(QueryAccountRequest {
address: env.users[0].account.address().to_string(),
}),
};

let contract_response: QueryStargateResponse = wasm.query(&env.contract_address, &query_msg).unwrap();
let contract_response = contract_response.value;
println!("{:?}", contract_response);
let response: ParamResponse<AuthParams> = serde_json::from_str(&contract_response).unwrap();
assert_eq!(response.params.max_memo_characters, "256");
}
Original file line number Diff line number Diff line change
@@ -1,22 +0,0 @@
use crate::{
msg::{QueryMsg, QueryStargateResponse},
testing::type_helpers::{AuthParams, ParamResponse},
utils::{ExchangeType, Setup},
};
use injective_test_tube::{Module, Wasm};

#[test]
#[cfg_attr(not(feature = "integration"), ignore)]
fn test_query_exchange_params() {
let env = Setup::new(ExchangeType::None);
let wasm = Wasm::new(&env.app);
let query_msg = QueryMsg::QueryStargate {
path: "/cosmos.auth.v1beta1.Query/Params".to_string(),
query_request: "".to_string(),
};

let contract_response: QueryStargateResponse = wasm.query(&env.contract_address, &query_msg).unwrap();
let contract_response = contract_response.value;
let response: ParamResponse<AuthParams> = serde_json::from_str(&contract_response).unwrap();
assert_eq!(response.params.max_memo_characters, "256");
}

0 comments on commit bdb96e4

Please sign in to comment.