Skip to content

Commit

Permalink
Merge pull request #1424 from nervosnetwork/develop
Browse files Browse the repository at this point in the history
Deploy to testnet
  • Loading branch information
zmcNotafraid committed Aug 31, 2023
2 parents ca0a630 + b266485 commit bb754f7
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 68 deletions.
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
resources :block_statistics, only: :show ## TODO: unused route
resources :epoch_statistics, only: :show
resources :market_data, only: :show
resources :udts, only: %i(index show update) do
resources :udts, only: %i(index show) do
collection do
get :download_csv
end
Expand Down
134 changes: 67 additions & 67 deletions test/controllers/api/v1/udts_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -415,73 +415,73 @@ class UdtsControllerTest < ActionDispatch::IntegrationTest
assert_response :success
end

test "should update udt info suceessfully" do
udt = create(:udt, published: true)

valid_put api_v1_udt_url(udt.type_hash), params: {
symbol: "GWK",
full_name: "GodwokenToken on testnet_v1",
decimal: "8",
total_amount: "100000000000",
description: "The sUDT_ERC20_Proxy of Godwoken Test Token.",
operator_website: "https://udt.coin",
icon_file: "https://img.udt.img",
uan: "GWK.gw|gb.ckb",
display_name: "GodwokenToken (via Godwoken Bridge from CKB)",
contact_info: "contact@usdt.com"
}

assert_response :success
udt.reload
assert_equal udt.symbol, "GWK"
assert_equal udt.full_name, "GodwokenToken on testnet_v1"
assert_equal udt.decimal, 8
assert_equal udt.total_amount, 100000000000
assert_equal udt.description, "The sUDT_ERC20_Proxy of Godwoken Test Token."
assert_equal udt.operator_website, "https://udt.coin"
assert_equal udt.icon_file, "https://img.udt.img"
assert_equal udt.uan, "GWK.gw|gb.ckb"
assert_equal udt.display_name, "GodwokenToken (via Godwoken Bridge from CKB)"
assert_equal udt.contact_info, "contact@usdt.com"

end

test "raise parameters error when update udt" do
udt = create(:udt, published: true)

valid_put api_v1_udt_url(udt.type_hash), params: {
symbol: "GWK",
full_name: "GodwokenToken on testnet_v1",
decimal: "8",
description: "The sUDT_ERC20_Proxy of Godwoken Test Token.",
operator_website: "https://udt.coin",
icon_file: "https://img.udt.img",
uan: "GWK.gw|gb.ckb",
display_name: "GodwokenToken (via Godwoken Bridge from CKB)"
}

assert_equal 400, response.status
assert_equal response.body, "[{\"title\":\"UDT info parameters invalid\",\"detail\":\"Validation failed: Total amount can't be blank, Total amount is not a number\",\"code\":1030,\"status\":400}]"
end

test "raise not found error when update udt" do
udt = create(:udt, published: true)

valid_put api_v1_udt_url("#{udt.type_hash}0"), params: {
symbol: "GWK",
full_name: "GodwokenToken on testnet_v1",
decimal: "8",
total_amount: "100000000",
description: "The sUDT_ERC20_Proxy of Godwoken Test Token.",
operator_website: "https://udt.coin",
icon_file: "https://img.udt.img",
uan: "GWK.gw|gb.ckb",
display_name: "GodwokenToken (via Godwoken Bridge from CKB)"
}

assert_equal 404, response.status
assert_equal response.body, "[{\"title\":\"UDT Not Found\",\"detail\":\"No UDT records found by given type hash\",\"code\":1026,\"status\":404}]"
end
# test "should update udt info suceessfully" do
# udt = create(:udt, published: true)

# valid_put api_v1_udt_url(udt.type_hash), params: {
# symbol: "GWK",
# full_name: "GodwokenToken on testnet_v1",
# decimal: "8",
# total_amount: "100000000000",
# description: "The sUDT_ERC20_Proxy of Godwoken Test Token.",
# operator_website: "https://udt.coin",
# icon_file: "https://img.udt.img",
# uan: "GWK.gw|gb.ckb",
# display_name: "GodwokenToken (via Godwoken Bridge from CKB)",
# contact_info: "contact@usdt.com"
# }

# assert_response :success
# udt.reload
# assert_equal udt.symbol, "GWK"
# assert_equal udt.full_name, "GodwokenToken on testnet_v1"
# assert_equal udt.decimal, 8
# assert_equal udt.total_amount, 100000000000
# assert_equal udt.description, "The sUDT_ERC20_Proxy of Godwoken Test Token."
# assert_equal udt.operator_website, "https://udt.coin"
# assert_equal udt.icon_file, "https://img.udt.img"
# assert_equal udt.uan, "GWK.gw|gb.ckb"
# assert_equal udt.display_name, "GodwokenToken (via Godwoken Bridge from CKB)"
# assert_equal udt.contact_info, "contact@usdt.com"

# end

# test "raise parameters error when update udt" do
# udt = create(:udt, published: true)

# valid_put api_v1_udt_url(udt.type_hash), params: {
# symbol: "GWK",
# full_name: "GodwokenToken on testnet_v1",
# decimal: "8",
# description: "The sUDT_ERC20_Proxy of Godwoken Test Token.",
# operator_website: "https://udt.coin",
# icon_file: "https://img.udt.img",
# uan: "GWK.gw|gb.ckb",
# display_name: "GodwokenToken (via Godwoken Bridge from CKB)"
# }

# assert_equal 400, response.status
# assert_equal response.body, "[{\"title\":\"UDT info parameters invalid\",\"detail\":\"Validation failed: Total amount can't be blank, Total amount is not a number\",\"code\":1030,\"status\":400}]"
# end

# test "raise not found error when update udt" do
# udt = create(:udt, published: true)

# valid_put api_v1_udt_url("#{udt.type_hash}0"), params: {
# symbol: "GWK",
# full_name: "GodwokenToken on testnet_v1",
# decimal: "8",
# total_amount: "100000000",
# description: "The sUDT_ERC20_Proxy of Godwoken Test Token.",
# operator_website: "https://udt.coin",
# icon_file: "https://img.udt.img",
# uan: "GWK.gw|gb.ckb",
# display_name: "GodwokenToken (via Godwoken Bridge from CKB)"
# }

# assert_equal 404, response.status
# assert_equal response.body, "[{\"title\":\"UDT Not Found\",\"detail\":\"No UDT records found by given type hash\",\"code\":1026,\"status\":404}]"
# end
end
end
end

0 comments on commit bb754f7

Please sign in to comment.