summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2018-02-12 15:26:59 +0100
committerJames Lopez <james@jameslopez.es>2018-02-13 15:25:48 +0100
commit516d33f5ac8f65d8d69d1e5e88efbf0faabbe0eb (patch)
treeeca0fac8e5ddb91236b3e0f27343c6e4371a2608
parentd3b3f5d1b4def5e87f90a2347acc0b0ee8edc80a (diff)
downloadgitlab-ce-516d33f5ac8f65d8d69d1e5e88efbf0faabbe0eb.tar.gz
update import API and spec
-rw-r--r--lib/api/project_import.rb4
-rw-r--r--spec/requests/api/project_import_spec.rb8
2 files changed, 7 insertions, 5 deletions
diff --git a/lib/api/project_import.rb b/lib/api/project_import.rb
index 396c316af22..1b63f4d4d9f 100644
--- a/lib/api/project_import.rb
+++ b/lib/api/project_import.rb
@@ -17,7 +17,7 @@ module API
end
params do
- requires :name, type: String, desc: 'The new project name'
+ requires :path, type: String, desc: 'The new project path and name'
optional :namespace, type: String, desc: 'The ID or name of the namespace that the project will be imported into. Defaults to the user namespace.'
requires :file, type: File, desc: 'The project export file to be imported'
end
@@ -38,7 +38,7 @@ module API
Namespace.find_by_path_or_name(namespace)
end
- project_params = import_params.merge(namespace: namespace.id)
+ project_params = import_params.merge(namespace_id: namespace.id)
project = ::Projects::GitlabProjectsImportService.new(current_user, project_params).execute
diff --git a/spec/requests/api/project_import_spec.rb b/spec/requests/api/project_import_spec.rb
index b810c81108c..0875c1cc149 100644
--- a/spec/requests/api/project_import_spec.rb
+++ b/spec/requests/api/project_import_spec.rb
@@ -8,7 +8,7 @@ describe API::ProjectImport do
before do
allow_any_instance_of(Gitlab::ImportExport).to receive(:storage_path).and_return(export_path)
- group.add_owner(user)
+ namespace.add_owner(user)
end
after do
@@ -19,9 +19,11 @@ describe API::ProjectImport do
it 'schedules an import' do
expect_any_instance_of(Project).to receive(:import_schedule)
- post api('/projects/import', user), name: 'test', file: file, namespace: namespace.full_path
+ post api('/projects/import', user), path: 'test-import', file: file, namespace: namespace.full_path
- expect(project.status).to eq('started')
+ expect(response).to have_gitlab_http_status(200)
+
+ expect(Project.find_by_name('test-import').first.status).to eq('started')
end
end