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