From c021ecd13bd9a0005086be311cd68e7c95ae5528 Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Fri, 27 May 2016 18:40:48 +0200 Subject: [PATCH] move "integration" tests out into main module --- rpc/src/v1/tests/{integration => }/eth.rs | 1 - rpc/src/v1/tests/helpers/mod.rs | 2 +- rpc/src/v1/tests/integration/mod.rs | 52 ----------------------- rpc/src/v1/tests/mocked/mod.rs | 3 +- rpc/src/v1/tests/mod.rs | 35 ++++++++++++++- 5 files changed, 37 insertions(+), 56 deletions(-) rename rpc/src/v1/tests/{integration => }/eth.rs (99%) delete mode 100644 rpc/src/v1/tests/integration/mod.rs diff --git a/rpc/src/v1/tests/integration/eth.rs b/rpc/src/v1/tests/eth.rs similarity index 99% rename from rpc/src/v1/tests/integration/eth.rs rename to rpc/src/v1/tests/eth.rs index 386b72cf7..eac5bafcb 100644 --- a/rpc/src/v1/tests/integration/eth.rs +++ b/rpc/src/v1/tests/eth.rs @@ -110,7 +110,6 @@ fn eth_transaction_count() { let res_before = r#"{"jsonrpc":"2.0","result":"0x00","id":15}"#; - assert_eq!(tester.handler.handle_request(&req_before).unwrap(), res_before); let t = Transaction { diff --git a/rpc/src/v1/tests/helpers/mod.rs b/rpc/src/v1/tests/helpers/mod.rs index 9b321af98..1b8f9e256 100644 --- a/rpc/src/v1/tests/helpers/mod.rs +++ b/rpc/src/v1/tests/helpers/mod.rs @@ -20,4 +20,4 @@ mod sync_provider; mod miner_service; pub use self::sync_provider::{Config, TestSyncProvider}; -pub use self::miner_service::{TestMinerService}; +pub use self::miner_service::TestMinerService; diff --git a/rpc/src/v1/tests/integration/mod.rs b/rpc/src/v1/tests/integration/mod.rs deleted file mode 100644 index 4a845c074..000000000 --- a/rpc/src/v1/tests/integration/mod.rs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2016 Ethcore (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -//! Integration tests for the JSONRPC APIs - -// extract a chain from the given JSON file, -// stored in ethcore/res/ethereum/tests/. -// -// usage: -// `extract_chain!("Folder/File")` will load Folder/File.json and extract -// the first block chain stored within. -// -// `extract_chain!("Folder/File", "with_name")` will load Folder/File.json and -// extract the chain with that name. This will panic if no chain by that name -// is found. -macro_rules! extract_chain { - ($file:expr, $name:expr) => {{ - const RAW_DATA: &'static [u8] = - include_bytes!(concat!("../../../../../ethcore/res/ethereum/tests/", $file, ".json")); - let mut chain = None; - for (name, c) in ::ethjson::blockchain::Test::load(RAW_DATA).unwrap() { - if name == $name { - chain = Some(c); - break; - } - } - chain.unwrap() - }}; - - ($file:expr) => {{ - const RAW_DATA: &'static [u8] = - include_bytes!(concat!("../../../../../ethcore/res/ethereum/tests/", $file, ".json")); - - ::ethjson::blockchain::Test::load(RAW_DATA) - .unwrap().into_iter().next().unwrap().1 - }}; -} - -mod eth; \ No newline at end of file diff --git a/rpc/src/v1/tests/mocked/mod.rs b/rpc/src/v1/tests/mocked/mod.rs index 98caf6e08..dc09d998d 100644 --- a/rpc/src/v1/tests/mocked/mod.rs +++ b/rpc/src/v1/tests/mocked/mod.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -//! RPC serialization tests. +//! RPC mocked tests. Most of these test that the RPC server is serializing and forwarding +//! method calls properly. mod eth; mod net; diff --git a/rpc/src/v1/tests/mod.rs b/rpc/src/v1/tests/mod.rs index 78a6a674f..3455bfd1f 100644 --- a/rpc/src/v1/tests/mod.rs +++ b/rpc/src/v1/tests/mod.rs @@ -2,7 +2,40 @@ pub mod helpers; +// extract a chain from the given JSON file, +// stored in ethcore/res/ethereum/tests/. +// +// usage: +// `extract_chain!("Folder/File")` will load Folder/File.json and extract +// the first block chain stored within. +// +// `extract_chain!("Folder/File", "with_name")` will load Folder/File.json and +// extract the chain with that name. This will panic if no chain by that name +// is found. +macro_rules! extract_chain { + ($file:expr, $name:expr) => {{ + const RAW_DATA: &'static [u8] = + include_bytes!(concat!("../../../../ethcore/res/ethereum/tests/", $file, ".json")); + let mut chain = None; + for (name, c) in ::ethjson::blockchain::Test::load(RAW_DATA).unwrap() { + if name == $name { + chain = Some(c); + break; + } + } + chain.unwrap() + }}; + + ($file:expr) => {{ + const RAW_DATA: &'static [u8] = + include_bytes!(concat!("../../../../ethcore/res/ethereum/tests/", $file, ".json")); + + ::ethjson::blockchain::Test::load(RAW_DATA) + .unwrap().into_iter().next().unwrap().1 + }}; +} + #[cfg(test)] mod mocked; #[cfg(test)] -mod integration; +mod eth;