Merge remote-tracking branch 'origin/master' into 14645-fuse-operations-reporting
[arvados.git] / services / api / test / integration / serialized_encoding_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 require 'helpers/git_test_helper'
7
8 class SerializedEncodingTest < ActionDispatch::IntegrationTest
9   include GitTestHelper
10
11   fixtures :all
12
13   {
14     api_client_authorization: {scopes: []},
15
16     human: {properties: {eye_color: 'gray'}},
17
18     job: {
19       repository: 'active/foo',
20       runtime_constraints: {docker_image: 'arvados/apitestfixture'},
21       script: 'hash',
22       script_version: 'master',
23       script_parameters: {pattern: 'foobar'},
24       tasks_summary: {todo: 0},
25     },
26
27     job_task: {parameters: {pattern: 'foo'}},
28
29     link: {link_class: 'test', name: 'test', properties: {foo: :bar}},
30
31     node: {info: {uptime: 1234}},
32
33     pipeline_instance: {
34       components: {"job1" => {parameters: {pattern: "xyzzy"}}},
35       components_summary: {todo: 0},
36       properties: {test: true},
37     },
38
39     pipeline_template: {
40       components: {"job1" => {parameters: {pattern: "xyzzy"}}},
41     },
42
43     specimen: {properties: {eye_color: 'meringue'}},
44
45     trait: {properties: {eye_color: 'brown'}},
46
47     user: {prefs: {cookies: 'thin mint'}},
48   }.each_pair do |resource, postdata|
49     test "create json-encoded #{resource.to_s}" do
50       post("/arvados/v1/#{resource.to_s.pluralize}",
51            {resource => postdata.to_json}, auth(:admin_trustedclient))
52       assert_response :success
53     end
54   end
55 end