Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
7e1f86ed
Commit
7e1f86ed
authored
Feb 24, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix importing projects from GitHub Enterprise Edition
parent
b9440a94
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
5 deletions
+26
-5
CHANGELOG-EE
CHANGELOG-EE
+3
-0
lib/gitlab/github_import/client.rb
lib/gitlab/github_import/client.rb
+2
-2
spec/lib/gitlab/github_import/client_spec.rb
spec/lib/gitlab/github_import/client_spec.rb
+21
-3
No files found.
CHANGELOG-EE
View file @
7e1f86ed
Please view this file on the master branch, on stable branches it's out of date.
v 8.5.2
- Fix importing projects from GitHub Enterprise Edition.
v 8.5.1
- Fix adding pages domain to projects in groups
...
...
lib/gitlab/github_import/client.rb
View file @
7e1f86ed
...
...
@@ -42,11 +42,11 @@ module Gitlab
private
def
config
Gitlab
.
config
.
omniauth
.
providers
.
find
{
|
provider
|
provider
.
name
==
"github"
}
Gitlab
.
config
.
omniauth
.
providers
.
find
{
|
provider
|
provider
.
name
==
"github"
}
end
def
github_options
OmniAuth
::
Strategies
::
GitHub
.
default_options
[
:client_options
].
to_h
.
symbolize_keys
config
[
"args"
][
"client_options"
].
deep_
symbolize_keys
end
end
end
...
...
spec/lib/gitlab/github_import/client_spec.rb
View file @
7e1f86ed
...
...
@@ -2,16 +2,34 @@ require 'spec_helper'
describe
Gitlab
::
GithubImport
::
Client
,
lib:
true
do
let
(
:token
)
{
'123456'
}
let
(
:client
)
{
Gitlab
::
GithubImport
::
Client
.
new
(
token
)
}
let
(
:github_provider
)
{
OpenStruct
.
new
(
app_id:
'asd123'
,
app_secret:
'asd123'
,
name:
'github'
,
args:
{
'client_options'
=>
{}
})
}
subject
(
:client
)
{
described_class
.
new
(
token
)
}
before
do
github_provider
=
OpenStruct
.
new
(
app_id:
"asd123"
,
app_secret:
"asd123"
,
name:
"github"
,
args:
{
"client_options"
=>
{}
})
allow
(
Gitlab
.
config
.
omniauth
).
to
receive
(
:providers
).
and_return
([
github_provider
])
end
it
'
all OAuth2 client options are
symbols'
do
it
'
convert OAuth2 client options to
symbols'
do
client
.
client
.
options
.
keys
.
each
do
|
key
|
expect
(
key
).
to
be_kind_of
(
Symbol
)
end
end
context
'when provider does not specity an API endpoint'
do
it
'uses GitHub root API endpoint'
do
expect
(
client
.
api
.
api_endpoint
).
to
eq
'https://api.github.com/'
end
end
context
'when provider specify a custom API endpoint'
do
before
do
github_provider
[
'args'
][
'client_options'
][
'site'
]
=
'https://github.company.com/'
end
it
'uses the custom API endpoint'
do
expect
(
OmniAuth
::
Strategies
::
GitHub
).
not_to
receive
(
:default_options
)
expect
(
client
.
api
.
api_endpoint
).
to
eq
'https://github.company.com/'
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment