diff options
author | Aram Visser <hello@aramvisser.com> | 2018-06-24 13:10:15 +0700 |
---|---|---|
committer | Aram Visser <hello@aramvisser.com> | 2018-06-27 18:21:18 +0700 |
commit | c3de6a86734f8756de214cc87ac230820fa33acc (patch) | |
tree | e3db898a5a56d6afaf552d82c12e2b3e1d42fafa /spec | |
parent | 2452f1a73e8dcf646311c6069a077ab66be5ce51 (diff) | |
download | gitlab-ce-c3de6a86734f8756de214cc87ac230820fa33acc.tar.gz |
Add transfer project endpoint to the Projects API
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 } |