X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/eee2c981d6a29eb7f15b8957570bbf8515d3d947..1b3750c9ffbec7a76b374023188c5c13882dc651:/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 e7f03718a4..f8f9eaeb0d 100644 --- a/services/api/test/functional/arvados/v1/groups_controller_test.rb +++ b/services/api/test/functional/arvados/v1/groups_controller_test.rb @@ -206,4 +206,41 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase end end + test 'get writable_by list for owned group' do + authorize_with :active + get :show, { + id: groups(:afolder).uuid, + format: :json + } + assert_response :success + assert_not_nil(json_response['writable_by'], + "Should receive uuid list in 'writable_by' field") + assert_includes(json_response['writable_by'], users(:active).uuid, + "owner should be included in writable_by list") + end + + test 'no writable_by list for group with read-only access' do + authorize_with :rominiadmin + get :show, { + id: groups(:testusergroup_admins).uuid, + format: :json + } + assert_response :success + assert_nil(json_response['writable_by'], + "Should not receive uuid list in 'writable_by' field") + end + + test 'get writable_by list by admin user' do + authorize_with :admin + get :show, { + id: groups(:testusergroup_admins).uuid, + format: :json + } + assert_response :success + assert_not_nil(json_response['writable_by'], + "Should receive uuid list in 'writable_by' field") + assert_includes(json_response['writable_by'], + users(:admin).uuid, + "Current user should be included in 'writable_by' field") + end end