Commit fc359c17 authored by Nick Thomas's avatar Nick Thomas

Merge branch '232481-package-managers-helpers-cleanup' into 'master'

Remove unused functions in Package Managers Helpers

See merge request gitlab-org/gitlab!41267
parents a63f8f27 7efa4e14
......@@ -6,16 +6,6 @@ module API
extend Grape::API::Helpers
include ::API::Helpers::PackagesHelpers
params :workhorse_upload_params do
optional 'file.path', type: String, desc: 'Path to locally stored body (generated by Workhorse)'
optional 'file.name', type: String, desc: 'Real filename as send in Content-Disposition (generated by Workhorse)'
optional 'file.type', type: String, desc: 'Real content type as send in Content-Type (generated by Workhorse)'
optional 'file.size', type: Integer, desc: 'Real size of file (generated by Workhorse)'
optional 'file.md5', type: String, desc: 'MD5 checksum of the file (generated by Workhorse)'
optional 'file.sha1', type: String, desc: 'SHA1 checksum of the file (generated by Workhorse)'
optional 'file.sha256', type: String, desc: 'SHA256 checksum of the file (generated by Workhorse)'
end
def find_job_from_http_basic_auth
return unless request.headers
......@@ -36,12 +26,6 @@ module API
DeployToken.active.find_by_token(token)
end
def uploaded_package_file(param_name = :file)
uploaded_file = UploadedFile.from_params(params, param_name, ::Packages::PackageFileUploader.workhorse_local_upload_path)
bad_request!('Missing package file!') unless uploaded_file
uploaded_file
end
private
def decode_token
......
......@@ -86,36 +86,4 @@ RSpec.describe API::Helpers::PackagesManagerClientsHelpers do
it_behaves_like 'invalid auth header'
end
describe '#uploaded_package_file' do
let_it_be(:params) { {} }
subject { helper.uploaded_package_file }
before do
allow(helper).to receive(:params).and_return(params)
end
context 'with valid uploaded package file' do
let_it_be(:uploaded_file) { Object.new }
before do
allow(UploadedFile).to receive(:from_params).and_return(uploaded_file)
end
it { is_expected.to be uploaded_file }
end
context 'with invalid uploaded package file' do
before do
allow(UploadedFile).to receive(:from_params).and_return(nil)
end
it 'fails with bad_request!' do
expect(helper).to receive(:bad_request!)
expect(subject).to be nil
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