X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/7696fe3db2dcf03fe8b4528080100bec2196da91..ae92d144610446849eb568247a44f02ae985c281:/services/api/test/functional/arvados/v1/groups_controller_test.rb diff --git a/services/api/test/functional/arvados/v1/groups_controller_test.rb b/services/api/test/functional/arvados/v1/groups_controller_test.rb index 0819c23067..cfcb33d40a 100644 --- a/services/api/test/functional/arvados/v1/groups_controller_test.rb +++ b/services/api/test/functional/arvados/v1/groups_controller_test.rb @@ -787,6 +787,28 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase end end + # the group class overrides the destroy method. Make sure that the destroyed + # object is returned + [ + {group_class: "project"}, + {group_class: "role"}, + {group_class: "filter", properties: {"filters":[]}}, + ].each do |params| + test "destroy group #{params} returns object" do + authorize_with :active + + group = Group.create!(params) + + post :destroy, params: { + id: group.uuid, + format: :json, + } + assert_response :success + assert_not_nil json_response + assert_equal group.uuid, json_response["uuid"] + end + end + test 'get shared owned by another user' do authorize_with :user_bar_in_sharing_group @@ -920,4 +942,24 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase assert_response 422 end + + test "include_trash does not return trash inside frozen project" do + authorize_with :active + trashtime = Time.now - 1.second + outerproj = Group.create!(group_class: 'project') + innerproj = Group.create!(group_class: 'project', owner_uuid: outerproj.uuid) + innercoll = Collection.create!(name: 'inner-not-trashed', owner_uuid: innerproj.uuid) + innertrash = Collection.create!(name: 'inner-trashed', owner_uuid: innerproj.uuid, trash_at: trashtime) + innertrashproj = Group.create!(group_class: 'project', name: 'inner-trashed-proj', owner_uuid: innerproj.uuid, trash_at: trashtime) + outertrash = Collection.create!(name: 'outer-trashed', owner_uuid: outerproj.uuid, trash_at: trashtime) + innerproj.update_attributes!(frozen_by_uuid: users(:active).uuid) + get :contents, params: {id: outerproj.uuid, include_trash: true, recursive: true} + assert_response :success + uuids = json_response['items'].collect { |item| item['uuid'] } + assert_includes uuids, outertrash.uuid + assert_includes uuids, innerproj.uuid + assert_includes uuids, innercoll.uuid + refute_includes uuids, innertrash.uuid + refute_includes uuids, innertrashproj.uuid + end end