Commit 7f276af6 authored by James Lopez's avatar James Lopez

Merge branch 'sh-geo-add-spec-import-export' into 'master'

Geo: Add spec for uploading import/export archives

See merge request gitlab-org/gitlab-ee!6627
parents 2c79c3f3 a2905796
...@@ -203,5 +203,34 @@ describe Geo::FileUploadService do ...@@ -203,5 +203,34 @@ describe Geo::FileUploadService do
expect(service.execute).to be_nil expect(service.execute).to be_nil
end end
end end
context 'import export archive' do
let(:project) { create(:project) }
let(:upload) { Upload.find_by(model: project, uploader: 'ImportExportUploader') }
let(:params) { { id: upload.id, type: 'import_export' } }
let(:file_transfer) { Gitlab::Geo::FileTransfer.new(:import_export, upload) }
let(:transfer_request) { Gitlab::Geo::TransferRequest.new(file_transfer.request_data) }
let(:req_header) { transfer_request.headers['Authorization'] }
let(:file) { fixture_file_upload('spec/fixtures/project_export.tar.gz') }
before do
ImportExportUploader.new(project).store!(file)
end
it 'sends the file' do
service = described_class.new(params, req_header)
response = service.execute
expect(response[:code]).to eq(:ok)
expect(response[:file].path).to end_with('tar.gz')
end
it 'returns nil if no authorization' do
service = described_class.new(params, nil)
expect(service.execute).to be_nil
end
end
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