Merge branch '14770-wb-acr-bad-param'
[arvados.git] / services / api / test / integration / keep_proxy_test.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 require 'test_helper'
6
7 class KeepProxyTest < ActionDispatch::IntegrationTest
8   test "request keep disks" do
9     get "/arvados/v1/keep_services/accessible", {:format => :json}, auth(:active)
10     assert_response :success
11     services = json_response['items']
12
13     assert_operator 2, :<=, services.length
14     services.each do |service|
15       assert_equal 'disk', service['service_type']
16     end
17   end
18
19   test "request keep proxy" do
20     get "/arvados/v1/keep_services/accessible", {:format => :json}, auth(:active).merge({'HTTP_X_EXTERNAL_CLIENT' => '1'})
21     assert_response :success
22     services = json_response['items']
23
24     assert_equal 1, services.length
25
26     assert_equal keep_services(:proxy).uuid, services[0]['uuid']
27     assert_equal keep_services(:proxy).service_host, services[0]['service_host']
28     assert_equal keep_services(:proxy).service_port, services[0]['service_port']
29     assert_equal keep_services(:proxy).service_ssl_flag, services[0]['service_ssl_flag']
30     assert_equal 'proxy', services[0]['service_type']
31   end
32 end