Pass cli tests, remove compiler warnings

This commit is contained in:
Kristoffer Ström 2016-09-29 14:48:44 +02:00 committed by arkpar
parent 4e3f8bab10
commit 273d7c00c3
5 changed files with 11 additions and 13 deletions

View File

@ -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

View File

@ -16,10 +16,9 @@ use std::fs::File;
use futures::Future;
fn sign_interactive(signer: &mut SignerRpc, pwd: &String, request: ConfirmationRequest)
-> Result<String, String>
{
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<String, String> {
@ -49,7 +47,7 @@ fn sign_transactions(signer: &mut SignerRpc, pwd: String) -> Result<String, Stri
Ok("No transactions in signing queue".to_string())
} else {
for r in reqs {
sign_interactive(signer, &pwd, r);
sign_interactive(signer, &pwd, r)
}
Ok("".to_string())
}

View File

@ -84,7 +84,6 @@ impl Handler for RpcHandler {
match mem::replace(&mut self.complete, None) {
Some(c) => 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 {

View File

@ -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");

View File

@ -1,7 +1,6 @@
use client::{Rpc, RpcError};
use rpc::v1::types::{ConfirmationRequest,
ConfirmationPayload,
TransactionModification,
U256};
use serde_json::{Value as JsonValue, to_value};