mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-09 12:46:07 +10:00
Fix OAuth2 issue importing a new project from GitHub and GitLab
It appears that the GitLab OAuth2 client options were converted to strings instead of symbols when merged with the default options (i.e. `{}.merge(github_options)`). As a result, the OAuth2 defaults were being used. For example, the OAuth2 client options would have a key with `authorize_url` and `:authorize_url`, but the former was never used. As a result, the OAuth2 client would always use the wrong URL to talk to GitHub.
Note that this bug should also have affected GitLab, but not Bitbucket: The OAuth client is careful to convert all keys to symbols.
Closes #1268
See merge request !425
17 lines
432 B
Ruby
17 lines
432 B
Ruby
require 'spec_helper'
|
|
|
|
describe Gitlab::GithubImport::Client do
|
|
let(:token) { '123456' }
|
|
let(:client) { Gitlab::GithubImport::Client.new(token) }
|
|
|
|
before do
|
|
Gitlab.config.omniauth.providers << OpenStruct.new(app_id: "asd123", app_secret: "asd123", name: "github")
|
|
end
|
|
|
|
it 'all OAuth2 client options are symbols' do
|
|
client.client.options.keys.each do |key|
|
|
expect(key).to be_kind_of(Symbol)
|
|
end
|
|
end
|
|
end
|