X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/4dd469c1bd4c1f4a2edac6c2d63bc571e874aa3f..dc29394d6e4df36a1cab5beae69c3331e037bdb1:/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 6fa1d16770..5a67b5cbfc 100644 --- a/services/api/test/functional/arvados/v1/groups_controller_test.rb +++ b/services/api/test/functional/arvados/v1/groups_controller_test.rb @@ -31,11 +31,11 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase test "get list of groups that are not projects" do authorize_with :active - get :index, filters: [['group_class', '=', nil]], format: :json + get :index, filters: [['group_class', '!=', 'project']], format: :json assert_response :success group_uuids = [] json_response['items'].each do |group| - assert_equal nil, group['group_class'] + assert_not_equal 'project', group['group_class'] group_uuids << group['uuid'] end assert_not_includes group_uuids, groups(:aproject).uuid @@ -311,8 +311,9 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase format: :json } assert_response :success - assert_nil(json_response['writable_by'], - "Should not receive uuid list in 'writable_by' field") + assert_equal([json_response['owner_uuid']], + json_response['writable_by'], + "Should only see owner_uuid in 'writable_by' field") end test 'get writable_by list by admin user' do @@ -328,4 +329,31 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase users(:admin).uuid, "Current user should be included in 'writable_by' field") end + + test 'creating subproject with duplicate name fails' do + authorize_with :active + post :create, { + group: { + name: 'A Project', + owner_uuid: users(:active).uuid, + group_class: 'project', + }, + } + assert_response 422 + end + + test 'creating duplicate named subproject succeeds with ensure_unique_name' do + authorize_with :active + post :create, { + group: { + name: 'A Project', + owner_uuid: users(:active).uuid, + group_class: 'project', + }, + ensure_unique_name: true + } + assert_response :success + assert_not_equal json_response['uuid'], groups(:aproject).uuid + assert_equal json_response['name'], 'A Project (2)' + end end