17810: Fix S3 signature verification.
[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",
10       params: {:format => :json},
11       headers: auth(:active)
12     assert_response :success
13     services = json_response['items']
14
15     assert_operator 2, :<=, services.length
16     services.each do |service|
17       assert_equal 'disk', service['service_type']
18     end
19   end
20
21   test "request keep proxy" do
22     get "/arvados/v1/keep_services/accessible",
23       params: {:format => :json},
24       headers: auth(:active).merge({'HTTP_X_EXTERNAL_CLIENT' => '1'})
25     assert_response :success
26     services = json_response['items']
27
28     assert_equal 1, services.length
29
30     assert_equal keep_services(:proxy).uuid, services[0]['uuid']
31     assert_equal keep_services(:proxy).service_host, services[0]['service_host']
32     assert_equal keep_services(:proxy).service_port, services[0]['service_port']
33     assert_equal keep_services(:proxy).service_ssl_flag, services[0]['service_ssl_flag']
34     assert_equal 'proxy', services[0]['service_type']
35   end
36 end