X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/231a86fd3f7e30e9f66d71d92ad7c26578637e37..22e5442051df04f9e0d74b21bd36e44a6464e945:/services/api/test/unit/collection_test.rb diff --git a/services/api/test/unit/collection_test.rb b/services/api/test/unit/collection_test.rb index 2dd6eedcfb..bf1ba517eb 100644 --- a/services/api/test/unit/collection_test.rb +++ b/services/api/test/unit/collection_test.rb @@ -1090,4 +1090,25 @@ class CollectionTest < ActiveSupport::TestCase end end end + + test "collection names must be displayable in a filesystem" do + set_user_from_auth :active + ["", "{SOLIDUS}"].each do |subst| + Rails.configuration.Collections.ForwardSlashNameSubstitution = subst + c = Collection.create + [[nil, true], + ["", true], + [".", false], + ["..", false], + ["...", true], + ["..z..", true], + ["foo/bar", subst != ""], + ["../..", subst != ""], + ["/", subst != ""], + ].each do |name, valid| + c.name = name + assert_equal valid, c.valid?, "#{name.inspect} should be #{valid ? "valid" : "invalid"}" + end + end + end end