8784: Fix test for latest firefox.
[arvados.git] / services / api / test / integration / noop_deep_munge_test.rb
1 require 'test_helper'
2
3 class NoopDeepMungeTest < ActionDispatch::IntegrationTest
4   test "empty array" do
5     check({"foo" => []})
6   end
7
8   test "null in array" do
9     check({"foo" => ["foo", nil]})
10   end
11
12   test "array of nulls" do
13     check({"foo" => [nil, nil, nil]})
14   end
15
16   protected
17
18   def check(val)
19     post "/arvados/v1/container_requests",
20          {
21            :container_request => {
22              :name => "workflow",
23              :state => "Uncommitted",
24              :command => ["echo"],
25              :container_image => "arvados/jobs",
26              :output_path => "/",
27              :mounts => {
28                :foo => {
29                  :kind => "json",
30                  :content => JSON.parse(SafeJSON.dump(val)),
31                }
32              }
33            }
34          }.to_json, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:admin).api_token}",
35                     'CONTENT_TYPE' => 'application/json'}
36     assert_response :success
37     assert_equal "arvados#containerRequest", json_response['kind']
38     assert_equal val, json_response['mounts']['foo']['content']
39   end
40 end