From 273d7c00c32213bc7a42b8d7d030898a49693454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20Str=C3=B6m?= Date: Thu, 29 Sep 2016 14:48:44 +0200 Subject: [PATCH] Pass cli tests, remove compiler warnings --- parity/cli/mod.rs | 3 +++ rpc_cli/src/lib.rs | 8 +++----- rpc_client/src/client.rs | 2 -- rpc_client/src/lib.rs | 10 +++++----- rpc_client/src/signer.rs | 1 - 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/parity/cli/mod.rs b/parity/cli/mod.rs index a535d4195..4916d117d 100644 --- a/parity/cli/mod.rs +++ b/parity/cli/mod.rs @@ -506,6 +506,8 @@ mod tests { cmd_blocks: false, cmd_import: false, cmd_signer: false, + cmd_sign: false, + cmd_reject: false, cmd_new_token: false, cmd_snapshot: false, cmd_restore: false, @@ -516,6 +518,7 @@ mod tests { // Arguments arg_pid_file: "".into(), arg_file: None, + arg_id: None, arg_path: vec![], // -- Operating Options diff --git a/rpc_cli/src/lib.rs b/rpc_cli/src/lib.rs index a69351fd0..dba4d681f 100644 --- a/rpc_cli/src/lib.rs +++ b/rpc_cli/src/lib.rs @@ -16,10 +16,9 @@ use std::fs::File; use futures::Future; fn sign_interactive(signer: &mut SignerRpc, pwd: &String, request: ConfirmationRequest) - -> Result { print!("\n{}\nSign this transaction? (y)es/(N)o/(r)eject: ", request); - stdout().flush(); + let _ = stdout().flush(); match BufReader::new(stdin()).lines().next() { Some(Ok(line)) => { match line.to_lowercase().chars().nth(0) { @@ -36,9 +35,8 @@ fn sign_interactive(signer: &mut SignerRpc, pwd: &String, request: ConfirmationR _ => () } } - _ => return Err("Could not read from stdin".to_string()) + _ => println!("Could not read from stdin") } - Ok("Finished".to_string()) } fn sign_transactions(signer: &mut SignerRpc, pwd: String) -> Result { @@ -49,7 +47,7 @@ fn sign_transactions(signer: &mut SignerRpc, pwd: String) -> Result c.complete(Ok(Rpc { out: mem::replace(&mut self.out, None).unwrap(), - auth_code: self.auth_code.clone(), counter: AtomicUsize::new(0), pending: self.pending.clone(), })), @@ -138,7 +137,6 @@ pub struct Rpc { out: Sender, counter: AtomicUsize, pending: Pending, - auth_code: String, } impl Rpc { diff --git a/rpc_client/src/lib.rs b/rpc_client/src/lib.rs index 345526828..eae26e57b 100644 --- a/rpc_client/src/lib.rs +++ b/rpc_client/src/lib.rs @@ -18,18 +18,18 @@ extern crate lazy_static; #[macro_use] extern crate matches; +#[cfg(test)] mod test { use futures::Future; - use url::Url; use std::path::PathBuf; use client::{Rpc, RpcError}; - use mock; + use mock::serve; #[test] fn test_connection_refused() { - let (srv, port, tmpdir, _) = mock::serve(); + let (srv, port, tmpdir, _) = serve(); let mut path = PathBuf::from(tmpdir.path()); path.push("authcodes"); @@ -44,7 +44,7 @@ mod test { #[test] fn test_authcode_fail() { - let (srv, port, _, _) = mock::serve(); + let (srv, port, _, _) = serve(); let path = PathBuf::from("nonexist"); let connect = Rpc::connect(&format!("ws://127.0.0.1:{}", port), &path); @@ -58,7 +58,7 @@ mod test { #[test] fn test_authcode_correct() { - let (srv, port, tmpdir, _) = mock::serve(); + let (srv, port, tmpdir, _) = serve(); let mut path = PathBuf::from(tmpdir.path()); path.push("authcodes"); diff --git a/rpc_client/src/signer.rs b/rpc_client/src/signer.rs index 8ca4724a1..1fac588a5 100644 --- a/rpc_client/src/signer.rs +++ b/rpc_client/src/signer.rs @@ -1,7 +1,6 @@ use client::{Rpc, RpcError}; use rpc::v1::types::{ConfirmationRequest, - ConfirmationPayload, TransactionModification, U256}; use serde_json::{Value as JsonValue, to_value};