Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
Fix the unit tests breakage in m15 (#381)
Browse files Browse the repository at this point in the history
  • Loading branch information
jflatow authored Jun 25, 2021
1 parent 7a163ab commit 2d47f02
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 38 deletions.
2 changes: 1 addition & 1 deletion pallets/cash/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ pub fn gen_mock_calls(
for block in blocks {
let block_str = encode_block_hex(block.number);

let get_block_params: Vec<serde_json::Value> = vec![block_str.clone().into(), true.into()];
let get_block_params: Vec<serde_json::Value> = vec![block_str.clone().into(), false.into()];

let get_block_data = serde_json::json!({
"jsonrpc": "2.0",
Expand Down
34 changes: 0 additions & 34 deletions pallets/cash/src/tests/testdata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,6 @@ pub mod json_responses {
"stateRoot":"0x40b48fa241b8f9749af10a5dd1dfb8db245ba94cbb4969ab5c5b905a6adfe5f6",
"timestamp":"0x5aae89b9",
"totalDifficulty":"0xa91291ae5c752d4885",
"transactions":[{
"blockHash":"0x61314c1c6837e15e60c5b6732f092118dd25e3ec681f5e089b3a9ad2374e5a8a",
"blockNumber":"0x1",
"from":"0x22b84d5ffea8b801c0422afe752377a64aa738c2",
"gas":"0x186a0",
"gasPrice":"0x153005ce00",
"hash":"0x94859e5d00b6bc572f877eaae906c0093eb22267d2d84d720ac90627fc63147c",
"input":"0x",
"nonce":"0x6740d",
"r":"0x5fc50bea42bc3d8c5f47790b92fbd79fa296f90fea4d35f1621001f6316a1b91",
"s":"0x774a47ca2112dd815f3bda90d537dfcdab0082f6bfca7262f91df258addf5706",
"v":"0x25",
"to":"0x1d53de4d66110689bf494a110e859f3a6d15661f",
"transactionIndex":"0x0",
"type":"0x0",
"value":"0x453aa4214124000"
}],
"transactionsRoot":"0xa46bb7bc06d4ad700df4100095fecd5a5af2994b6d1d24162ded673b7d485610",
"uncles":["0x5e7dde2e3811b5881a062c8b2ff7fd14687d79745e2384965d73a9df3fb0b4a8"]}
}"#;
Expand All @@ -68,23 +51,6 @@ pub mod json_responses {
"stateRoot":"0x40b48fa241b8f9749af10a5dd1dfb8db245ba94cbb4969ab5c5b905a6adfe5f6",
"timestamp":"0x5aae89b9",
"totalDifficulty":"0xa91291ae5c752d4885",
"transactions":[{
"blockHash":"0x61314c1c6837e15e60c5b6732f092118dd25e3ec681f5e089b3a9ad2374e5a8b",
"blockNumber":"0x2",
"from":"0x22b84d5ffea8b801c0422afe752377a64aa738c2",
"gas":"0x186a0",
"gasPrice":"0x153005ce00",
"hash":"0x94859e5d00b6bc572f877eaae906c0093eb22267d2d84d720ac90627fc63147c",
"input":"0x",
"nonce":"0x6740d",
"r":"0x5fc50bea42bc3d8c5f47790b92fbd79fa296f90fea4d35f1621001f6316a1b91",
"s":"0x774a47ca2112dd815f3bda90d537dfcdab0082f6bfca7262f91df258addf5706",
"v":"0x25",
"to":"0x1d53de4d66110689bf494a110e859f3a6d15661f",
"transactionIndex":"0x0",
"type":"0x0",
"value":"0x453aa4214124000"
}],
"transactionsRoot":"0xa46bb7bc06d4ad700df4100095fecd5a5af2994b6d1d24162ded673b7d485610",
"uncles":["0x5e7dde2e3811b5881a062c8b2ff7fd14687d79745e2384965d73a9df3fb0b4a8"]}
}"#;
Expand Down
6 changes: 3 additions & 3 deletions pallets/cash/src/tests/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn test_offchain_worker() {
method: "POST".into(),
uri: "https://ropsten-eth.compound.finance".to_string(),
headers: vec![("Content-Type".to_owned(), "application/json".to_owned())],
body: br#"{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x1",true],"id":1}"#.to_vec(),
body: br#"{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x1",false],"id":1}"#.to_vec(),
response: Some(tests::testdata::json_responses::GET_BLOCK_BY_NUMBER_1.to_vec()),
sent: true,
..Default::default()
Expand All @@ -28,7 +28,7 @@ fn test_offchain_worker() {
method: "POST".into(),
uri: "https://ropsten-eth.compound.finance".to_string(),
headers: vec![("Content-Type".to_owned(), "application/json".to_owned())],
body: br#"{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x2",true],"id":1}"#.to_vec(),
body: br#"{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x2",false],"id":1}"#.to_vec(),
response: Some(tests::testdata::json_responses::GET_BLOCK_BY_NUMBER_2.to_vec()),
sent: true,
..Default::default()
Expand All @@ -46,7 +46,7 @@ fn test_offchain_worker() {
method: "POST".into(),
uri: "https://ropsten-eth.compound.finance".to_string(),
headers: vec![("Content-Type".to_owned(), "application/json".to_owned())],
body: br#"{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x3",true],"id":1}"#.to_vec(),
body: br#"{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x3",false],"id":1}"#.to_vec(),
response: Some(tests::testdata::json_responses::NO_RESULT.to_vec()),
sent: true,
..Default::default()
Expand Down

0 comments on commit 2d47f02

Please sign in to comment.