Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-16 00:09:12 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-16 00:09:12 +0300
commitc083f926c5714ee4dcbb3ae497b14d4cb31aa794 (patch)
tree2bc13107c4396e3263afe3c13b7e9e32f06a843b /spec/features/file_uploads
parent316fbf9f95dcdd16775f0339415572c3195eea92 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/file_uploads')
-rw-r--r--spec/features/file_uploads/maven_package_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/features/file_uploads/maven_package_spec.rb b/spec/features/file_uploads/maven_package_spec.rb
index c873a0e9a36..e87eec58618 100644
--- a/spec/features/file_uploads/maven_package_spec.rb
+++ b/spec/features/file_uploads/maven_package_spec.rb
@@ -25,5 +25,31 @@ RSpec.describe 'Upload a maven package', :api, :js do
it { expect(subject.code).to eq(200) }
end
+ RSpec.shared_examples 'for a maven sha1' do
+ let(:dummy_package) { double(Packages::Package) }
+ let(:api_path) { "/projects/#{project.id}/packages/maven/com/example/my-app/1.0/my-app-1.0-20180724.124855-1.jar.sha1" }
+
+ before do
+ # The sha verification done by the maven api is between:
+ # - the sha256 set by workhorse
+ # - the sha256 of the sha1 of the uploaded package file
+ # We're going to send `file` for the sha1 and stub the sha1 of the package file so that
+ # both sha256 being the same
+ expect(::Packages::PackageFileFinder).to receive(:new).and_return(double(execute!: dummy_package))
+ expect(dummy_package).to receive(:file_sha1).and_return(File.read(file.path))
+ end
+
+ it { expect(subject.code).to eq(204) }
+ end
+
+ RSpec.shared_examples 'for a maven md5' do
+ let(:api_path) { "/projects/#{project.id}/packages/maven/com/example/my-app/1.0/my-app-1.0-20180724.124855-1.jar.md5" }
+ let(:file) { StringIO.new('dummy_package') }
+
+ it { expect(subject.code).to eq(200) }
+ end
+
it_behaves_like 'handling file uploads', 'for a maven package'
+ it_behaves_like 'handling file uploads', 'for a maven sha1'
+ it_behaves_like 'handling file uploads', 'for a maven md5'
end