move "integration" tests out into main module

This commit is contained in:
Robert Habermeier 2016-05-27 18:40:48 +02:00
parent 9d4cd7b73e
commit c021ecd13b
5 changed files with 37 additions and 56 deletions

View File

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

View File

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

View File

@ -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 <http://www.gnu.org/licenses/>.
//! 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;

View File

@ -14,7 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! 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;

View File

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