From 859d2e9fa52af3669a1dfa1f3bd886cb574d67e9 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 4 Nov 2019 13:29:05 +0300 Subject: [PATCH] fix AddressInternalTransactionControllerTest --- ...s_internal_transaction_controller_test.exs | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/apps/block_scout_web/test/block_scout_web/controllers/address_internal_transaction_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/address_internal_transaction_controller_test.exs index 90b0c6500f..5024a0ce42 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/address_internal_transaction_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/address_internal_transaction_controller_test.exs @@ -4,7 +4,7 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do import BlockScoutWeb.WebRouter.Helpers, only: [address_internal_transaction_path: 3, address_internal_transaction_path: 4] - alias Explorer.Chain.{Block, InternalTransaction, Transaction} + alias Explorer.Chain.{Address, Block, InternalTransaction, Transaction} alias Explorer.ExchangeRates.Token describe "GET index/3" do @@ -17,7 +17,15 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do end test "with valid address hash without address", %{conn: conn} do - conn = get(conn, address_internal_transaction_path(conn, :index, "0x8bf38d4764929064f2d4d3a56520a76ab3df415b")) + conn = + get( + conn, + address_internal_transaction_path( + conn, + :index, + Address.checksum("0x8bf38d4764929064f2d4d3a56520a76ab3df415b") + ) + ) assert html_response(conn, 404) end @@ -25,7 +33,8 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do test "includes USD exchange rate value for address in assigns", %{conn: conn} do address = insert(:address) - conn = get(conn, address_internal_transaction_path(BlockScoutWeb.Endpoint, :index, address.hash)) + conn = + get(conn, address_internal_transaction_path(BlockScoutWeb.Endpoint, :index, Address.checksum(address.hash))) assert %Token{} = conn.assigns.exchange_rate end @@ -56,7 +65,7 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do transaction_index: transaction.index ) - path = address_internal_transaction_path(conn, :index, address, %{"type" => "JSON"}) + path = address_internal_transaction_path(conn, :index, Address.checksum(address), %{"type" => "JSON"}) conn = get(conn, path) internal_transaction_tiles = json_response(conn, 200)["items"] @@ -137,7 +146,9 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do transaction_index: transaction.index ) - path = address_internal_transaction_path(conn, :index, address, %{"filter" => "to", "type" => "JSON"}) + path = + address_internal_transaction_path(conn, :index, Address.checksum(address), %{"filter" => "to", "type" => "JSON"}) + conn = get(conn, path) internal_transaction_tiles = json_response(conn, 200)["items"] @@ -312,7 +323,7 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do get(conn, address_internal_transaction_path(BlockScoutWeb.Endpoint, :index, address.hash, %{"type" => "JSON"})) expected_response = - address_internal_transaction_path(BlockScoutWeb.Endpoint, :index, address.hash, %{ + address_internal_transaction_path(BlockScoutWeb.Endpoint, :index, Address.checksum(address.hash), %{ "block_number" => number, "index" => 11, "transaction_index" => transaction_index @@ -340,7 +351,12 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do end) conn = - get(conn, address_internal_transaction_path(BlockScoutWeb.Endpoint, :index, address.hash, %{"type" => "JSON"})) + get( + conn, + address_internal_transaction_path(BlockScoutWeb.Endpoint, :index, Address.checksum(address.hash), %{ + "type" => "JSON" + }) + ) assert %{"next_page_path" => nil} = json_response(conn, 200) end