debian-mirror-gitlab/spec/uploaders/dependency_proxy/file_uploader_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
1.4 KiB
Ruby
Raw Permalink Normal View History

2021-01-29 00:20:46 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe DependencyProxy::FileUploader do
2021-04-17 20:07:23 +05:30
describe 'DependencyProxy::Blob uploader' do
let_it_be(:blob) { create(:dependency_proxy_blob) }
let_it_be(:path) { Gitlab.config.dependency_proxy.storage_path }
2021-09-30 23:02:18 +05:30
2021-04-17 20:07:23 +05:30
let(:uploader) { described_class.new(blob, :file) }
2021-01-29 00:20:46 +05:30
2021-04-17 20:07:23 +05:30
subject { uploader }
2021-01-29 00:20:46 +05:30
2021-04-17 20:07:23 +05:30
it_behaves_like "builds correct paths",
2023-06-20 00:43:36 +05:30
store_dir: %r[\h{2}/\h{2}],
cache_dir: %r[/dependency_proxy/tmp/cache],
work_dir: %r[/dependency_proxy/tmp/work]
2021-04-17 20:07:23 +05:30
context 'object store is remote' do
before do
stub_dependency_proxy_object_storage
end
2021-01-29 00:20:46 +05:30
2021-04-17 20:07:23 +05:30
include_context 'with storage', described_class::Store::REMOTE
2023-06-20 00:43:36 +05:30
it_behaves_like "builds correct paths", store_dir: %r[\h{2}/\h{2}]
2021-01-29 00:20:46 +05:30
end
2021-04-17 20:07:23 +05:30
end
2021-01-29 00:20:46 +05:30
2021-04-17 20:07:23 +05:30
describe 'DependencyProxy::Manifest uploader' do
let_it_be(:manifest) { create(:dependency_proxy_manifest) }
let_it_be(:initial_content_type) { 'application/json' }
let_it_be(:fixture_file) { fixture_file_upload('spec/fixtures/dependency_proxy/manifest', initial_content_type) }
2021-09-30 23:02:18 +05:30
2021-04-17 20:07:23 +05:30
let(:uploader) { described_class.new(manifest, :file) }
2021-01-29 00:20:46 +05:30
2021-04-17 20:07:23 +05:30
subject { uploader }
it 'will change upload file content type to match the model content type', :aggregate_failures do
uploader.cache!(fixture_file)
expect(uploader.file.content_type).to eq(manifest.content_type)
expect(uploader.file.content_type).not_to eq(initial_content_type)
end
2021-01-29 00:20:46 +05:30
end
end