Commit 516d33f5 authored by James Lopez's avatar James Lopez

update import API and spec

parent d3b3f5d1
...@@ -17,7 +17,7 @@ module API ...@@ -17,7 +17,7 @@ module API
end end
params do 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.' 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' requires :file, type: File, desc: 'The project export file to be imported'
end end
...@@ -38,7 +38,7 @@ module API ...@@ -38,7 +38,7 @@ module API
Namespace.find_by_path_or_name(namespace) Namespace.find_by_path_or_name(namespace)
end 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 project = ::Projects::GitlabProjectsImportService.new(current_user, project_params).execute
......
...@@ -8,7 +8,7 @@ describe API::ProjectImport do ...@@ -8,7 +8,7 @@ describe API::ProjectImport do
before do before do
allow_any_instance_of(Gitlab::ImportExport).to receive(:storage_path).and_return(export_path) allow_any_instance_of(Gitlab::ImportExport).to receive(:storage_path).and_return(export_path)
group.add_owner(user) namespace.add_owner(user)
end end
after do after do
...@@ -19,9 +19,11 @@ describe API::ProjectImport do ...@@ -19,9 +19,11 @@ describe API::ProjectImport do
it 'schedules an import' do it 'schedules an import' do
expect_any_instance_of(Project).to receive(:import_schedule) 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
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment