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>2023-06-30 18:28:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-06-30 18:28:44 +0300
commit8cf61c17e9f20827896c44b1e0a1287b5a5dc507 (patch)
tree0077758ac9600d2e72451bf774bbe5932c5171c0
parent427cb4dfa77bccf1594503a7e00d7e782e281c16 (diff)
Add latest changes from gitlab-org/gitlab@16-1-stable-ee
-rw-r--r--app/controllers/concerns/import/github_oauth.rb2
-rw-r--r--lib/gitlab/legacy_github_import/client.rb2
-rw-r--r--spec/lib/gitlab/legacy_github_import/client_spec.rb18
3 files changed, 17 insertions, 5 deletions
diff --git a/app/controllers/concerns/import/github_oauth.rb b/app/controllers/concerns/import/github_oauth.rb
index c233f5d09fa..dc03a132768 100644
--- a/app/controllers/concerns/import/github_oauth.rb
+++ b/app/controllers/concerns/import/github_oauth.rb
@@ -47,7 +47,7 @@ module Import
def oauth_options
return unless oauth_config
- oauth_config.dig('args', 'client_options').deep_symbolize_keys
+ oauth_config.dig('args', 'client_options').to_h.deep_symbolize_keys
end
def authorize_url
diff --git a/lib/gitlab/legacy_github_import/client.rb b/lib/gitlab/legacy_github_import/client.rb
index e1c3b09d371..bd788b4faf8 100644
--- a/lib/gitlab/legacy_github_import/client.rb
+++ b/lib/gitlab/legacy_github_import/client.rb
@@ -114,7 +114,7 @@ module Gitlab
def github_options
if config
- config["args"]["client_options"].deep_symbolize_keys
+ config["args"]["client_options"].to_h.deep_symbolize_keys
else
OmniAuth::Strategies::GitHub.default_options[:client_options].to_h.symbolize_keys
end
diff --git a/spec/lib/gitlab/legacy_github_import/client_spec.rb b/spec/lib/gitlab/legacy_github_import/client_spec.rb
index 757bdd8dd6c..4aea7308e37 100644
--- a/spec/lib/gitlab/legacy_github_import/client_spec.rb
+++ b/spec/lib/gitlab/legacy_github_import/client_spec.rb
@@ -4,7 +4,8 @@ require 'spec_helper'
RSpec.describe Gitlab::LegacyGithubImport::Client, feature_category: :importers do
let(:token) { '123456' }
- let(:github_provider) { GitlabSettings::Options.build('app_id' => 'asd123', 'app_secret' => 'asd123', 'name' => 'github', 'args' => { 'client_options' => {} }) }
+ let(:github_provider) { GitlabSettings::Options.build('app_id' => 'asd123', 'app_secret' => 'asd123', 'name' => 'github', 'args' => { 'client_options' => client_options }) }
+ let(:client_options) { {} }
let(:wait_for_rate_limit_reset) { true }
subject(:client) { described_class.new(token, wait_for_rate_limit_reset: wait_for_rate_limit_reset) }
@@ -13,8 +14,19 @@ RSpec.describe Gitlab::LegacyGithubImport::Client, feature_category: :importers
allow(Gitlab.config.omniauth).to receive(:providers).and_return([github_provider])
end
- it 'convert OAuth2 client options to symbols' do
- expect(client.client.options.keys).to all(be_kind_of(Symbol))
+ context 'with client options' do
+ let(:client_options) do
+ {
+ 'authorize_url' => 'https://github.com/login/oauth/authorize',
+ 'token_url' => 'https://github.com/login/oauth/access_token'
+ }
+ end
+
+ it 'convert OAuth2 client options to symbols' do
+ expect(client.client.options.keys).to all(be_kind_of(Symbol))
+ expect(client.client.options[:authorize_url]).to eq(client_options['authorize_url'])
+ expect(client.client.options[:token_url]).to eq(client_options['token_url'])
+ end
end
it 'does not crash (e.g. GitlabSettings::MissingSetting) when verify_ssl config is not present' do