update import API and spec

This commit is contained in:
James Lopez 2018-02-12 15:26:59 +01:00
parent d3b3f5d1b4
commit 516d33f5ac
No known key found for this signature in database
GPG Key ID: 756BF8E9D7C0CF39
2 changed files with 7 additions and 5 deletions

View File

@ -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

View File

@ -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