|
|
@ -5,10 +5,10 @@ defmodule BlockScoutWeb.API.RPC.BlockControllerTest do |
|
|
|
|
|
|
|
|
|
|
|
describe "getblockreward" do |
|
|
|
describe "getblockreward" do |
|
|
|
test "with missing block number", %{conn: conn} do |
|
|
|
test "with missing block number", %{conn: conn} do |
|
|
|
assert response = |
|
|
|
response = |
|
|
|
conn |
|
|
|
conn |
|
|
|
|> get("/api", %{"module" => "block", "action" => "getblockreward"}) |
|
|
|
|> get("/api", %{"module" => "block", "action" => "getblockreward"}) |
|
|
|
|> json_response(400) |
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
|
|
|
assert response["message"] =~ "'blockno' is required" |
|
|
|
assert response["message"] =~ "'blockno' is required" |
|
|
|
assert response["status"] == "0" |
|
|
|
assert response["status"] == "0" |
|
|
@ -17,10 +17,10 @@ defmodule BlockScoutWeb.API.RPC.BlockControllerTest do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
test "with an invalid block number", %{conn: conn} do |
|
|
|
test "with an invalid block number", %{conn: conn} do |
|
|
|
assert response = |
|
|
|
response = |
|
|
|
conn |
|
|
|
conn |
|
|
|
|> get("/api", %{"module" => "block", "action" => "getblockreward", "blockno" => "badnumber"}) |
|
|
|
|> get("/api", %{"module" => "block", "action" => "getblockreward", "blockno" => "badnumber"}) |
|
|
|
|> json_response(400) |
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
|
|
|
assert response["message"] =~ "Invalid block number" |
|
|
|
assert response["message"] =~ "Invalid block number" |
|
|
|
assert response["status"] == "0" |
|
|
|
assert response["status"] == "0" |
|
|
@ -29,10 +29,10 @@ defmodule BlockScoutWeb.API.RPC.BlockControllerTest do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
test "with a block that doesn't exist", %{conn: conn} do |
|
|
|
test "with a block that doesn't exist", %{conn: conn} do |
|
|
|
assert response = |
|
|
|
response = |
|
|
|
conn |
|
|
|
conn |
|
|
|
|> get("/api", %{"module" => "block", "action" => "getblockreward", "blockno" => "42"}) |
|
|
|
|> get("/api", %{"module" => "block", "action" => "getblockreward", "blockno" => "42"}) |
|
|
|
|> json_response(404) |
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
|
|
|
assert response["message"] =~ "Block does not exist" |
|
|
|
assert response["message"] =~ "Block does not exist" |
|
|
|
assert response["status"] == "0" |
|
|
|
assert response["status"] == "0" |
|
|
|