From b266485293051f83dc20cb2933789f733e130195 Mon Sep 17 00:00:00 2001 From: Miles Zhang Date: Thu, 31 Aug 2023 10:57:54 +0800 Subject: [PATCH] feat: hide udt info update (#1423) Signed-off-by: Miles Zhang --- config/routes.rb | 2 +- .../api/v1/udts_controller_test.rb | 134 +++++++++--------- 2 files changed, 68 insertions(+), 68 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 6433ef049..3e3e17fd6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 diff --git a/test/controllers/api/v1/udts_controller_test.rb b/test/controllers/api/v1/udts_controller_test.rb index b6a762a65..052bfc56a 100644 --- a/test/controllers/api/v1/udts_controller_test.rb +++ b/test/controllers/api/v1/udts_controller_test.rb @@ -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