Add unique and valid name constraints.
[arvados.git] / services / api / test / functional / arvados / v1 / links_controller_test.rb
index 804e1bdfdb1260abe075ceecba6710d84e03050a..dfce78b13f7f79c4f5927bbbda749882758071c6 100644 (file)
@@ -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_afolder).name
+    the_folder = links(:job_name_in_afolder).tail_uuid
+    authorize_with :active
+    post :create, link: {
+      tail_uuid: the_folder,
+      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