Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-03-29 16:08:31 +0300
committerBob Van Landuyt <bob@vanlanduyt.co>2018-04-05 10:18:12 +0300
commite3acc982a87d8d694690c928cf5ca792218c1782 (patch)
treea5bb9549d37cf9020f237c9e86572b01f9691bd0 /spec/requests/api/project_import_spec.rb
parente40c0085ef300aca38076af3ea2f227761084038 (diff)
Override values from JSON with import data
This overrides values defined in the project JSON with the values provided in project.import_data.data['override_params']. These could be passed from the API.
Diffstat (limited to 'spec/requests/api/project_import_spec.rb')
-rw-r--r--spec/requests/api/project_import_spec.rb19
1 files changed, 17 insertions, 2 deletions
diff --git a/spec/requests/api/project_import_spec.rb b/spec/requests/api/project_import_spec.rb
index cf0c2aa903a..5d13e6de741 100644
--- a/spec/requests/api/project_import_spec.rb
+++ b/spec/requests/api/project_import_spec.rb
@@ -71,7 +71,7 @@ describe API::ProjectImport do
expect(json_response['error']).to eq('file is invalid')
end
- it 'allows overriding project params' do
+ it 'stores params that can be overridden' do
stub_import(namespace)
override_params = { 'description' => 'Hello world' }
@@ -85,7 +85,7 @@ describe API::ProjectImport do
expect(import_project.import_data.data['override_params']).to eq(override_params)
end
- it 'does store params that are not allowed' do
+ it 'does not store params that are not allowed' do
stub_import(namespace)
override_params = { 'not_allowed' => 'Hello world' }
@@ -99,6 +99,21 @@ describe API::ProjectImport do
expect(import_project.import_data.data['override_params']).to be_empty
end
+ it 'correctly overrides params during the import' do
+ override_params = { 'description' => 'Hello world' }
+
+ Sidekiq::Testing.inline! do
+ post api('/projects/import', user),
+ path: 'test-import',
+ file: fixture_file_upload(file),
+ namespace: namespace.id,
+ override_params: override_params
+ end
+ import_project = Project.find(json_response['id'])
+
+ expect(import_project.description).to eq('Hello world')
+ end
+
def stub_import(namespace)
expect_any_instance_of(Project).to receive(:import_schedule)
expect(::Projects::CreateService).to receive(:new).with(user, hash_including(namespace_id: namespace.id)).and_call_original