Commit 7cfd685a authored by Rémy Coutable's avatar Rémy Coutable

Ensure GithubImport::Client does not crash when the 'verify_ssl' config is not present

Settingslogic allow to access optional settings through the Hash
notation: if the key is not present, it returns nil. In the present case
this will let the Octokit::Client object use whatever default value it
wants for the ssl option.
parent ac0451df
......@@ -17,7 +17,7 @@ module Gitlab
access_token: access_token,
api_endpoint: github_options[:site],
connection_options: {
ssl: { verify: config.verify_ssl }
ssl: { verify: config['verify_ssl'] }
}
)
end
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Gitlab::GithubImport::Client, lib: true do
let(:token) { '123456' }
let(:github_provider) { OpenStruct.new(app_id: 'asd123', app_secret: 'asd123', name: 'github', args: { 'client_options' => {} }) }
let(:github_provider) { Settingslogic.new('app_id' => 'asd123', 'app_secret' => 'asd123', 'name' => 'github', 'args' => { 'client_options' => {} }) }
subject(:client) { described_class.new(token) }
......@@ -16,6 +16,9 @@ describe Gitlab::GithubImport::Client, lib: true do
end
end
it 'does not crash (e.g. Settingslogic::MissingSetting) when verify_ssl config is not present' do
expect { client.api }.not_to raise_error
end
context 'allow SSL verification to be configurable on API' do
before do
......
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