Merge pull request 'Make jsonrpc-test a dev dependency' (#16) from jsonrpc_test_dev_dep into main

Reviewed-on: #16
This commit is contained in:
2021-11-08 09:54:18 +00:00
10 changed files with 53 additions and 143 deletions

91
Cargo.lock generated
View File

@ -1402,22 +1402,6 @@ dependencies = [
"tokio-core",
]
[[package]]
name = "jsonrpc-client-transports"
version = "14.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2773fa94a2a1fd51efb89a8f45b8861023dbb415d18d3c9235ae9388d780f9ec"
dependencies = [
"failure",
"futures 0.1.31",
"jsonrpc-core 14.2.0",
"jsonrpc-pubsub 14.2.0",
"log 0.4.14",
"serde 1.0.130",
"serde_json",
"url",
]
[[package]]
name = "jsonrpc-client-transports"
version = "18.0.0"
@ -1502,15 +1486,6 @@ dependencies = [
"serde_json",
]
[[package]]
name = "jsonrpc-core-client"
version = "14.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34221123bc79b66279a3fde2d3363553835b43092d629b34f2e760c44dc94713"
dependencies = [
"jsonrpc-client-transports 14.2.1",
]
[[package]]
name = "jsonrpc-core-client"
version = "18.0.0"
@ -1518,7 +1493,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b51da17abecbdab3e3d4f26b01c5ec075e88d3abe3ab3b05dc9aa69392764ec0"
dependencies = [
"futures 0.3.17",
"jsonrpc-client-transports 18.0.0",
"jsonrpc-client-transports",
]
[[package]]
@ -1563,19 +1538,6 @@ dependencies = [
"serde 1.0.130",
]
[[package]]
name = "jsonrpc-pubsub"
version = "14.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d44f5602a11d657946aac09357956d2841299ed422035edf140c552cb057986"
dependencies = [
"jsonrpc-core 14.2.0",
"log 0.4.14",
"parking_lot 0.10.2",
"rand 0.7.3",
"serde 1.0.130",
]
[[package]]
name = "jsonrpc-pubsub"
version = "18.0.0"
@ -1640,20 +1602,6 @@ dependencies = [
"serde_json",
]
[[package]]
name = "jsonrpc-test"
version = "14.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fdbfe280021d220b3392e38b34781647f8268eef6d71564074a870a08404899"
dependencies = [
"jsonrpc-core 14.2.0",
"jsonrpc-core-client 14.2.0",
"jsonrpc-pubsub 14.2.0",
"log 0.4.14",
"serde 1.0.130",
"serde_json",
]
[[package]]
name = "jsonrpc-test"
version = "18.0.0"
@ -2347,16 +2295,6 @@ dependencies = [
"rustc_version 0.2.3",
]
[[package]]
name = "parking_lot"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e"
dependencies = [
"lock_api 0.3.4",
"parking_lot_core 0.7.2",
]
[[package]]
name = "parking_lot"
version = "0.11.2"
@ -2396,20 +2334,6 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "parking_lot_core"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3"
dependencies = [
"cfg-if 0.1.10",
"cloudabi",
"libc",
"redox_syscall 0.1.57",
"smallvec 1.7.0",
"winapi 0.3.9",
]
[[package]]
name = "parking_lot_core"
version = "0.8.5"
@ -2502,7 +2426,6 @@ dependencies = [
"jsonrpc-client-core",
"jsonrpc-client-http",
"jsonrpc-http-server 11.0.0",
"jsonrpc-test 11.0.0",
"log 0.4.14",
"peach-lib",
"serde 1.0.130",
@ -2570,7 +2493,6 @@ dependencies = [
"jsonrpc-client-core",
"jsonrpc-client-http",
"jsonrpc-core 14.2.0",
"jsonrpc-test 14.2.0",
"log 0.4.14",
"peach-lib",
"regex",
@ -2764,7 +2686,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f77e66f6d6d898cbbd4a09c48fd3507cfc210b7c83055de02a38b5f7a1e6d216"
dependencies = [
"libc",
"time 0.3.4",
"time 0.1.44",
]
[[package]]
@ -3985,15 +3907,6 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "time"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99beeb0daeac2bd1e86ac2c21caddecb244b39a093594da1a661ec2060c7aedd"
dependencies = [
"libc",
]
[[package]]
name = "time-macros"
version = "0.1.1"

View File

@ -35,6 +35,8 @@ gpio-cdev = "0.2"
jsonrpc-core = "11"
jsonrpc-ws-server = "11"
jsonrpc-pubsub = "11"
jsonrpc-test = "11"
log = "0.4"
snafu = "0.4"
[dev-dependencies]
jsonrpc-test = "11"

View File

@ -7,8 +7,6 @@ use crossbeam_channel::bounded;
use jsonrpc_core::futures::Future;
use jsonrpc_core::*;
use jsonrpc_pubsub::{PubSubHandler, Session, Subscriber, SubscriptionId};
#[allow(unused_imports)]
use jsonrpc_test as test;
use jsonrpc_ws_server::{RequestContext, ServerBuilder};
use log::{debug, error, info, warn};
@ -103,6 +101,7 @@ pub fn run() -> Result<(), BoxError> {
#[cfg(test)]
mod tests {
use super::*;
use jsonrpc_test as test_rpc;
#[test]
fn rpc_success() {
@ -111,7 +110,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""#);

View File

@ -30,4 +30,3 @@ maintenance = { status = "actively-developed" }
peach-lib = { path = "../peach-lib" }
env_logger = "0.6"
log = "0.4"

View File

@ -35,7 +35,6 @@ env_logger = "0.6"
jsonrpc-client-core = "0.5.0"
jsonrpc-client-http = "0.5.0"
jsonrpc-http-server = "11"
jsonrpc-test = "11"
log = "0.4"
peach-lib = { path = "../peach-lib" }
serde = { version = "1", features = ["derive"] }

View File

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

View File

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

View File

@ -29,7 +29,6 @@ maintenance = { status = "actively-developed" }
[dependencies]
jsonrpc-core = "11.0.0"
jsonrpc-http-server = "11.0.0"
jsonrpc-test = "11.0.0"
linux-embedded-hal = "0.2.2"
embedded-graphics = "0.4.7"
tinybmp = "0.1.0"
@ -40,3 +39,6 @@ log = "0.4.0"
env_logger = "0.6.1"
snafu = "0.4.1"
nix="0.11"
[dev-dependencies]
jsonrpc-test = "11.0.0"

View File

@ -13,8 +13,6 @@ use embedded_graphics::prelude::*;
use hal::I2cdev;
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 linux_embedded_hal as hal;
use log::{debug, error, info};
use serde::Deserialize;
@ -247,6 +245,7 @@ mod tests {
use hal::i2cdev::linux::LinuxI2CError;
use jsonrpc_core::ErrorCode;
use jsonrpc_test as test_rpc;
//use nix::Error as NixError;
use std::io::Error as IoError;
use std::io::ErrorKind;
@ -259,7 +258,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""#);
@ -271,7 +270,7 @@ mod tests {
let rpc = {
let mut io = IoHandler::new();
io.add_method("rpc_internal_error", |_| Err(Error::internal_error()));
test::Rpc::from(io)
test_rpc::Rpc::from(io)
};
assert_eq!(
@ -293,7 +292,7 @@ mod tests {
let source = LinuxI2CError::Io(io_err);
Err(Error::from(OledError::I2CError { source }))
});
test::Rpc::from(io)
test_rpc::Rpc::from(io)
};
assert_eq!(
@ -316,7 +315,7 @@ mod tests {
let source = LinuxI2CError::Nix(nix_err);
Err(Error::from(OledError::I2CError { source }))
});
test::Rpc::from(io)
test_rpc::Rpc::from(io)
};
assert_eq!(
@ -341,7 +340,7 @@ mod tests {
value: 321,
}))
});
test::Rpc::from(io)
test_rpc::Rpc::from(io)
};
assert_eq!(
@ -363,7 +362,7 @@ mod tests {
font: "24x32".to_string(),
}))
});
test::Rpc::from(io)
test_rpc::Rpc::from(io)
};
assert_eq!(
@ -383,7 +382,7 @@ mod tests {
io.add_method("rpc_invalid_string", |_| {
Err(Error::from(OledError::InvalidString { len: 22 }))
});
test::Rpc::from(io)
test_rpc::Rpc::from(io)
};
assert_eq!(
@ -410,7 +409,7 @@ mod tests {
};
Err(Error::from(OledError::MissingParameter { e }))
});
test::Rpc::from(io)
test_rpc::Rpc::from(io)
};
assert_eq!(
@ -436,7 +435,7 @@ mod tests {
};
Err(Error::from(OledError::ParseError { e }))
});
test::Rpc::from(io)
test_rpc::Rpc::from(io)
};
assert_eq!(

View File

@ -28,7 +28,6 @@ log = "0.4.0"
jsonrpc-core = "14.2"
jsonrpc-client-http = "0.5"
jsonrpc-client-core = "0.5"
jsonrpc-test = "14.2"
snafu = "0.4.1"
serde = "1.0"
serde_json = "1.0"
@ -37,6 +36,3 @@ peach-lib = { path = "../peach-lib" }
clap = "2.33.3"
const_format = "0.2.10"
regex = "1"