Fix project import API after import service refactor
This commit is contained in:
parent
46d59a5d24
commit
d8dfec0ffa
2 changed files with 8 additions and 4 deletions
|
@ -41,8 +41,12 @@ module API
|
|||
current_user.namespace
|
||||
end
|
||||
|
||||
project_params = import_params.merge(namespace_id: namespace.id,
|
||||
file: import_params[:file]['tempfile'])
|
||||
project_params = {
|
||||
path: import_params[:path],
|
||||
namespace_id: namespace.id,
|
||||
file: import_params[:file]['tempfile']
|
||||
}
|
||||
|
||||
project = ::Projects::GitlabProjectsImportService.new(current_user, project_params).execute
|
||||
|
||||
render_api_error!(project.errors.full_messages&.first, 400) unless project.saved?
|
||||
|
|
|
@ -42,7 +42,7 @@ describe API::ProjectImport do
|
|||
|
||||
it 'schedules an import at the user namespace level' do
|
||||
expect_any_instance_of(Project).not_to receive(:import_schedule)
|
||||
expect(Gitlab::ImportExport::ProjectCreator).not_to receive(:new)
|
||||
expect(::Projects::CreateService).not_to receive(:new)
|
||||
|
||||
post api('/projects/import', user), namespace: 'nonexistent', path: 'test-import2', file: fixture_file_upload(file)
|
||||
|
||||
|
@ -73,7 +73,7 @@ describe API::ProjectImport do
|
|||
|
||||
def stub_import(namespace)
|
||||
expect_any_instance_of(Project).to receive(:import_schedule)
|
||||
expect(Gitlab::ImportExport::ProjectCreator).to receive(:new).with(namespace.id, any_args).and_call_original
|
||||
expect(::Projects::CreateService).to receive(:new).with(user, hash_including(namespace_id: namespace.id)).and_call_original
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue