2044: Revert ff9323418d6a13da701be80aee9e3134e8aa6bab.
[arvados.git] / services / api / test / functional / arvados / v1 / links_controller_test.rb
index ac93c68277cddee6d5fc0550d5438d0af0d57990..d5b42665c38b8599c5fa0e3bc088d851469f4f33 100644 (file)
@@ -20,7 +20,7 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
     end
   end
 
-  %w(created_at updated_at modified_at).each do |attr|
+  %w(created_at modified_at).each do |attr|
     {nil: nil, bogus: 2.days.ago}.each do |bogustype, bogusvalue|
       test "cannot set #{bogustype} #{attr} in create" do
         authorize_with :active
@@ -270,4 +270,17 @@ class Arvados::V1::LinksControllerTest < ActionController::TestCase
     assert_response :success
   end
 
+  test "refuse duplicate name" do
+    the_name = links(:job_name_in_aproject).name
+    the_project = links(:job_name_in_aproject).tail_uuid
+    authorize_with :active
+    post :create, link: {
+      tail_uuid: the_project,
+      head_uuid: specimens(:owned_by_active_user).uuid,
+      link_class: 'name',
+      name: the_name,
+      properties: {this_s: "a duplicate name"}
+    }
+    assert_response 422
+  end
 end