X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/ccce5e8ad71ed2e50ecd57c0f73f1aaafc468539..620a10bed55b85294baad9dba965ea8dad59e884:/services/api/test/functional/arvados/v1/groups_controller_test.rb?ds=sidebyside 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