forked from PeachCloud/peach-workspace
move jsonrpc test to dev deps for network
This commit is contained in:
parent
2c59c33b35
commit
7f815075d2
|
@ -32,7 +32,6 @@ failure = "0.1"
|
|||
get_if_addrs = "0.5.3"
|
||||
jsonrpc-core = "11"
|
||||
jsonrpc-http-server = "11"
|
||||
jsonrpc-test = "11"
|
||||
log = "0.4"
|
||||
probes = "0.4"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
|
@ -40,3 +39,6 @@ serde_json = "1"
|
|||
snafu = "0.6"
|
||||
regex = "1"
|
||||
wpactrl = "0.3.1"
|
||||
|
||||
[dev-dependencies]
|
||||
jsonrpc-test = "11"
|
||||
|
|
|
@ -22,8 +22,6 @@ use std::result::Result;
|
|||
|
||||
use jsonrpc_core::{types::error::Error, IoHandler, Params, Value};
|
||||
use jsonrpc_http_server::{AccessControlAllowOrigin, DomainsValidation, ServerBuilder};
|
||||
#[allow(unused_imports)]
|
||||
use jsonrpc_test as test;
|
||||
use log::info;
|
||||
use serde_json::json;
|
||||
|
||||
|
@ -348,6 +346,7 @@ mod tests {
|
|||
use super::*;
|
||||
|
||||
use jsonrpc_core::ErrorCode;
|
||||
use jsonrpc_test as test_rpc;
|
||||
use std::io::Error as IoError;
|
||||
use std::io::ErrorKind;
|
||||
|
||||
|
@ -358,7 +357,7 @@ mod tests {
|
|||
io.add_method("rpc_success_response", |_| {
|
||||
Ok(Value::String("success".into()))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(rpc.request("rpc_success_response", &()), r#""success""#);
|
||||
|
@ -377,7 +376,7 @@ mod tests {
|
|||
};
|
||||
Err(Error::from(NetworkError::MissingParams { e }))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -399,7 +398,7 @@ mod tests {
|
|||
ssid: "Home".to_string(),
|
||||
}))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -422,7 +421,7 @@ mod tests {
|
|||
iface: "wlan0".to_string(),
|
||||
}))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -444,7 +443,7 @@ mod tests {
|
|||
iface: "wlan0".to_string(),
|
||||
}))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -467,7 +466,7 @@ mod tests {
|
|||
source: IoError::new(ErrorKind::NotFound, "oh no!"),
|
||||
}))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -490,7 +489,7 @@ mod tests {
|
|||
ssid: "Home".to_string(),
|
||||
}))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -513,7 +512,7 @@ mod tests {
|
|||
source: IoError::new(ErrorKind::AddrNotAvailable, "oh no!"),
|
||||
}))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -535,7 +534,7 @@ mod tests {
|
|||
iface: "wlan0".to_string(),
|
||||
}))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -557,7 +556,7 @@ mod tests {
|
|||
iface: "wlan0".to_string(),
|
||||
}))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -579,7 +578,7 @@ mod tests {
|
|||
iface: "wlan0".to_string(),
|
||||
}))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -601,7 +600,7 @@ mod tests {
|
|||
iface: "wlan1".to_string(),
|
||||
}))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -623,7 +622,7 @@ mod tests {
|
|||
iface: "wlan0".to_string(),
|
||||
}))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -643,7 +642,7 @@ mod tests {
|
|||
io.add_method("rpc_savednetworks_error", |_| {
|
||||
Err(Error::from(NetworkError::SavedNetworks))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -665,7 +664,7 @@ mod tests {
|
|||
iface: "wlan0".to_string(),
|
||||
}))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -692,7 +691,7 @@ mod tests {
|
|||
};
|
||||
Err(Error::from(NetworkError::MissingParams { e }))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -715,7 +714,7 @@ mod tests {
|
|||
iface: "wlan0".to_string(),
|
||||
}))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -737,7 +736,7 @@ mod tests {
|
|||
iface: "wlan0".to_string(),
|
||||
}))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -759,7 +758,7 @@ mod tests {
|
|||
iface: "wlan0".to_string(),
|
||||
}))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -779,7 +778,7 @@ mod tests {
|
|||
io.add_method("rpc_reconfigure_error", |_| {
|
||||
Err(Error::from(NetworkError::Reconfigure))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -802,7 +801,7 @@ mod tests {
|
|||
iface: "wlan0".to_string(),
|
||||
}))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -824,7 +823,7 @@ mod tests {
|
|||
iface: "wlan0".to_string(),
|
||||
}))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -845,7 +844,7 @@ mod tests {
|
|||
let source = regex::Error::Syntax("oh no!".to_string());
|
||||
Err(Error::from(NetworkError::Regex { source }))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -868,7 +867,7 @@ mod tests {
|
|||
iface: "wlan0".to_string(),
|
||||
}))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -889,7 +888,7 @@ mod tests {
|
|||
let source = IoError::new(ErrorKind::PermissionDenied, "oh no!");
|
||||
Err(Error::from(NetworkError::WlanState { source }))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -910,7 +909,7 @@ mod tests {
|
|||
let source = IoError::new(ErrorKind::PermissionDenied, "oh no!");
|
||||
Err(Error::from(NetworkError::WlanOperstate { source }))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -928,7 +927,7 @@ mod tests {
|
|||
let rpc = {
|
||||
let mut io = IoHandler::new();
|
||||
io.add_method("rpc_save_error", |_| Err(Error::from(NetworkError::Save)));
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -950,7 +949,7 @@ mod tests {
|
|||
let source = Box::new(fail_err);
|
||||
Err(Error::from(NetworkError::WpaCtrlOpen { source }))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
@ -972,7 +971,7 @@ mod tests {
|
|||
let source = Box::new(fail_err);
|
||||
Err(Error::from(NetworkError::WpaCtrlRequest { source }))
|
||||
});
|
||||
test::Rpc::from(io)
|
||||
test_rpc::Rpc::from(io)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
|
Loading…
Reference in New Issue