X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/6ba24a89c7b2fa6f600910dc28af218500a463dd..b6487d6773406f0da6724e24ad5ce6a94e1009cd:/services/api/test/functional/arvados/v1/collections_controller_test.rb diff --git a/services/api/test/functional/arvados/v1/collections_controller_test.rb b/services/api/test/functional/arvados/v1/collections_controller_test.rb index 2996f1b792..9c7f4886af 100644 --- a/services/api/test/functional/arvados/v1/collections_controller_test.rb +++ b/services/api/test/functional/arvados/v1/collections_controller_test.rb @@ -21,7 +21,9 @@ class Arvados::V1::CollectionsControllerTest < ActionController::TestCase authorize_with :active get :index assert_response :success - assert_not_nil assigns(:objects) + assert(assigns(:objects).andand.any?, "no Collections returned in index") + refute(json_response["items"].any? { |c| c.has_key?("manifest_text") }, + "basic Collections index included manifest_text") end test "can get non-database fields via index select" do @@ -47,6 +49,26 @@ class Arvados::V1::CollectionsControllerTest < ActionController::TestCase end end + test "index with manifest_text selected returns signed locators" do + columns = %w(uuid owner_uuid data_size files manifest_text) + authorize_with :active + get :index, select: columns + assert_response :success + assert(assigns(:objects).andand.any?, + "no Collections returned for index with columns selected") + json_response["items"].each do |coll| + assert_equal(columns, columns & coll.keys, + "Collections index did not respect selected columns") + loc_regexp = / [[:xdigit:]]{32}\+\d+\S+/ + pos = 0 + while match = loc_regexp.match(coll["manifest_text"], pos) + assert_match(/\+A[[:xdigit:]]+@[[:xdigit:]]{8}\b/, match.to_s, + "Locator in manifest_text was not signed") + pos = match.end(0) + end + end + end + [0,1,2].each do |limit| test "get index with limit=#{limit}" do authorize_with :active