WIP
This commit is contained in:
parent
04cfb8d16f
commit
e6abeb5ba7
1 changed files with 24 additions and 1 deletions
|
@ -72,8 +72,10 @@ impl CliClient {
|
||||||
let output = command.output().expect("command output failed").stdout;
|
let output = command.output().expect("command output failed").stdout;
|
||||||
let output_str: String = std::str::from_utf8(&output).expect("unable to parse command output").to_string();
|
let output_str: String = std::str::from_utf8(&output).expect("unable to parse command output").to_string();
|
||||||
let json: Value = serde_json::from_str(&output_str).expect("could not convert to JSON");
|
let json: Value = serde_json::from_str(&output_str).expect("could not convert to JSON");
|
||||||
|
assert_eq!(json["price"]["amount"].to_string(), "0.005300000000000000");
|
||||||
|
|
||||||
|
let price = &json["price"]["amount"].as_f64().expect("couldn't parse gas price");
|
||||||
|
|
||||||
let price = &json["price"]["amount"].as_f64().expect("couldn't parse gas price");
|
|
||||||
let gas_price = format!("{}untrn", price);
|
let gas_price = format!("{}untrn", price);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
@ -285,3 +287,24 @@ impl CwClient for CliClient {
|
||||||
Ok((trusted_height, trusted_hash))
|
Ok((trusted_height, trusted_hash))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn it_works() {
|
||||||
|
let mut command = Command::new("neutrond");
|
||||||
|
let command = command
|
||||||
|
.arg("q")
|
||||||
|
.arg("feemarket")
|
||||||
|
.arg("gas-price")
|
||||||
|
.arg("untrn")
|
||||||
|
.arg ("-o")
|
||||||
|
.arg("json");
|
||||||
|
let output = command.output().expect("command output failed").stdout;
|
||||||
|
let output_str: String = std::str::from_utf8(&output).expect("unable to parse command output").to_string();
|
||||||
|
let json: Value = serde_json::from_str(&output_str).expect("could not convert to JSON");
|
||||||
|
assert_eq!(json["price"]["amount"].to_string(), "0.005300000000000000");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue