diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-06-29 16:50:02 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-06-29 16:50:02 +0300 |
commit | f316cb9b9a5d0d13d54ef0bb94845310ff640aae (patch) | |
tree | 054ec2caa0f6db9fdd1058ce697aa5a499e61c38 /spec | |
parent | cf55dd8b402dc400955039e5617cf701ef1c9930 (diff) | |
parent | c3de6a86734f8756de214cc87ac230820fa33acc (diff) |
Merge branch 'transfer_project_api_endpoint' into 'master'
Add transfer project endpoint to the Projects API
Closes #45146
See merge request gitlab-org/gitlab-ce!20122
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/projects_spec.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 99103039f77..abf9ad738bd 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -1990,6 +1990,38 @@ describe API::Projects do end end + describe 'PUT /projects/:id/transfer' do + context 'when authenticated as owner' do + let(:group) { create :group } + + it 'transfers the project to the new namespace' do + group.add_owner(user) + + put api("/projects/#{project.id}/transfer", user), namespace: group.id + + expect(response).to have_gitlab_http_status(200) + end + + it 'fails when transferring to a non owned namespace' do + put api("/projects/#{project.id}/transfer", user), namespace: group.id + + expect(response).to have_gitlab_http_status(404) + end + + it 'fails when transferring to an unknown namespace' do + put api("/projects/#{project.id}/transfer", user), namespace: 'unknown' + + expect(response).to have_gitlab_http_status(404) + end + + it 'fails on missing namespace' do + put api("/projects/#{project.id}/transfer", user) + + expect(response).to have_gitlab_http_status(400) + end + end + end + it_behaves_like 'custom attributes endpoints', 'projects' do let(:attributable) { project } let(:other_attributable) { project2 } |