Commit 577c3d87 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Rename Http to HTTP

This is needed when we switch to Zeitwerk since our inflections must be
consistent. This makes it consistent with Gitlab::HTTP.
parent b01c63af
......@@ -10,7 +10,7 @@ class Import::BulkImportsController < ApplicationController
POLLING_INTERVAL = 3_000
rescue_from BulkImports::Clients::Http::ConnectionError, with: :bulk_import_connection_error
rescue_from BulkImports::Clients::HTTP::ConnectionError, with: :bulk_import_connection_error
def configure
session[access_token_key] = configure_params[access_token_key]&.strip
......@@ -86,7 +86,7 @@ class Import::BulkImportsController < ApplicationController
end
def client
@client ||= BulkImports::Clients::Http.new(
@client ||= BulkImports::Clients::HTTP.new(
uri: session[url_key],
token: session[access_token_key],
per_page: params[:per_page],
......
......@@ -9,7 +9,7 @@ module BulkImports
@relation = relation
@entity = @pipeline_tracker.entity
@configuration = @entity.bulk_import.configuration
@client = Clients::Http.new(uri: @configuration.url, token: @configuration.access_token)
@client = Clients::HTTP.new(uri: @configuration.url, token: @configuration.access_token)
end
def started?
......
......@@ -52,7 +52,7 @@ module BulkImports
end
def http_client
@http_client ||= BulkImports::Clients::Http.new(
@http_client ||= BulkImports::Clients::HTTP.new(
uri: configuration.url,
token: configuration.access_token
)
......
......@@ -24,7 +24,7 @@ module BulkImports
end
def http_client(configuration)
@client ||= Clients::Http.new(
@client ||= Clients::HTTP.new(
uri: configuration.url,
token: configuration.access_token
)
......
......@@ -2,7 +2,7 @@
module BulkImports
module Clients
class Http
class HTTP
API_VERSION = 'v4'
DEFAULT_PAGE = 1
DEFAULT_PER_PAGE = 30
......
......@@ -24,7 +24,7 @@ module BulkImports
attr_reader :query
def http_client(configuration)
@http_client ||= BulkImports::Clients::Http.new(
@http_client ||= BulkImports::Clients::HTTP.new(
uri: configuration.url,
token: configuration.access_token,
per_page: 100
......
......@@ -17,7 +17,7 @@ module BulkImports
private
def http_client(configuration)
@http_client ||= BulkImports::Clients::Http.new(
@http_client ||= BulkImports::Clients::HTTP.new(
uri: configuration.url,
token: configuration.access_token,
per_page: 100
......
......@@ -51,7 +51,7 @@ RSpec.describe Import::BulkImportsController do
end
describe 'GET status' do
let(:client) { BulkImports::Clients::Http.new(uri: 'http://gitlab.example', token: 'token') }
let(:client) { BulkImports::Clients::HTTP.new(uri: 'http://gitlab.example', token: 'token') }
describe 'serialized group data' do
let(:client_response) do
......@@ -149,7 +149,7 @@ RSpec.describe Import::BulkImportsController do
context 'when connection error occurs' do
before do
allow(controller).to receive(:client).and_return(client)
allow(client).to receive(:get).and_raise(BulkImports::Clients::Http::ConnectionError)
allow(client).to receive(:get).and_raise(BulkImports::Clients::HTTP::ConnectionError)
end
it 'returns 422' do
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe BulkImports::Clients::Http do
RSpec.describe BulkImports::Clients::HTTP do
include ImportSpecHelper
let(:uri) { 'http://gitlab.example' }
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe BulkImports::Common::Extractors::RestExtractor do
let(:http_client) { instance_double(BulkImports::Clients::Http) }
let(:http_client) { instance_double(BulkImports::Clients::HTTP) }
let(:options) { { query: double(to_h: { resource: nil, query: nil }) } }
let(:response) { double(parsed_response: { 'data' => { 'foo' => 'bar' } }, headers: { 'x-next-page' => '2' }) }
......
......@@ -12,7 +12,7 @@ RSpec.describe BulkImports::Groups::Extractors::SubgroupsExtractor do
response = [{ 'test' => 'group' }]
context = BulkImports::Pipeline::Context.new(tracker)
allow_next_instance_of(BulkImports::Clients::Http) do |client|
allow_next_instance_of(BulkImports::Clients::HTTP) do |client|
allow(client).to receive(:each_page).and_return(response)
end
......
......@@ -16,7 +16,7 @@ RSpec.describe BulkImports::ExportStatus do
subject { described_class.new(tracker, relation) }
before do
allow_next_instance_of(BulkImports::Clients::Http) do |client|
allow_next_instance_of(BulkImports::Clients::HTTP) do |client|
allow(client).to receive(:get).and_return(response_double)
end
end
......@@ -66,7 +66,7 @@ RSpec.describe BulkImports::ExportStatus do
context 'when something goes wrong during export status fetch' do
it 'returns exception class as error' do
allow_next_instance_of(BulkImports::Clients::Http) do |client|
allow_next_instance_of(BulkImports::Clients::HTTP) do |client|
allow(client).to receive(:get).and_raise(StandardError, 'Error!')
end
......
......@@ -26,7 +26,7 @@ RSpec.describe BulkImports::FileDownloadService do
subject { described_class.new(configuration: config, relative_url: '/test', dir: tmpdir, filename: filename) }
before do
allow_next_instance_of(BulkImports::Clients::Http) do |client|
allow_next_instance_of(BulkImports::Clients::HTTP) do |client|
allow(client).to receive(:head).and_return(response_double)
allow(client).to receive(:stream).and_yield(chunk_double)
end
......
......@@ -19,7 +19,7 @@ RSpec.describe BulkImports::ExportRequestWorker do
it 'requests relations export' do
expected = "/groups/foo%2Fbar/export_relations"
expect_next_instance_of(BulkImports::Clients::Http) do |client|
expect_next_instance_of(BulkImports::Clients::HTTP) do |client|
expect(client).to receive(:post).with(expected).twice
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