Merge branch '3627-selectable-projects' closes #3627
[arvados.git] / services / api / test / unit / link_test.rb
index 640b26c64d29fcf5a101e279045be0371225108a..028f403a286e2b27dbb456f69b703ebc6387110b 100644 (file)
@@ -7,48 +7,6 @@ class LinkTest < ActiveSupport::TestCase
     set_user_from_auth :admin_trustedclient
   end
 
-  test 'name links with the same tail_uuid must be unique' do
-    a = Link.create!(tail_uuid: groups(:aproject).uuid,
-                     head_uuid: specimens(:owned_by_active_user).uuid,
-                     link_class: 'name',
-                     name: 'foo')
-    assert a.valid?, a.errors.to_s
-    assert_equal groups(:aproject).uuid, a.owner_uuid
-    assert_raises ActiveRecord::RecordNotUnique do
-      b = Link.create!(tail_uuid: groups(:aproject).uuid,
-                       head_uuid: specimens(:owned_by_active_user).uuid,
-                       link_class: 'name',
-                       name: 'foo')
-    end
-  end
-
-  test 'name links with different tail_uuid need not be unique' do
-    a = Link.create!(tail_uuid: groups(:aproject).uuid,
-                     head_uuid: specimens(:owned_by_active_user).uuid,
-                     link_class: 'name',
-                     name: 'foo')
-    assert a.valid?, a.errors.to_s
-    assert_equal groups(:aproject).uuid, a.owner_uuid
-    b = Link.create!(tail_uuid: groups(:asubproject).uuid,
-                     head_uuid: specimens(:owned_by_active_user).uuid,
-                     link_class: 'name',
-                     name: 'foo')
-    assert b.valid?, b.errors.to_s
-    assert_equal groups(:asubproject).uuid, b.owner_uuid
-    assert_not_equal(a.uuid, b.uuid,
-                     "created two links and got the same uuid back.")
-  end
-
-  [nil, '', false].each do |name|
-    test "name links cannot have name=#{name.inspect}" do
-      a = Link.create(tail_uuid: groups(:aproject).uuid,
-                      head_uuid: specimens(:owned_by_active_user).uuid,
-                      link_class: 'name',
-                      name: name)
-      assert a.invalid?, "invalid name was accepted as valid?"
-    end
-  end
-
   test "cannot delete an object referenced by links" do
     ob = Specimen.create
     link = Link.create(tail_uuid: users(:active).uuid,
@@ -100,7 +58,7 @@ class LinkTest < ActiveSupport::TestCase
                                   tail_uuid: users(:admin).uuid)
   end
 
-  test "link granting project permissions to unreadable user is valid" do
-    assert new_active_link_valid?(tail_uuid: users(:admin).uuid)
+  test "link granting project permissions to unreadable user is invalid" do
+    refute new_active_link_valid?(tail_uuid: users(:admin).uuid)
   end
 end