Commit 9ae4fa58 authored by Stan Hu's avatar Stan Hu

Merge branch 'georgekoltsov/dont-remove-export-when-uploading-to-url' into 'master'

Do not remove export when uploading via URL

See merge request gitlab-org/gitlab!62763
parents 083648bc c2e09e8f
......@@ -32,6 +32,10 @@ module Gitlab
end
end
def delete_export?
false
end
private
def send_file
......
......@@ -27,22 +27,32 @@ RSpec.describe Gitlab::ImportExport::AfterExportStrategies::WebUploadStrategy do
expect(subject.new(url: example_url, http_method: 'whatever')).not_to be_valid
end
it 'onyl allow urls as upload urls' do
it 'only allow urls as upload urls' do
expect(subject.new(url: example_url)).to be_valid
expect(subject.new(url: 'whatever')).not_to be_valid
end
end
describe '#execute' do
it 'removes the exported project file after the upload' do
context 'when upload succeeds' do
before do
allow(strategy).to receive(:send_file)
allow(strategy).to receive(:handle_response_error)
end
expect(project).to receive(:remove_exports)
it 'does not remove the exported project file after the upload' do
expect(project).not_to receive(:remove_exports)
strategy.execute(user, project)
end
it 'has finished export status' do
strategy.execute(user, project)
expect(project.export_status).to eq(:finished)
end
end
context 'when upload fails' do
it 'stores the export error' do
stub_full_request(example_url, method: :post).to_return(status: [404, 'Page not found'])
......
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