X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/675794872a5d064cf0a8177d662555c04b0dae51..035b113f60302f6d9c265e6e3a63dbb3c5873153:/apps/workbench/test/unit/collection_test.rb diff --git a/apps/workbench/test/unit/collection_test.rb b/apps/workbench/test/unit/collection_test.rb index 512ad47c34..870f8baade 100644 --- a/apps/workbench/test/unit/collection_test.rb +++ b/apps/workbench/test/unit/collection_test.rb @@ -1,3 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + require 'test_helper' class CollectionTest < ActiveSupport::TestCase @@ -40,4 +44,35 @@ class CollectionTest < ActiveSupport::TestCase get_files_tree('multilevel_collection_2'), "Collection file tree was malformed") end + + test "portable_data_hash never editable" do + refute(Collection.new.attribute_editable?("portable_data_hash", :ever)) + end + + test "admin can edit name" do + use_token :admin + assert(find_fixture(Collection, "foo_file").attribute_editable?("name"), + "admin not allowed to edit collection name") + end + + test "project owner can edit name" do + use_token :active + assert(find_fixture(Collection, "foo_collection_in_aproject") + .attribute_editable?("name"), + "project owner not allowed to edit collection name") + end + + test "project admin can edit name" do + use_token :subproject_admin + assert(find_fixture(Collection, "baz_file_in_asubproject") + .attribute_editable?("name"), + "project admin not allowed to edit collection name") + end + + test "project viewer cannot edit name" do + use_token :project_viewer + refute(find_fixture(Collection, "foo_collection_in_aproject") + .attribute_editable?("name"), + "project viewer allowed to edit collection name") + end end