Merge branch '21383-misc-fixes'. Refs #21383
[arvados.git] / services / api / test / integration / container_request_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 ContainerRequestIntegrationTest < ActionDispatch::IntegrationTest
8
9   test "test colon in input" do
10     # Tests for bug #15311 where strings with leading colons get
11     # corrupted when the leading ":" is stripped.
12     val = {"itemSeparator" => ":"}
13     post "/arvados/v1/container_requests",
14       params: {
15         :container_request => {
16           :name => "workflow",
17           :state => "Committed",
18           :command => ["echo"],
19           :container_image => "fa3c1a9cb6783f85f2ecda037e07b8c3+167",
20           :output_path => "/",
21           :priority => 1,
22           :runtime_constraints => {"vcpus" => 1, "ram" => 1},
23           :mounts => {
24             :foo => {
25               :kind => "json",
26               :content => JSON.parse(SafeJSON.dump(val)),
27             }
28           }
29         }
30       }.to_json,
31       headers: {
32         'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:active).api_token}",
33         'CONTENT_TYPE' => 'application/json'
34       }
35     assert_response :success
36     assert_equal "arvados#containerRequest", json_response['kind']
37     assert_equal val, json_response['mounts']['foo']['content']
38   end
39 end