X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/45648db225a107b6475c04c105f5db3c58570811..d4cc835615a729c33460c6bb2ad8976808674a5c:/apps/workbench/test/functional/collections_controller_test.rb diff --git a/apps/workbench/test/functional/collections_controller_test.rb b/apps/workbench/test/functional/collections_controller_test.rb index 852772ae83..4745d1b9ac 100644 --- a/apps/workbench/test/functional/collections_controller_test.rb +++ b/apps/workbench/test/functional/collections_controller_test.rb @@ -1,6 +1,8 @@ require 'test_helper' class CollectionsControllerTest < ActionController::TestCase + NONEXISTENT_COLLECTION = "ffffffffffffffffffffffffffffffff+0" + def collection_params(collection_name, file_name=nil) uuid = api_fixture('collections')[collection_name.to_s]['uuid'] params = {uuid: uuid, id: uuid} @@ -53,11 +55,11 @@ class CollectionsControllerTest < ActionController::TestCase assert_equal([['.', 'foo', 3]], assigns(:object).files) end - test "viewing a collection fetches related folders" do + test "viewing a collection fetches related projects" do show_collection(:foo_file, :active) - assert_includes(assigns(:folders).map(&:uuid), - api_fixture('groups')['afolder']['uuid'], - "controller did not find linked folder") + assert_includes(assigns(:projects).map(&:uuid), + api_fixture('groups')['aproject']['uuid'], + "controller did not find linked project") end test "viewing a collection fetches related permissions" do @@ -98,6 +100,14 @@ class CollectionsControllerTest < ActionController::TestCase assert_no_session end + test "reader token Collection links end with trailing slash" do + # Testing the fix for #2937. + show_collection(:foo_file, :active_trustedclient) + post(:share, collection_params(:foo_file)) + assert(@controller.download_link.ends_with? '/', + "Collection share link does not end with slash for wget") + end + test "getting a file from Keep" do params = collection_params(:foo_file, 'foo') sess = session_for(:active) @@ -165,4 +175,9 @@ class CollectionsControllerTest < ActionController::TestCase "when showing the user agreement.") assert_response :success end + + test "requesting nonexistent Collection returns 404" do + show_collection({uuid: NONEXISTENT_COLLECTION, id: NONEXISTENT_COLLECTION}, + :active, 404) + end end