From 7415bc3f7239b5c062e3876681265912d8150edd Mon Sep 17 00:00:00 2001 From: radhika Date: Thu, 22 Jun 2017 15:40:40 -0400 Subject: [PATCH] 11840: include ensure_unique_name parameter in untrash requests from workbench. Arvados-DCO-1.1-Signed-off-by: Radhika Chippada --- apps/workbench/app/models/collection.rb | 2 +- .../controllers/trash_items_controller_test.rb | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 apps/workbench/test/controllers/trash_items_controller_test.rb diff --git a/apps/workbench/app/models/collection.rb b/apps/workbench/app/models/collection.rb index 305ea01530..025c136d41 100644 --- a/apps/workbench/app/models/collection.rb +++ b/apps/workbench/app/models/collection.rb @@ -99,6 +99,6 @@ class Collection < ArvadosBase end def untrash - arvados_api_client.api(self.class, "/#{self.uuid}/untrash", {}) + arvados_api_client.api(self.class, "/#{self.uuid}/untrash", {"ensure_unique_name" => true}) end end diff --git a/apps/workbench/test/controllers/trash_items_controller_test.rb b/apps/workbench/test/controllers/trash_items_controller_test.rb new file mode 100644 index 0000000000..c530ba9f6d --- /dev/null +++ b/apps/workbench/test/controllers/trash_items_controller_test.rb @@ -0,0 +1,14 @@ +require 'test_helper' + +class TrashItemsControllerTest < ActionController::TestCase + test "untrash collection with same name as another collection" do + collection = api_fixture('collections')['trashed_collection_to_test_name_conflict_on_untrash'] + items = [collection['uuid']] + post :untrash_items, { + selection: items, + format: :js + }, session_for(:active) + + assert_response :success + end +end -- 2.30.2