|
|
|
@ -1,4 +1,4 @@ |
|
|
|
|
defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
defmodule BlockScoutWeb.Account.Api.V2.UserControllerTest do |
|
|
|
|
use BlockScoutWeb.ConnCase |
|
|
|
|
|
|
|
|
|
alias Explorer.Account.{ |
|
|
|
@ -19,11 +19,11 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
{:ok, user: user, conn: Plug.Test.init_test_session(conn, current_user: user)} |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "Test account/api/v1/user" do |
|
|
|
|
describe "Test account/api/v2/user" do |
|
|
|
|
test "get user info", %{conn: conn, user: user} do |
|
|
|
|
result_conn = |
|
|
|
|
conn |
|
|
|
|
|> get("/api/account/v1/user/info") |
|
|
|
|
|> get("/api/account/v2/user/info") |
|
|
|
|
|> doc(description: "Get info about user") |
|
|
|
|
|
|
|
|
|
assert json_response(result_conn, 200) == %{ |
|
|
|
@ -37,7 +37,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
test "post private address tag", %{conn: conn} do |
|
|
|
|
tag_address_response = |
|
|
|
|
conn |
|
|
|
|
|> post("/api/account/v1/user/tags/address", %{ |
|
|
|
|
|> post("/api/account/v2/user/tags/address", %{ |
|
|
|
|
"address_hash" => "0x3e9ac8f16c92bc4f093357933b5befbf1e16987b", |
|
|
|
|
"name" => "MyName" |
|
|
|
|
}) |
|
|
|
@ -45,7 +45,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
|
conn |
|
|
|
|
|> get("/api/account/v1/tags/address/0x3e9ac8f16c92bc4f093357933b5befbf1e16987b") |
|
|
|
|
|> get("/api/account/v2/tags/address/0x3e9ac8f16c92bc4f093357933b5befbf1e16987b") |
|
|
|
|
|> doc(description: "Get tags for address") |
|
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
@ -69,11 +69,11 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> post("/api/account/v1/user/tags/address", build(:tag_address)) |
|
|
|
|
|> post("/api/account/v2/user/tags/address", build(:tag_address)) |
|
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> post("/api/account/v1/user/tags/address", build(:tag_address)) |
|
|
|
|
|> post("/api/account/v2/user/tags/address", build(:tag_address)) |
|
|
|
|
|> json_response(422) |
|
|
|
|
|
|
|
|
|
Application.put_env(:explorer, Explorer.Account, old_env) |
|
|
|
@ -103,12 +103,12 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
|
|
|
|
|
tag_address_response = |
|
|
|
|
conn |
|
|
|
|
|> post("/api/account/v1/user/tags/address", address_tag) |
|
|
|
|
|> post("/api/account/v2/user/tags/address", address_tag) |
|
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
|
_response = |
|
|
|
|
conn |
|
|
|
|
|> get("/api/account/v1/user/tags/address") |
|
|
|
|
|> get("/api/account/v2/user/tags/address") |
|
|
|
|
|> json_response(200) == [tag_address_response] |
|
|
|
|
|
|
|
|
|
assert tag_address_response["address_hash"] == address_tag["address_hash"] |
|
|
|
@ -119,7 +119,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
|
|
|
|
|
new_tag_address_response = |
|
|
|
|
conn |
|
|
|
|
|> put("/api/account/v1/user/tags/address/#{tag_address_response["id"]}", new_address_tag) |
|
|
|
|
|> put("/api/account/v2/user/tags/address/#{tag_address_response["id"]}", new_address_tag) |
|
|
|
|
|> doc(description: "Edit private address tag") |
|
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
@ -137,7 +137,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
Enum.map(zipped, fn {addr, name} -> |
|
|
|
|
id = |
|
|
|
|
(conn |
|
|
|
|
|> post("/api/account/v1/user/tags/address", %{ |
|
|
|
|
|> post("/api/account/v2/user/tags/address", %{ |
|
|
|
|
"address_hash" => addr, |
|
|
|
|
"name" => name |
|
|
|
|
}) |
|
|
|
@ -164,7 +164,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
assert Enum.all?(created, fn {addr, map_tag, _} -> |
|
|
|
|
response = |
|
|
|
|
conn |
|
|
|
|
|> get("/api/account/v1/tags/address/#{addr}") |
|
|
|
|
|> get("/api/account/v2/tags/address/#{addr}") |
|
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
|
response["personal_tags"] == [map_tag] |
|
|
|
@ -172,9 +172,10 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
|
|
|
|
|
response = |
|
|
|
|
conn |
|
|
|
|
|> get("/api/account/v1/user/tags/address") |
|
|
|
|
|> get("/api/account/v2/user/tags/address") |
|
|
|
|
|> doc(description: "Get private addresses tags") |
|
|
|
|
|> json_response(200) |
|
|
|
|
|> Map.get("items") |
|
|
|
|
|
|
|
|
|
assert Enum.all?(created, fn {_, _, map} -> map in response end) |
|
|
|
|
end |
|
|
|
@ -188,7 +189,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
Enum.map(zipped, fn {addr, name} -> |
|
|
|
|
id = |
|
|
|
|
(conn |
|
|
|
|
|> post("/api/account/v1/user/tags/address", %{ |
|
|
|
|
|> post("/api/account/v2/user/tags/address", %{ |
|
|
|
|
"address_hash" => addr, |
|
|
|
|
"name" => name |
|
|
|
|
}) |
|
|
|
@ -215,7 +216,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
assert Enum.all?(created, fn {addr, map_tag, _} -> |
|
|
|
|
response = |
|
|
|
|
conn |
|
|
|
|
|> get("/api/account/v1/tags/address/#{addr}") |
|
|
|
|
|> get("/api/account/v2/tags/address/#{addr}") |
|
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
|
response["personal_tags"] == [map_tag] |
|
|
|
@ -223,32 +224,31 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
|
|
|
|
|
response = |
|
|
|
|
conn |
|
|
|
|
|> get("/api/account/v1/user/tags/address") |
|
|
|
|
|> get("/api/account/v2/user/tags/address") |
|
|
|
|
|> json_response(200) |
|
|
|
|
|> Map.get("items") |
|
|
|
|
|
|
|
|
|
assert Enum.all?(created, fn {_, _, map} -> map in response end) |
|
|
|
|
|
|
|
|
|
{_, _, %{"id" => id}} = Enum.at(created, 0) |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> delete("/api/account/v1/user/tags/address/#{id}") |
|
|
|
|
|> delete("/api/account/v2/user/tags/address/#{id}") |
|
|
|
|
|> doc("Delete private address tag") |
|
|
|
|
|> json_response(200) == %{"message" => "OK"} |
|
|
|
|
|
|
|
|
|
assert Enum.all?(Enum.drop(created, 1), fn {_, _, %{"id" => id}} -> |
|
|
|
|
conn |
|
|
|
|
|> delete("/api/account/v1/user/tags/address/#{id}") |
|
|
|
|
|> delete("/api/account/v2/user/tags/address/#{id}") |
|
|
|
|
|> json_response(200) == %{"message" => "OK"} |
|
|
|
|
end) |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> get("/api/account/v1/user/tags/address") |
|
|
|
|
|> json_response(200) == [] |
|
|
|
|
assert conn |> get("/api/account/v2/user/tags/address") |> json_response(200) |> Map.get("items") == [] |
|
|
|
|
|
|
|
|
|
assert Enum.all?(created, fn {addr, _, _} -> |
|
|
|
|
response = |
|
|
|
|
conn |
|
|
|
|
|> get("/api/account/v1/tags/address/#{addr}") |
|
|
|
|
|> get("/api/account/v2/tags/address/#{addr}") |
|
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
|
response["personal_tags"] == [] |
|
|
|
@ -260,7 +260,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
tx_hash = to_string(insert(:transaction).hash) |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> post("/api/account/v1/user/tags/transaction", %{ |
|
|
|
|
|> post("/api/account/v2/user/tags/transaction", %{ |
|
|
|
|
"transaction_hash" => tx_hash_non_existing, |
|
|
|
|
"name" => "MyName" |
|
|
|
|
}) |
|
|
|
@ -269,7 +269,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
|
|
|
|
|
tag_transaction_response = |
|
|
|
|
conn |
|
|
|
|
|> post("/api/account/v1/user/tags/transaction", %{ |
|
|
|
|
|> post("/api/account/v2/user/tags/transaction", %{ |
|
|
|
|
"transaction_hash" => tx_hash, |
|
|
|
|
"name" => "MyName" |
|
|
|
|
}) |
|
|
|
@ -277,7 +277,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
|
conn |
|
|
|
|
|> get("/api/account/v1/tags/transaction/#{tx_hash}") |
|
|
|
|
|> get("/api/account/v2/tags/transaction/#{tx_hash}") |
|
|
|
|
|> doc(description: "Get tags for transaction") |
|
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
@ -301,11 +301,11 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> post("/api/account/v1/user/tags/transaction", build(:tag_transaction)) |
|
|
|
|
|> post("/api/account/v2/user/tags/transaction", build(:tag_transaction)) |
|
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> post("/api/account/v1/user/tags/transaction", build(:tag_transaction)) |
|
|
|
|
|> post("/api/account/v2/user/tags/transaction", build(:tag_transaction)) |
|
|
|
|
|> json_response(422) |
|
|
|
|
|
|
|
|
|
Application.put_env(:explorer, Explorer.Account, old_env) |
|
|
|
@ -335,12 +335,12 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
|
|
|
|
|
tag_response = |
|
|
|
|
conn |
|
|
|
|
|> post("/api/account/v1/user/tags/transaction", tx_tag) |
|
|
|
|
|> post("/api/account/v2/user/tags/transaction", tx_tag) |
|
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
|
_response = |
|
|
|
|
conn |
|
|
|
|
|> get("/api/account/v1/user/tags/transaction") |
|
|
|
|
|> get("/api/account/v2/user/tags/transaction") |
|
|
|
|
|> json_response(200) == [tag_response] |
|
|
|
|
|
|
|
|
|
assert tag_response["address_hash"] == tx_tag["address_hash"] |
|
|
|
@ -351,7 +351,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
|
|
|
|
|
new_tag_response = |
|
|
|
|
conn |
|
|
|
|
|> put("/api/account/v1/user/tags/transaction/#{tag_response["id"]}", new_tx_tag) |
|
|
|
|
|> put("/api/account/v2/user/tags/transaction/#{tag_response["id"]}", new_tx_tag) |
|
|
|
|
|> doc(description: "Edit private transaction tag") |
|
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
@ -369,7 +369,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
Enum.map(zipped, fn {tx_hash, name} -> |
|
|
|
|
id = |
|
|
|
|
(conn |
|
|
|
|
|> post("/api/account/v1/user/tags/transaction", %{ |
|
|
|
|
|> post("/api/account/v2/user/tags/transaction", %{ |
|
|
|
|
"transaction_hash" => tx_hash, |
|
|
|
|
"name" => name |
|
|
|
|
}) |
|
|
|
@ -381,7 +381,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
assert Enum.all?(created, fn {tx_hash, map_tag, _} -> |
|
|
|
|
response = |
|
|
|
|
conn |
|
|
|
|
|> get("/api/account/v1/tags/transaction/#{tx_hash}") |
|
|
|
|
|> get("/api/account/v2/tags/transaction/#{tx_hash}") |
|
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
|
response["personal_tx_tag"] == map_tag |
|
|
|
@ -389,9 +389,10 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
|
|
|
|
|
response = |
|
|
|
|
conn |
|
|
|
|
|> get("/api/account/v1/user/tags/transaction") |
|
|
|
|
|> get("/api/account/v2/user/tags/transaction") |
|
|
|
|
|> doc(description: "Get private transactions tags") |
|
|
|
|
|> json_response(200) |
|
|
|
|
|> Map.get("items") |
|
|
|
|
|
|
|
|
|
assert Enum.all?(created, fn {_, _, map} -> map in response end) |
|
|
|
|
end |
|
|
|
@ -405,7 +406,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
Enum.map(zipped, fn {tx_hash, name} -> |
|
|
|
|
id = |
|
|
|
|
(conn |
|
|
|
|
|> post("/api/account/v1/user/tags/transaction", %{ |
|
|
|
|
|> post("/api/account/v2/user/tags/transaction", %{ |
|
|
|
|
"transaction_hash" => tx_hash, |
|
|
|
|
"name" => name |
|
|
|
|
}) |
|
|
|
@ -417,15 +418,15 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
assert Enum.all?(created, fn {tx_hash, map_tag, _} -> |
|
|
|
|
response = |
|
|
|
|
conn |
|
|
|
|
|> get("/api/account/v1/tags/transaction/#{tx_hash}") |
|
|
|
|
|> get("/api/account/v2/tags/transaction/#{tx_hash}") |
|
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
|
response["personal_tx_tag"] == map_tag |
|
|
|
|
end) |
|
|
|
|
|
|
|
|
|
response = |
|
|
|
|
%{"items" => response, "next_page_params" => nil} = |
|
|
|
|
conn |
|
|
|
|
|> get("/api/account/v1/user/tags/transaction") |
|
|
|
|
|> get("/api/account/v2/user/tags/transaction") |
|
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
|
assert Enum.all?(created, fn {_, _, map} -> map in response end) |
|
|
|
@ -433,24 +434,24 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
{_, _, %{"id" => id}} = Enum.at(created, 0) |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> delete("/api/account/v1/user/tags/transaction/#{id}") |
|
|
|
|
|> delete("/api/account/v2/user/tags/transaction/#{id}") |
|
|
|
|
|> doc("Delete private transaction tag") |
|
|
|
|
|> json_response(200) == %{"message" => "OK"} |
|
|
|
|
|
|
|
|
|
assert Enum.all?(Enum.drop(created, 1), fn {_, _, %{"id" => id}} -> |
|
|
|
|
conn |
|
|
|
|
|> delete("/api/account/v1/user/tags/transaction/#{id}") |
|
|
|
|
|> delete("/api/account/v2/user/tags/transaction/#{id}") |
|
|
|
|
|> json_response(200) == %{"message" => "OK"} |
|
|
|
|
end) |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> get("/api/account/v1/user/tags/transaction") |
|
|
|
|
|> json_response(200) == [] |
|
|
|
|
|> get("/api/account/v2/user/tags/transaction") |
|
|
|
|
|> json_response(200) == %{"items" => [], "next_page_params" => nil} |
|
|
|
|
|
|
|
|
|
assert Enum.all?(created, fn {addr, _, _} -> |
|
|
|
|
response = |
|
|
|
|
conn |
|
|
|
|
|> get("/api/account/v1/tags/transaction/#{addr}") |
|
|
|
|
|> get("/api/account/v2/tags/transaction/#{addr}") |
|
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
|
response["personal_tx_tag"] == nil |
|
|
|
@ -463,7 +464,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
post_watchlist_address_response = |
|
|
|
|
conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/watchlist", |
|
|
|
|
"/api/account/v2/user/watchlist", |
|
|
|
|
watchlist_address_map |
|
|
|
|
) |
|
|
|
|
|> doc(description: "Add address to watch list") |
|
|
|
@ -474,7 +475,8 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
assert post_watchlist_address_response["notification_methods"] == watchlist_address_map["notification_methods"] |
|
|
|
|
assert post_watchlist_address_response["address_hash"] == watchlist_address_map["address_hash"] |
|
|
|
|
|
|
|
|
|
get_watchlist_address_response = conn |> get("/api/account/v1/user/watchlist") |> json_response(200) |> Enum.at(0) |
|
|
|
|
get_watchlist_address_response = |
|
|
|
|
conn |> get("/api/account/v2/user/watchlist") |> json_response(200) |> Map.get("items") |> Enum.at(0) |
|
|
|
|
|
|
|
|
|
assert get_watchlist_address_response["notification_settings"] == watchlist_address_map["notification_settings"] |
|
|
|
|
assert get_watchlist_address_response["name"] == watchlist_address_map["name"] |
|
|
|
@ -487,20 +489,21 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
post_watchlist_address_response_1 = |
|
|
|
|
conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/watchlist", |
|
|
|
|
"/api/account/v2/user/watchlist", |
|
|
|
|
watchlist_address_map_1 |
|
|
|
|
) |
|
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
|
get_watchlist_address_response_1_0 = |
|
|
|
|
conn |
|
|
|
|
|> get("/api/account/v1/user/watchlist") |
|
|
|
|
|> get("/api/account/v2/user/watchlist") |
|
|
|
|
|> doc(description: "Get addresses from watchlists") |
|
|
|
|
|> json_response(200) |
|
|
|
|
|> Map.get("items") |
|
|
|
|
|> Enum.at(1) |
|
|
|
|
|
|
|
|
|
get_watchlist_address_response_1_1 = |
|
|
|
|
conn |> get("/api/account/v1/user/watchlist") |> json_response(200) |> Enum.at(0) |
|
|
|
|
conn |> get("/api/account/v2/user/watchlist") |> json_response(200) |> Map.get("items") |> Enum.at(0) |
|
|
|
|
|
|
|
|
|
assert get_watchlist_address_response_1_0 == get_watchlist_address_response |
|
|
|
|
|
|
|
|
@ -531,11 +534,11 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> post("/api/account/v1/user/watchlist", build(:watchlist_address)) |
|
|
|
|
|> post("/api/account/v2/user/watchlist", build(:watchlist_address)) |
|
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> post("/api/account/v1/user/watchlist", build(:watchlist_address)) |
|
|
|
|
|> post("/api/account/v2/user/watchlist", build(:watchlist_address)) |
|
|
|
|
|> json_response(422) |
|
|
|
|
|
|
|
|
|
Application.put_env(:explorer, Explorer.Account, old_env) |
|
|
|
@ -566,7 +569,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
post_watchlist_address_response = |
|
|
|
|
conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/watchlist", |
|
|
|
|
"/api/account/v2/user/watchlist", |
|
|
|
|
watchlist_address_map |
|
|
|
|
) |
|
|
|
|
|> json_response(200) |
|
|
|
@ -576,7 +579,8 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
assert post_watchlist_address_response["notification_methods"] == watchlist_address_map["notification_methods"] |
|
|
|
|
assert post_watchlist_address_response["address_hash"] == watchlist_address_map["address_hash"] |
|
|
|
|
|
|
|
|
|
get_watchlist_address_response = conn |> get("/api/account/v1/user/watchlist") |> json_response(200) |> Enum.at(0) |
|
|
|
|
get_watchlist_address_response = |
|
|
|
|
conn |> get("/api/account/v2/user/watchlist") |> json_response(200) |> Map.get("items") |> Enum.at(0) |
|
|
|
|
|
|
|
|
|
assert get_watchlist_address_response["notification_settings"] == watchlist_address_map["notification_settings"] |
|
|
|
|
assert get_watchlist_address_response["name"] == watchlist_address_map["name"] |
|
|
|
@ -589,16 +593,16 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
post_watchlist_address_response_1 = |
|
|
|
|
conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/watchlist", |
|
|
|
|
"/api/account/v2/user/watchlist", |
|
|
|
|
watchlist_address_map_1 |
|
|
|
|
) |
|
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
|
get_watchlist_address_response_1_0 = |
|
|
|
|
conn |> get("/api/account/v1/user/watchlist") |> json_response(200) |> Enum.at(1) |
|
|
|
|
conn |> get("/api/account/v2/user/watchlist") |> json_response(200) |> Map.get("items") |> Enum.at(1) |
|
|
|
|
|
|
|
|
|
get_watchlist_address_response_1_1 = |
|
|
|
|
conn |> get("/api/account/v1/user/watchlist") |> json_response(200) |> Enum.at(0) |
|
|
|
|
conn |> get("/api/account/v2/user/watchlist") |> json_response(200) |> Map.get("items") |> Enum.at(0) |
|
|
|
|
|
|
|
|
|
assert get_watchlist_address_response_1_0 == get_watchlist_address_response |
|
|
|
|
|
|
|
|
@ -614,15 +618,15 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
assert get_watchlist_address_response_1_1["id"] == post_watchlist_address_response_1["id"] |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> delete("/api/account/v1/user/watchlist/#{get_watchlist_address_response_1_1["id"]}") |
|
|
|
|
|> delete("/api/account/v2/user/watchlist/#{get_watchlist_address_response_1_1["id"]}") |
|
|
|
|
|> doc(description: "Delete address from watchlist by id") |
|
|
|
|
|> json_response(200) == %{"message" => "OK"} |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> delete("/api/account/v1/user/watchlist/#{get_watchlist_address_response_1_0["id"]}") |
|
|
|
|
|> delete("/api/account/v2/user/watchlist/#{get_watchlist_address_response_1_0["id"]}") |
|
|
|
|
|> json_response(200) == %{"message" => "OK"} |
|
|
|
|
|
|
|
|
|
assert conn |> get("/api/account/v1/user/watchlist") |> json_response(200) == [] |
|
|
|
|
assert conn |> get("/api/account/v2/user/watchlist") |> json_response(200) |> Map.get("items") == [] |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
test "put watchlist address", %{conn: conn} do |
|
|
|
@ -631,7 +635,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
post_watchlist_address_response = |
|
|
|
|
conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/watchlist", |
|
|
|
|
"/api/account/v2/user/watchlist", |
|
|
|
|
watchlist_address_map |
|
|
|
|
) |
|
|
|
|
|> json_response(200) |
|
|
|
@ -641,7 +645,8 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
assert post_watchlist_address_response["notification_methods"] == watchlist_address_map["notification_methods"] |
|
|
|
|
assert post_watchlist_address_response["address_hash"] == watchlist_address_map["address_hash"] |
|
|
|
|
|
|
|
|
|
get_watchlist_address_response = conn |> get("/api/account/v1/user/watchlist") |> json_response(200) |> Enum.at(0) |
|
|
|
|
get_watchlist_address_response = |
|
|
|
|
conn |> get("/api/account/v2/user/watchlist") |> json_response(200) |> Map.get("items") |> Enum.at(0) |
|
|
|
|
|
|
|
|
|
assert get_watchlist_address_response["notification_settings"] == watchlist_address_map["notification_settings"] |
|
|
|
|
assert get_watchlist_address_response["name"] == watchlist_address_map["name"] |
|
|
|
@ -654,7 +659,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
put_watchlist_address_response = |
|
|
|
|
conn |
|
|
|
|
|> put( |
|
|
|
|
"/api/account/v1/user/watchlist/#{post_watchlist_address_response["id"]}", |
|
|
|
|
"/api/account/v2/user/watchlist/#{post_watchlist_address_response["id"]}", |
|
|
|
|
new_watchlist_address_map |
|
|
|
|
) |
|
|
|
|
|> doc(description: "Edit watchlist address") |
|
|
|
@ -675,7 +680,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
post_watchlist_address_response = |
|
|
|
|
conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/watchlist", |
|
|
|
|
"/api/account/v2/user/watchlist", |
|
|
|
|
watchlist_address_map |
|
|
|
|
) |
|
|
|
|
|> json_response(200) |
|
|
|
@ -687,7 +692,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/watchlist", |
|
|
|
|
"/api/account/v2/user/watchlist", |
|
|
|
|
watchlist_address_map |
|
|
|
|
) |
|
|
|
|
|> doc(description: "Example of error on creating watchlist address") |
|
|
|
@ -698,14 +703,14 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
post_watchlist_address_response_1 = |
|
|
|
|
conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/watchlist", |
|
|
|
|
"/api/account/v2/user/watchlist", |
|
|
|
|
new_watchlist_address_map |
|
|
|
|
) |
|
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> put( |
|
|
|
|
"/api/account/v1/user/watchlist/#{post_watchlist_address_response_1["id"]}", |
|
|
|
|
"/api/account/v2/user/watchlist/#{post_watchlist_address_response_1["id"]}", |
|
|
|
|
watchlist_address_map |
|
|
|
|
) |
|
|
|
|
|> doc(description: "Example of error on editing watchlist address") |
|
|
|
@ -717,7 +722,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
|
|
|
|
|
conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/watchlist", |
|
|
|
|
"/api/account/v2/user/watchlist", |
|
|
|
|
watchlist_address_map |
|
|
|
|
) |
|
|
|
|
|> json_response(200) |
|
|
|
@ -726,7 +731,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
|
|
|
|
|
conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/watchlist", |
|
|
|
|
"/api/account/v2/user/watchlist", |
|
|
|
|
watchlist_address_map_1 |
|
|
|
|
) |
|
|
|
|
|> json_response(200) |
|
|
|
@ -761,7 +766,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
|> Enum.sort(fn x1, x2 -> Decimal.compare(x1, x2) in [:gt, :eq] end) |
|
|
|
|
|> Enum.take(150) |
|
|
|
|
|
|
|
|
|
[wa2, wa1] = conn |> get("/api/account/v1/user/watchlist") |> json_response(200) |
|
|
|
|
[wa2, wa1] = conn |> get("/api/account/v2/user/watchlist") |> json_response(200) |> Map.get("items") |
|
|
|
|
|
|
|
|
|
assert wa1["tokens_fiat_value"] |> Decimal.new() |> Decimal.round(13) == |
|
|
|
|
values |> Enum.reduce(Decimal.new(0), fn x, acc -> Decimal.add(x, acc) end) |> Decimal.round(13) |
|
|
|
@ -781,7 +786,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
|
|
|
|
|
conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/watchlist", |
|
|
|
|
"/api/account/v2/user/watchlist", |
|
|
|
|
watchlist_address_map |
|
|
|
|
) |
|
|
|
|
|> json_response(200) |
|
|
|
@ -808,7 +813,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
token_contract_address_hash: token.contract_address_hash |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
[wa1] = conn |> get("/api/account/v1/user/watchlist") |> json_response(200) |
|
|
|
|
[wa1] = conn |> get("/api/account/v2/user/watchlist") |> json_response(200) |> Map.get("items") |
|
|
|
|
|
|
|
|
|
assert wa1["tokens_fiat_value"] |> Decimal.new() |> Decimal.round(13) == |
|
|
|
|
values |> Enum.reduce(Decimal.new(0), fn x, acc -> Decimal.add(x, acc) end) |> Decimal.round(13) |
|
|
|
@ -821,7 +826,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
post_api_key_response = |
|
|
|
|
conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/api_keys", |
|
|
|
|
"/api/account/v2/user/api_keys", |
|
|
|
|
%{"name" => "test"} |
|
|
|
|
) |
|
|
|
|
|> doc(description: "Add api key") |
|
|
|
@ -835,7 +840,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
Enum.each(0..2, fn _x -> |
|
|
|
|
conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/api_keys", |
|
|
|
|
"/api/account/v2/user/api_keys", |
|
|
|
|
%{"name" => "test"} |
|
|
|
|
) |
|
|
|
|
|> json_response(200) |
|
|
|
@ -843,14 +848,14 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/api_keys", |
|
|
|
|
"/api/account/v2/user/api_keys", |
|
|
|
|
%{"name" => "test"} |
|
|
|
|
) |
|
|
|
|
|> doc(description: "Example of error on creating api key") |
|
|
|
|
|> json_response(422) == %{"errors" => %{"name" => ["Max 3 keys per account"]}} |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> get("/api/account/v1/user/api_keys") |
|
|
|
|
|> get("/api/account/v2/user/api_keys") |
|
|
|
|
|> doc(description: "Get api keys list") |
|
|
|
|
|> json_response(200) |
|
|
|
|
|> Enum.count() == 3 |
|
|
|
@ -860,7 +865,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
post_api_key_response = |
|
|
|
|
conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/api_keys", |
|
|
|
|
"/api/account/v2/user/api_keys", |
|
|
|
|
%{"name" => "test"} |
|
|
|
|
) |
|
|
|
|
|> json_response(200) |
|
|
|
@ -871,7 +876,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
put_api_key_response = |
|
|
|
|
conn |
|
|
|
|
|> put( |
|
|
|
|
"/api/account/v1/user/api_keys/#{post_api_key_response["api_key"]}", |
|
|
|
|
"/api/account/v2/user/api_keys/#{post_api_key_response["api_key"]}", |
|
|
|
|
%{"name" => "test_1"} |
|
|
|
|
) |
|
|
|
|
|> doc(description: "Edit api key") |
|
|
|
@ -881,7 +886,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
assert put_api_key_response["name"] == "test_1" |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> get("/api/account/v1/user/api_keys") |
|
|
|
|
|> get("/api/account/v2/user/api_keys") |
|
|
|
|
|> json_response(200) == [put_api_key_response] |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -889,7 +894,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
post_api_key_response = |
|
|
|
|
conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/api_keys", |
|
|
|
|
"/api/account/v2/user/api_keys", |
|
|
|
|
%{"name" => "test"} |
|
|
|
|
) |
|
|
|
|
|> json_response(200) |
|
|
|
@ -898,17 +903,17 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
assert post_api_key_response["api_key"] |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> get("/api/account/v1/user/api_keys") |
|
|
|
|
|> get("/api/account/v2/user/api_keys") |
|
|
|
|
|> json_response(200) |
|
|
|
|
|> Enum.count() == 1 |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> delete("/api/account/v1/user/api_keys/#{post_api_key_response["api_key"]}") |
|
|
|
|
|> delete("/api/account/v2/user/api_keys/#{post_api_key_response["api_key"]}") |
|
|
|
|
|> doc(description: "Delete api key") |
|
|
|
|
|> json_response(200) == %{"message" => "OK"} |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> get("/api/account/v1/user/api_keys") |
|
|
|
|
|> get("/api/account/v2/user/api_keys") |
|
|
|
|
|> json_response(200) == [] |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -918,7 +923,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
post_custom_abi_response = |
|
|
|
|
conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/custom_abis", |
|
|
|
|
"/api/account/v2/user/custom_abis", |
|
|
|
|
custom_abi |
|
|
|
|
) |
|
|
|
|
|> doc(description: "Add custom abi") |
|
|
|
@ -934,7 +939,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
Enum.each(0..14, fn _x -> |
|
|
|
|
conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/custom_abis", |
|
|
|
|
"/api/account/v2/user/custom_abis", |
|
|
|
|
build(:custom_abi) |
|
|
|
|
) |
|
|
|
|
|> json_response(200) |
|
|
|
@ -942,14 +947,14 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/custom_abis", |
|
|
|
|
"/api/account/v2/user/custom_abis", |
|
|
|
|
build(:custom_abi) |
|
|
|
|
) |
|
|
|
|
|> doc(description: "Example of error on creating custom abi") |
|
|
|
|
|> json_response(422) == %{"errors" => %{"name" => ["Max 15 ABIs per account"]}} |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> get("/api/account/v1/user/custom_abis") |
|
|
|
|
|> get("/api/account/v2/user/custom_abis") |
|
|
|
|
|> doc(description: "Get custom abis list") |
|
|
|
|
|> json_response(200) |
|
|
|
|
|> Enum.count() == 15 |
|
|
|
@ -961,7 +966,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
post_custom_abi_response = |
|
|
|
|
conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/custom_abis", |
|
|
|
|
"/api/account/v2/user/custom_abis", |
|
|
|
|
custom_abi |
|
|
|
|
) |
|
|
|
|
|> json_response(200) |
|
|
|
@ -976,7 +981,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
put_custom_abi_response = |
|
|
|
|
conn |
|
|
|
|
|> put( |
|
|
|
|
"/api/account/v1/user/custom_abis/#{post_custom_abi_response["id"]}", |
|
|
|
|
"/api/account/v2/user/custom_abis/#{post_custom_abi_response["id"]}", |
|
|
|
|
custom_abi_1 |
|
|
|
|
) |
|
|
|
|
|> doc(description: "Edit custom abi") |
|
|
|
@ -988,7 +993,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
assert put_custom_abi_response["abi"] == custom_abi_1["abi"] |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> get("/api/account/v1/user/custom_abis") |
|
|
|
|
|> get("/api/account/v2/user/custom_abis") |
|
|
|
|
|> json_response(200) == [put_custom_abi_response] |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -998,7 +1003,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
post_custom_abi_response = |
|
|
|
|
conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/custom_abis", |
|
|
|
|
"/api/account/v2/user/custom_abis", |
|
|
|
|
custom_abi |
|
|
|
|
) |
|
|
|
|
|> json_response(200) |
|
|
|
@ -1007,17 +1012,17 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
assert post_custom_abi_response["id"] |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> get("/api/account/v1/user/custom_abis") |
|
|
|
|
|> get("/api/account/v2/user/custom_abis") |
|
|
|
|
|> json_response(200) |
|
|
|
|
|> Enum.count() == 1 |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> delete("/api/account/v1/user/custom_abis/#{post_custom_abi_response["id"]}") |
|
|
|
|
|> delete("/api/account/v2/user/custom_abis/#{post_custom_abi_response["id"]}") |
|
|
|
|
|> doc(description: "Delete custom abi") |
|
|
|
|
|> json_response(200) == %{"message" => "OK"} |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> get("/api/account/v1/user/custom_abis") |
|
|
|
|
|> get("/api/account/v2/user/custom_abis") |
|
|
|
|
|> json_response(200) == [] |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
@ -1029,7 +1034,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
post_public_tags_request_response = |
|
|
|
|
conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/public_tags", |
|
|
|
|
"/api/account/v2/user/public_tags", |
|
|
|
|
public_tags_request |
|
|
|
|
) |
|
|
|
|
|> doc(description: "Submit request to add a public tag") |
|
|
|
@ -1052,7 +1057,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
post_public_tags_request_response = |
|
|
|
|
conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/public_tags", |
|
|
|
|
"/api/account/v2/user/public_tags", |
|
|
|
|
public_tags_request |
|
|
|
|
) |
|
|
|
|
|> json_response(200) |
|
|
|
@ -1068,7 +1073,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
assert post_public_tags_request_response["id"] |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> get("/api/account/v1/user/public_tags") |
|
|
|
|
|> get("/api/account/v2/user/public_tags") |
|
|
|
|
|> json_response(200) |
|
|
|
|
|> Enum.map(&convert_date/1) == |
|
|
|
|
[post_public_tags_request_response] |
|
|
|
@ -1084,7 +1089,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
response = |
|
|
|
|
conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/public_tags", |
|
|
|
|
"/api/account/v2/user/public_tags", |
|
|
|
|
request |
|
|
|
|
) |
|
|
|
|
|> json_response(200) |
|
|
|
@ -1104,7 +1109,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
|> Enum.reverse() |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> get("/api/account/v1/user/public_tags") |
|
|
|
|
|> get("/api/account/v2/user/public_tags") |
|
|
|
|
|> doc(description: "Get list of requests to add a public tag") |
|
|
|
|
|> json_response(200) |
|
|
|
|
|> Enum.map(&convert_date/1) == final_list |
|
|
|
@ -1112,18 +1117,18 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
%{"id" => id} = Enum.at(final_list, 0) |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> delete("/api/account/v1/user/public_tags/#{id}", %{"remove_reason" => "reason"}) |
|
|
|
|
|> delete("/api/account/v2/user/public_tags/#{id}", %{"remove_reason" => "reason"}) |
|
|
|
|
|> doc(description: "Delete public tags request") |
|
|
|
|
|> json_response(200) == %{"message" => "OK"} |
|
|
|
|
|
|
|
|
|
Enum.each(Enum.drop(final_list, 1), fn request -> |
|
|
|
|
assert conn |
|
|
|
|
|> delete("/api/account/v1/user/public_tags/#{request["id"]}", %{"remove_reason" => "reason"}) |
|
|
|
|
|> delete("/api/account/v2/user/public_tags/#{request["id"]}", %{"remove_reason" => "reason"}) |
|
|
|
|
|> json_response(200) == %{"message" => "OK"} |
|
|
|
|
end) |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> get("/api/account/v1/user/public_tags") |
|
|
|
|
|> get("/api/account/v2/user/public_tags") |
|
|
|
|
|> json_response(200) == [] |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -1133,7 +1138,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
post_public_tags_request_response = |
|
|
|
|
conn |
|
|
|
|
|> post( |
|
|
|
|
"/api/account/v1/user/public_tags", |
|
|
|
|
"/api/account/v2/user/public_tags", |
|
|
|
|
public_tags_request |
|
|
|
|
) |
|
|
|
|
|> json_response(200) |
|
|
|
@ -1149,7 +1154,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
assert post_public_tags_request_response["id"] |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> get("/api/account/v1/user/public_tags") |
|
|
|
|
|> get("/api/account/v2/user/public_tags") |
|
|
|
|
|> json_response(200) |
|
|
|
|
|> Enum.map(&convert_date/1) == |
|
|
|
|
[post_public_tags_request_response] |
|
|
|
@ -1160,7 +1165,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
put_public_tags_request_response = |
|
|
|
|
conn |
|
|
|
|
|> put( |
|
|
|
|
"/api/account/v1/user/public_tags/#{post_public_tags_request_response["id"]}", |
|
|
|
|
"/api/account/v2/user/public_tags/#{post_public_tags_request_response["id"]}", |
|
|
|
|
new_public_tags_request |
|
|
|
|
) |
|
|
|
|
|> doc(description: "Edit request to add a public tag") |
|
|
|
@ -1177,7 +1182,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |
|
|
|
|
assert put_public_tags_request_response["id"] == post_public_tags_request_response["id"] |
|
|
|
|
|
|
|
|
|
assert conn |
|
|
|
|
|> get("/api/account/v1/user/public_tags") |
|
|
|
|
|> get("/api/account/v2/user/public_tags") |
|
|
|
|
|> json_response(200) |
|
|
|
|
|> Enum.map(&convert_date/1) == |
|
|
|
|
[put_public_tags_request_response] |