|
|
@ -3,7 +3,7 @@ defmodule BlockScoutWeb.AddressTransactionControllerTest do |
|
|
|
|
|
|
|
|
|
|
|
import BlockScoutWeb.WebRouter.Helpers, only: [address_transaction_path: 3, address_transaction_path: 4] |
|
|
|
import BlockScoutWeb.WebRouter.Helpers, only: [address_transaction_path: 3, address_transaction_path: 4] |
|
|
|
|
|
|
|
|
|
|
|
alias Explorer.Chain.Transaction |
|
|
|
alias Explorer.Chain.{Address, Transaction} |
|
|
|
alias Explorer.ExchangeRates.Token |
|
|
|
alias Explorer.ExchangeRates.Token |
|
|
|
|
|
|
|
|
|
|
|
describe "GET index/2" do |
|
|
|
describe "GET index/2" do |
|
|
@ -17,7 +17,9 @@ defmodule BlockScoutWeb.AddressTransactionControllerTest do |
|
|
|
conn = |
|
|
|
conn = |
|
|
|
get( |
|
|
|
get( |
|
|
|
conn, |
|
|
|
conn, |
|
|
|
address_transaction_path(conn, :index, "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", %{"type" => "JSON"}) |
|
|
|
address_transaction_path(conn, :index, Address.checksum("0x8bf38d4764929064f2d4d3a56520a76ab3df415b"), %{ |
|
|
|
|
|
|
|
"type" => "JSON" |
|
|
|
|
|
|
|
}) |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
assert json_response(conn, 200) |
|
|
|
assert json_response(conn, 200) |
|
|
@ -73,7 +75,7 @@ defmodule BlockScoutWeb.AddressTransactionControllerTest do |
|
|
|
|> with_block() |
|
|
|
|> with_block() |
|
|
|
|
|
|
|
|
|
|
|
conn = |
|
|
|
conn = |
|
|
|
get(conn, address_transaction_path(BlockScoutWeb.Endpoint, :index, address.hash), %{ |
|
|
|
get(conn, address_transaction_path(BlockScoutWeb.Endpoint, :index, Address.checksum(address.hash)), %{ |
|
|
|
"block_number" => Integer.to_string(block_number), |
|
|
|
"block_number" => Integer.to_string(block_number), |
|
|
|
"index" => Integer.to_string(index), |
|
|
|
"index" => Integer.to_string(index), |
|
|
|
"type" => "JSON" |
|
|
|
"type" => "JSON" |
|
|
@ -94,7 +96,7 @@ defmodule BlockScoutWeb.AddressTransactionControllerTest do |
|
|
|
|> insert_list(:transaction, from_address: address) |
|
|
|
|> insert_list(:transaction, from_address: address) |
|
|
|
|> with_block(block) |
|
|
|
|> with_block(block) |
|
|
|
|
|
|
|
|
|
|
|
conn = get(conn, address_transaction_path(conn, :index, address.hash, %{"type" => "JSON"})) |
|
|
|
conn = get(conn, address_transaction_path(conn, :index, Address.checksum(address.hash), %{"type" => "JSON"})) |
|
|
|
|
|
|
|
|
|
|
|
assert json_response(conn, 200)["next_page_path"] |
|
|
|
assert json_response(conn, 200)["next_page_path"] |
|
|
|
end |
|
|
|
end |
|
|
@ -151,7 +153,7 @@ defmodule BlockScoutWeb.AddressTransactionControllerTest do |
|
|
|
insert(:token_transfer, transaction: transaction, from_address: address) |
|
|
|
insert(:token_transfer, transaction: transaction, from_address: address) |
|
|
|
insert(:token_transfer, transaction: transaction, to_address: address) |
|
|
|
insert(:token_transfer, transaction: transaction, to_address: address) |
|
|
|
|
|
|
|
|
|
|
|
conn = get(conn, "/token_transfers_csv", %{"address_id" => to_string(address.hash)}) |
|
|
|
conn = get(conn, "/token_transfers_csv", %{"address_id" => Address.checksum(address.hash)}) |
|
|
|
|
|
|
|
|
|
|
|
assert conn.resp_body |> String.split("\n") |> Enum.count() == 4 |
|
|
|
assert conn.resp_body |> String.split("\n") |> Enum.count() == 4 |
|
|
|
end |
|
|
|
end |
|
|
@ -169,7 +171,7 @@ defmodule BlockScoutWeb.AddressTransactionControllerTest do |
|
|
|
|> insert(from_address: address) |
|
|
|
|> insert(from_address: address) |
|
|
|
|> with_block() |
|
|
|
|> with_block() |
|
|
|
|
|
|
|
|
|
|
|
conn = get(conn, "/transactions_csv", %{"address_id" => to_string(address.hash)}) |
|
|
|
conn = get(conn, "/transactions_csv", %{"address_id" => Address.checksum(address.hash)}) |
|
|
|
|
|
|
|
|
|
|
|
assert conn.resp_body |> String.split("\n") |> Enum.count() == 4 |
|
|
|
assert conn.resp_body |> String.split("\n") |> Enum.count() == 4 |
|
|
|
end |
|
|
|
end |
|
|
|