Merge branch 'use_mktemp' of https://github.com/golharam/arvados into golharam-use_mktemp
[arvados.git] / services / api / test / integration / select_test.rb
index 982e172e186f3c9be84f2dddde653018377c6219..7fbab3b3b00e484a5653435452f7d620178af251 100644 (file)
@@ -1,8 +1,14 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
 require 'test_helper'
 
 class SelectTest < ActionDispatch::IntegrationTest
   test "should select just two columns" do
-    get "/arvados/v1/links", {:format => :json, :select => ['uuid', 'link_class']}, auth(:active)
+    get "/arvados/v1/links",
+      params: {:format => :json, :select => ['uuid', 'link_class']},
+      headers: auth(:active)
     assert_response :success
     assert_equal json_response['items'].count, json_response['items'].select { |i|
       i.count == 3 and i['uuid'] != nil and i['link_class'] != nil
@@ -10,11 +16,15 @@ class SelectTest < ActionDispatch::IntegrationTest
   end
 
   test "fewer distinct than total count" do
-    get "/arvados/v1/links", {:format => :json, :select => ['link_class'], :distinct => false}, auth(:active)
+    get "/arvados/v1/links",
+      params: {:format => :json, :select => ['link_class'], :distinct => false},
+      headers: auth(:active)
     assert_response :success
     links = json_response['items']
 
-    get "/arvados/v1/links", {:format => :json, :select => ['link_class'], :distinct => true}, auth(:active)
+    get "/arvados/v1/links",
+      params: {:format => :json, :select => ['link_class'], :distinct => true},
+      headers: auth(:active)
     assert_response :success
     distinct = json_response['items']
 
@@ -24,7 +34,9 @@ class SelectTest < ActionDispatch::IntegrationTest
   end
 
   test "select with order" do
-    get "/arvados/v1/links", {:format => :json, :select => ['uuid'], :order => ["uuid asc"]}, auth(:active)
+    get "/arvados/v1/links",
+      params: {:format => :json, :select => ['uuid'], :order => ["uuid asc"]},
+      headers: auth(:active)
     assert_response :success
 
     assert json_response['items'].length > 0
@@ -37,7 +49,9 @@ class SelectTest < ActionDispatch::IntegrationTest
   end
 
   test "select with default order" do
-    get "/arvados/v1/links", {format: :json, select: ['uuid']}, auth(:admin)
+    get "/arvados/v1/links",
+      params: {format: :json, select: ['uuid']},
+      headers: auth(:admin)
     assert_response :success
     uuids = json_response['items'].collect { |i| i['uuid'] }
     assert_equal uuids, uuids.sort
@@ -54,7 +68,12 @@ class SelectTest < ActionDispatch::IntegrationTest
   end
 
   test "select two columns with order" do
-    get "/arvados/v1/links", {:format => :json, :select => ['link_class', 'uuid'], :order => ['link_class asc', "uuid desc"]}, auth(:active)
+    get "/arvados/v1/links",
+      params: {
+        :format => :json,
+        :select => ['link_class', 'uuid'], :order => ['link_class asc', "uuid desc"]
+      },
+      headers: auth(:active)
     assert_response :success
 
     assert json_response['items'].length > 0
@@ -76,7 +95,12 @@ class SelectTest < ActionDispatch::IntegrationTest
   end
 
   test "select two columns with old-style order syntax" do
-    get "/arvados/v1/links", {:format => :json, :select => ['link_class', 'uuid'], :order => 'link_class asc, uuid desc'}, auth(:active)
+    get "/arvados/v1/links",
+      params: {
+        :format => :json,
+        :select => ['link_class', 'uuid'], :order => 'link_class asc, uuid desc'
+      },
+      headers: auth(:active)
     assert_response :success
 
     assert json_response['items'].length > 0