X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/0f644e242ef37c911ad3dc25aca8135c339de349..d97c9ecca25f449ad928963f6257a01a8bbbf1e7:/services/api/test/unit/api_client_test.rb diff --git a/services/api/test/unit/api_client_test.rb b/services/api/test/unit/api_client_test.rb index fc7d1ee2f4..df082c27fd 100644 --- a/services/api/test/unit/api_client_test.rb +++ b/services/api/test/unit/api_client_test.rb @@ -5,7 +5,27 @@ require 'test_helper' class ApiClientTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end + include CurrentApiClient + + test "configured workbench is trusted" do + Rails.configuration.Services.Workbench1.ExternalURL = URI("http://wb1.example.com") + Rails.configuration.Services.Workbench2.ExternalURL = URI("https://wb2.example.com:443") + + act_as_system_user do + [["http://wb0.example.com", false], + ["http://wb1.example.com", true], + ["http://wb2.example.com", false], + ["https://wb2.example.com", true], + ["https://wb2.example.com/", true], + ].each do |pfx, result| + a = ApiClient.create(url_prefix: pfx, is_trusted: false) + assert_equal result, a.is_trusted + end + + a = ApiClient.create(url_prefix: "http://example.com", is_trusted: true) + a.save! + a.reload + assert a.is_trusted + end + end end