X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/7c098f97052780882fe4c08f48f83b47a1973d36..44c95f99098fa6c6acbfa82d4b6cbc6015eb6e39:/services/api/test/integration/select_test.rb diff --git a/services/api/test/integration/select_test.rb b/services/api/test/integration/select_test.rb index 20575654e6..fb3f4f617a 100644 --- a/services/api/test/integration/select_test.rb +++ b/services/api/test/integration/select_test.rb @@ -1,3 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + require 'test_helper' class SelectTest < ActionDispatch::IntegrationTest @@ -5,7 +9,7 @@ class SelectTest < ActionDispatch::IntegrationTest get "/arvados/v1/links", {:format => :json, :select => ['uuid', 'link_class']}, auth(:active) assert_response :success assert_equal json_response['items'].count, json_response['items'].select { |i| - i.count == 2 and i['uuid'] != nil and i['link_class'] != nil + i.count == 3 and i['uuid'] != nil and i['link_class'] != nil }.count end @@ -18,7 +22,8 @@ class SelectTest < ActionDispatch::IntegrationTest assert_response :success distinct = json_response['items'] - assert distinct.count < links.count, "distinct count should be less than link count" + assert_operator(distinct.count, :<, links.count, + "distinct count should be less than link count") assert_equal links.uniq.count, distinct.count end @@ -35,6 +40,13 @@ class SelectTest < ActionDispatch::IntegrationTest end end + test "select with default order" do + get "/arvados/v1/links", {format: :json, select: ['uuid']}, auth(:admin) + assert_response :success + uuids = json_response['items'].collect { |i| i['uuid'] } + assert_equal uuids, uuids.sort + end + def assert_link_classes_ascend(current_class, prev_class) # Databases and Ruby don't always agree about string ordering with # punctuation. If the strings aren't ascending normally, check