1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
7 class ApiClientTest < ActiveSupport::TestCase
8 include CurrentApiClient
10 test "configured workbench is trusted" do
11 Rails.configuration.Services.Workbench1.ExternalURL = URI("http://wb1.example.com")
12 Rails.configuration.Services.Workbench2.ExternalURL = URI("https://wb2.example.com:443")
15 [["http://wb0.example.com", false],
16 ["http://wb1.example.com", true],
17 ["http://wb2.example.com", false],
18 ["https://wb2.example.com", true],
19 ["https://wb2.example.com/", true],
20 ].each do |pfx, result|
21 a = ApiClient.create(url_prefix: pfx, is_trusted: false)
22 assert_equal result, a.is_trusted
25 a = ApiClient.create(url_prefix: "http://example.com", is_trusted: true)