X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/0df5f0feeced5bff0adfb806dae2d3811257827f..37044d922164855ba5cc443e775037ab12cdbf95:/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 7fbab3b3b0..0548a767ba 100644 --- a/services/api/test/integration/select_test.rb +++ b/services/api/test/integration/select_test.rb @@ -16,11 +16,17 @@ class SelectTest < ActionDispatch::IntegrationTest end test "fewer distinct than total count" do + get "/arvados/v1/links", + params: {:format => :json, :select => ['link_class']}, + headers: auth(:active) + assert_response :success + distinct_unspecified = json_response['items'] + get "/arvados/v1/links", params: {:format => :json, :select => ['link_class'], :distinct => false}, headers: auth(:active) assert_response :success - links = json_response['items'] + distinct_false = json_response['items'] get "/arvados/v1/links", params: {:format => :json, :select => ['link_class'], :distinct => true}, @@ -28,9 +34,11 @@ class SelectTest < ActionDispatch::IntegrationTest assert_response :success distinct = json_response['items'] - assert_operator(distinct.count, :<, links.count, - "distinct count should be less than link count") - assert_equal links.uniq.count, distinct.count + assert_operator(distinct.count, :<, distinct_false.count, + "distinct=true count should be less than distinct=false count") + assert_equal(distinct_unspecified.count, distinct_false.count, + "distinct=false should be the default") + assert_equal distinct_false.uniq.count, distinct.count end test "select with order" do @@ -54,7 +62,7 @@ class SelectTest < ActionDispatch::IntegrationTest headers: auth(:admin) assert_response :success uuids = json_response['items'].collect { |i| i['uuid'] } - assert_equal uuids, uuids.sort + assert_equal uuids, uuids.sort.reverse end def assert_link_classes_ascend(current_class, prev_class)