From 24fd61eb70995d505bd990a79339571294b8f6eb Mon Sep 17 00:00:00 2001 From: radhika Date: Wed, 24 Sep 2014 17:06:38 -0400 Subject: [PATCH] 3836: add integration test to verify name change when a collection is removed from a project, and another collection with the same name already exists in the home project. --- .../test/integration/projects_test.rb | 22 ++++++++++------- services/api/test/fixtures/collections.yml | 24 +++++++++++++++++++ 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/apps/workbench/test/integration/projects_test.rb b/apps/workbench/test/integration/projects_test.rb index 2a363c57be..d50a4775a5 100644 --- a/apps/workbench/test/integration/projects_test.rb +++ b/apps/workbench/test/integration/projects_test.rb @@ -266,15 +266,16 @@ class ProjectsTest < ActionDispatch::IntegrationTest end [ - 'Move', - 'Remove', - 'Copy', - ].each do |action| - test "selection #{action} for project" do - src = api_fixture('groups')['aproject'] - dest = api_fixture('groups')['asubproject'] - my_collection = api_fixture('collections')['collection_to_move_around_in_aproject'] - + ['Move',api_fixture('collections')['collection_to_move_around_in_aproject'], + api_fixture('groups')['aproject'],api_fixture('groups')['asubproject']], + ['Remove',api_fixture('collections')['collection_to_move_around_in_aproject'], + api_fixture('groups')['aproject']], + ['Copy',api_fixture('collections')['collection_to_move_around_in_aproject'], + api_fixture('groups')['aproject'],api_fixture('groups')['asubproject']], + ['Remove',api_fixture('collections')['collection_in_aproject_with_same_name_as_in_home_project'], + api_fixture('groups')['aproject'],nil,true], + ].each do |action, my_collection, src, dest=nil, expect_name_change=nil| + test "selection #{action} #{expect_name_change} for project" do perform_selection_action src, dest, my_collection, action case action @@ -302,6 +303,9 @@ class ProjectsTest < ActionDispatch::IntegrationTest find("#projects-menu").click find(".dropdown-menu a", text: "Home").click assert page.has_text?(my_collection['name']), 'Collection not found in home project after remove' + if expect_name_change + assert page.has_text?(my_collection['name']+' removed from'), 'Collection not found in home project after remove' + end end end end diff --git a/services/api/test/fixtures/collections.yml b/services/api/test/fixtures/collections.yml index 18531174e0..16da08f06f 100644 --- a/services/api/test/fixtures/collections.yml +++ b/services/api/test/fixtures/collections.yml @@ -199,3 +199,27 @@ collection_expires_in_future: expires_at: 2038-01-01T00:00:00Z manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:expired\n" name: collection_expires_in_future + +collection_in_home_project_with_same_name_as_in_aproject: + uuid: zzzzz-4zz18-12342x4u7ftabcd + portable_data_hash: ea10d51bcf88862dbcc36eb292017dfd+45 + owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz + created_at: 2014-02-03T17:22:54Z + modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr + modified_by_user_uuid: zzzzz-tpzed-d9tiejq69daie8f + modified_at: 2014-02-03T17:22:54Z + updated_at: 2014-02-03T17:22:54Z + manifest_text: ". 73feffa4b7f6bb68e44cf984c85f6e88+3 0:3:baz\n" + name: collection_with_same_name_in_aproject_and_home_project + +collection_in_aproject_with_same_name_as_in_home_project: + uuid: zzzzz-4zz18-56782x4u7ftefgh + portable_data_hash: ea10d51bcf88862dbcc36eb292017dfd+45 + owner_uuid: zzzzz-j7d0g-v955i6s2oi1cbso + created_at: 2014-02-03T17:22:54Z + modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr + modified_by_user_uuid: zzzzz-tpzed-d9tiejq69daie8f + modified_at: 2014-02-03T17:22:54Z + updated_at: 2014-02-03T17:22:54Z + manifest_text: ". 73feffa4b7f6bb68e44cf984c85f6e88+3 0:3:baz\n" + name: collection_with_same_name_in_aproject_and_home_project -- 2.30.2