From 78444f2fb480801787e486d4b65198d72ab4fe15 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Fri, 14 Aug 2020 12:07:56 -0400 Subject: [PATCH] 16683: Add test, remove useless check for PDH pattern Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- services/api/app/models/arvados_model.rb | 2 -- services/api/test/unit/link_test.rb | 8 ++++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/services/api/app/models/arvados_model.rb b/services/api/app/models/arvados_model.rb index 18a5c9f245..67794208de 100644 --- a/services/api/app/models/arvados_model.rb +++ b/services/api/app/models/arvados_model.rb @@ -758,8 +758,6 @@ class ArvadosModel < ApplicationRecord if r.where(uuid: attr_value).count == 0 errors.add(attr, "'#{attr_value}' not found") end - elsif attr_value =~ Keep::Locator::LOCATOR_REGEXP - true else # Not a valid uuid or PDH, but that (currently) is not an error. end diff --git a/services/api/test/unit/link_test.rb b/services/api/test/unit/link_test.rb index 00f3cc2913..c7d21bdc4d 100644 --- a/services/api/test/unit/link_test.rb +++ b/services/api/test/unit/link_test.rb @@ -58,6 +58,14 @@ class LinkTest < ActiveSupport::TestCase users(:active).uuid.sub(/-\w+$/, "-#{'z' * 15}")) end + test "link granting permission to remote user is valid" do + refute new_active_link_valid?(tail_uuid: + users(:active).uuid.sub(/^\w+-/, "foooo-")) + Rails.configuration.RemoteClusters = Rails.configuration.RemoteClusters.merge({foooo: ActiveSupport::InheritableOptions.new({Host: "bar.com"})}) + assert new_active_link_valid?(tail_uuid: + users(:active).uuid.sub(/^\w+-/, "foooo-")) + end + test "link granting non-project permission to unreadable user is invalid" do refute new_active_link_valid?(tail_uuid: users(:admin).uuid, head_uuid: collections(:bar_file).uuid) -- 2.30.2