diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/requests/api/bulk_imports_spec.rb | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/requests/api/bulk_imports_spec.rb')
-rw-r--r-- | spec/requests/api/bulk_imports_spec.rb | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/requests/api/bulk_imports_spec.rb b/spec/requests/api/bulk_imports_spec.rb index f0edfa6f227..1a28687c830 100644 --- a/spec/requests/api/bulk_imports_spec.rb +++ b/spec/requests/api/bulk_imports_spec.rb @@ -20,6 +20,48 @@ RSpec.describe API::BulkImports do end end + describe 'POST /bulk_imports' do + it 'starts a new migration' do + post api('/bulk_imports', user), params: { + configuration: { + url: 'http://gitlab.example', + access_token: 'access_token' + }, + entities: [ + source_type: 'group_entity', + source_full_path: 'full_path', + destination_name: 'destination_name', + destination_namespace: 'destination_namespace' + ] + } + + expect(response).to have_gitlab_http_status(:created) + + expect(json_response['status']).to eq('created') + end + + context 'when provided url is blocked' do + it 'returns blocked url error' do + post api('/bulk_imports', user), params: { + configuration: { + url: 'url', + access_token: 'access_token' + }, + entities: [ + source_type: 'group_entity', + source_full_path: 'full_path', + destination_name: 'destination_name', + destination_namespace: 'destination_namespace' + ] + } + + expect(response).to have_gitlab_http_status(:unprocessable_entity) + + expect(json_response['message']).to eq('Validation failed: Url is blocked: Only allowed schemes are http, https') + end + end + end + describe 'GET /bulk_imports/entities' do it 'returns a list of all import entities authored by the user' do get api('/bulk_imports/entities', user) |