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
3270644f
Commit
3270644f
authored
Mar 05, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix-importing-projects-ghe'
parents
4d3896eb
7e1f86ed
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
5 deletions
+25
-5
CHANGELOG-EE
CHANGELOG-EE
+2
-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 @
3270644f
...
@@ -18,6 +18,8 @@ v 8.5.3
...
@@ -18,6 +18,8 @@ v 8.5.3
v 8.5.2
v 8.5.2
- Update LDAP groups asynchronously
- Update LDAP groups asynchronously
- Fix an issue when weight text was displayed in Issuable collapsed sidebar
- Fix an issue when weight text was displayed in Issuable collapsed sidebar
v 8.5.2
- Fix importing projects from GitHub Enterprise Edition.
v 8.5.1
v 8.5.1
- Fix adding pages domain to projects in groups
- Fix adding pages domain to projects in groups
...
...
lib/gitlab/github_import/client.rb
View file @
3270644f
...
@@ -42,11 +42,11 @@ module Gitlab
...
@@ -42,11 +42,11 @@ module Gitlab
private
private
def
config
def
config
Gitlab
.
config
.
omniauth
.
providers
.
find
{
|
provider
|
provider
.
name
==
"github"
}
Gitlab
.
config
.
omniauth
.
providers
.
find
{
|
provider
|
provider
.
name
==
"github"
}
end
end
def
github_options
def
github_options
OmniAuth
::
Strategies
::
GitHub
.
default_options
[
:client_options
].
to_h
.
symbolize_keys
config
[
"args"
][
"client_options"
].
deep_
symbolize_keys
end
end
end
end
end
end
...
...
spec/lib/gitlab/github_import/client_spec.rb
View file @
3270644f
...
@@ -2,16 +2,34 @@ require 'spec_helper'
...
@@ -2,16 +2,34 @@ require 'spec_helper'
describe
Gitlab
::
GithubImport
::
Client
,
lib:
true
do
describe
Gitlab
::
GithubImport
::
Client
,
lib:
true
do
let
(
:token
)
{
'123456'
}
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
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
])
allow
(
Gitlab
.
config
.
omniauth
).
to
receive
(
:providers
).
and_return
([
github_provider
])
end
end
it
'
all OAuth2 client options are
symbols'
do
it
'
convert OAuth2 client options to
symbols'
do
client
.
client
.
options
.
keys
.
each
do
|
key
|
client
.
client
.
options
.
keys
.
each
do
|
key
|
expect
(
key
).
to
be_kind_of
(
Symbol
)
expect
(
key
).
to
be_kind_of
(
Symbol
)
end
end
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
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