diff options
author | Vitali Tatarintev <vtatarintev@gitlab.com> | 2020-04-08 13:17:22 +0300 |
---|---|---|
committer | Vitali Tatarintev <vtatarintev@gitlab.com> | 2020-04-08 13:22:16 +0300 |
commit | bd2d04953af8fc1d83f5b63abbfe51a310b2cb58 (patch) | |
tree | 21e691762b5cf3dd52266bf0e50bee9d04f18f01 | |
parent | 399dec618b6333627184c40e03c0408e9c880d1b (diff) |
Remove unused merge_request_urls endpoint
-rw-r--r-- | ruby/gitlab-shell/lib/gitlab_net.rb | 16 | ||||
-rw-r--r-- | ruby/gitlab-shell/spec/gitlab_net_spec.rb | 32 |
2 files changed, 0 insertions, 48 deletions
diff --git a/ruby/gitlab-shell/lib/gitlab_net.rb b/ruby/gitlab-shell/lib/gitlab_net.rb index 13be43e27..87f7a712d 100644 --- a/ruby/gitlab-shell/lib/gitlab_net.rb +++ b/ruby/gitlab-shell/lib/gitlab_net.rb @@ -46,22 +46,6 @@ class GitlabNet # rubocop:disable Metrics/ClassLength JSON.parse(resp.body) rescue {} end - def merge_request_urls(gl_repository, repo_path, changes) - changes = changes.join("\n") unless changes.is_a?(String) - changes = changes.encode('UTF-8', 'ASCII', invalid: :replace, replace: '') - url = "#{internal_api_endpoint}/merge_request_urls?project=#{URI.escape(repo_path)}&changes=#{URI.escape(changes)}" - url += "&gl_repository=#{URI.escape(gl_repository)}" if gl_repository - resp = get(url) - - if resp.code == '200' - JSON.parse(resp.body) - else - [] - end - rescue - [] - end - def check get("#{internal_api_endpoint}/check", options: { read_timeout: CHECK_TIMEOUT }) end diff --git a/ruby/gitlab-shell/spec/gitlab_net_spec.rb b/ruby/gitlab-shell/spec/gitlab_net_spec.rb index f26e35a7e..43a894b35 100644 --- a/ruby/gitlab-shell/spec/gitlab_net_spec.rb +++ b/ruby/gitlab-shell/spec/gitlab_net_spec.rb @@ -61,38 +61,6 @@ describe GitlabNet, vcr: true do end end - describe '#merge_request_urls' do - let(:gl_repository) { "project-1" } - let(:changes) { "123456 789012 refs/heads/test\n654321 210987 refs/tags/tag" } - let(:encoded_changes) { "123456%20789012%20refs/heads/test%0A654321%20210987%20refs/tags/tag" } - - it "sends the given arguments as encoded URL parameters" do - expect(gitlab_net).to receive(:get).with("#{internal_api_endpoint}/merge_request_urls?project=#{project}&changes=#{encoded_changes}&gl_repository=#{gl_repository}") - - gitlab_net.merge_request_urls(gl_repository, project, changes) - end - - it "omits the gl_repository parameter if it's nil" do - expect(gitlab_net).to receive(:get).with("#{internal_api_endpoint}/merge_request_urls?project=#{project}&changes=#{encoded_changes}") - - gitlab_net.merge_request_urls(nil, project, changes) - end - - it "returns an empty array when the result cannot be parsed as JSON" do - response = double(:response, code: '200', body: '') - allow(gitlab_net).to receive(:get).and_return(response) - - expect(gitlab_net.merge_request_urls(gl_repository, project, changes)).to eq([]) - end - - it "returns an empty array when the result's status is not 200" do - response = double(:response, code: '500', body: '[{}]') - allow(gitlab_net).to receive(:get).and_return(response) - - expect(gitlab_net.merge_request_urls(gl_repository, project, changes)).to eq([]) - end - end - describe '#pre_receive' do let(:gl_repository) { "project-1" } let(:params) { { gl_repository: gl_repository } } |