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
c8d8000a
Commit
c8d8000a
authored
Jun 07, 2016
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure OAuth routes we generate for Geo are the same in Rails routes
parent
ff0bfe78
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
2 deletions
+22
-2
config/routes.rb
config/routes.rb
+1
-1
spec/lib/gitlab/geo/oauth_session_spec.rb
spec/lib/gitlab/geo/oauth_session_spec.rb
+1
-1
spec/models/geo_node_spec.rb
spec/models/geo_node_spec.rb
+20
-0
No files found.
config/routes.rb
View file @
c8d8000a
...
...
@@ -53,7 +53,7 @@ Rails.application.routes.draw do
authorizations:
'oauth/authorizations'
end
namespace
:oauth
,
path:
'geo'
,
controller:
'geo_auth'
,
as:
'oauth_geo'
do
namespace
:oauth
,
path:
'
oauth/
geo'
,
controller:
'geo_auth'
,
as:
'oauth_geo'
do
get
'auth'
get
'callback'
get
'logout'
...
...
spec/lib/gitlab/geo/oauth_session_spec.rb
View file @
c8d8000a
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Gitlab
::
Geo
::
OauthSession
do
subject
{
described_class
.
new
}
let
(
:oauth_app
)
{
FactoryGirl
.
create
(
:doorkeeper_application
)
}
let
(
:oauth_return_to
)
{
'http://localhost:3000/oath/geo/callback'
}
let
(
:oauth_return_to
)
{
'http://localhost:3000/oa
u
th/geo/callback'
}
let
(
:dummy_state
)
{
'salt:hmac:return_to'
}
let
(
:valid_state
)
{
described_class
.
new
(
return_to:
oauth_return_to
).
generate_oauth_state
}
let
(
:access_token
)
{
FactoryGirl
.
create
(
:doorkeeper_access_token
).
token
}
...
...
spec/models/geo_node_spec.rb
View file @
c8d8000a
...
...
@@ -8,6 +8,7 @@ describe GeoNode, type: :model do
subject
(
:node
)
{
FactoryGirl
.
create
(
:geo_node
)
}
let
(
:dummy_url
)
{
'https://localhost:3000/gitlab'
}
let
(
:url_helpers
)
{
Gitlab
::
Application
.
routes
.
url_helpers
}
context
'associations'
do
it
{
is_expected
.
to
belong_to
(
:geo_node_key
).
dependent
(
:destroy
)
}
...
...
@@ -186,6 +187,25 @@ describe GeoNode, type: :model do
it
'returns oauth callback url based on node uri'
do
expect
(
new_node
.
oauth_callback_url
).
to
eq
(
oauth_callback_url
)
end
it
'returns url that matches rails url_helpers generated one'
do
route
=
url_helpers
.
oauth_geo_callback_url
(
protocol:
'https:'
,
host:
'localhost'
,
port:
3000
,
script_name:
'/gitlab'
)
expect
(
new_node
.
oauth_callback_url
).
to
eq
(
route
)
end
end
describe
'#oauth_logout_url'
do
let
(
:fake_state
)
{
URI
.
encode
(
'fakestate'
)
}
let
(
:oauth_logout_url
)
{
"https://localhost:3000/gitlab/oauth/geo/logout?state=
#{
fake_state
}
"
}
it
'returns oauth logout url based on node uri'
do
expect
(
new_node
.
oauth_logout_url
(
fake_state
)).
to
eq
(
oauth_logout_url
)
end
it
'returns url that matches rails url_helpers generated one'
do
route
=
url_helpers
.
oauth_geo_logout_url
(
protocol:
'https:'
,
host:
'localhost'
,
port:
3000
,
script_name:
'/gitlab'
,
state:
fake_state
)
expect
(
new_node
.
oauth_logout_url
(
fake_state
)).
to
eq
(
route
)
end
end
describe
'#missing_oauth_application?'
do
...
...
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