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
da04a906
Commit
da04a906
authored
Mar 27, 2019
by
Michael Kozono
Committed by
Douglas Barbosa Alexandre
Mar 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Geo: Persist OAuth callback changes for Alternate URL
parent
14af3ecf
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
2 deletions
+52
-2
ee/app/models/geo_node.rb
ee/app/models/geo_node.rb
+1
-1
ee/changelogs/unreleased/mk-geo-node-autosave-oauth-application.yml
...ogs/unreleased/mk-geo-node-autosave-oauth-application.yml
+5
-0
ee/spec/models/geo_node_spec.rb
ee/spec/models/geo_node_spec.rb
+46
-1
No files found.
ee/app/models/geo_node.rb
View file @
da04a906
...
@@ -9,7 +9,7 @@ class GeoNode < ActiveRecord::Base
...
@@ -9,7 +9,7 @@ class GeoNode < ActiveRecord::Base
# Array of repository storages to synchronize for selective sync by shards
# Array of repository storages to synchronize for selective sync by shards
serialize
:selective_sync_shards
,
Array
# rubocop:disable Cop/ActiveRecordSerialize
serialize
:selective_sync_shards
,
Array
# rubocop:disable Cop/ActiveRecordSerialize
belongs_to
:oauth_application
,
class_name:
'Doorkeeper::Application'
,
dependent: :destroy
# rubocop: disable Cop/ActiveRecordDependent
belongs_to
:oauth_application
,
class_name:
'Doorkeeper::Application'
,
dependent: :destroy
,
autosave:
true
# rubocop: disable Cop/ActiveRecordDependent
has_many
:geo_node_namespace_links
has_many
:geo_node_namespace_links
has_many
:namespaces
,
through: :geo_node_namespace_links
has_many
:namespaces
,
through: :geo_node_namespace_links
...
...
ee/changelogs/unreleased/mk-geo-node-autosave-oauth-application.yml
0 → 100644
View file @
da04a906
---
title
:
'
Geo:
Persist
OAuth
callback
changes
for
Alternate
URL'
merge_request
:
10358
author
:
type
:
fixed
ee/spec/models/geo_node_spec.rb
View file @
da04a906
...
@@ -16,7 +16,7 @@ describe GeoNode, type: :model do
...
@@ -16,7 +16,7 @@ describe GeoNode, type: :model do
let
(
:api_version
)
{
API
::
API
.
version
}
let
(
:api_version
)
{
API
::
API
.
version
}
context
'associations'
do
context
'associations'
do
it
{
is_expected
.
to
belong_to
(
:oauth_application
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
belong_to
(
:oauth_application
).
class_name
(
'Doorkeeper::Application'
).
dependent
(
:destroy
).
autosave
(
true
)
}
it
{
is_expected
.
to
have_many
(
:geo_node_namespace_links
)
}
it
{
is_expected
.
to
have_many
(
:geo_node_namespace_links
)
}
it
{
is_expected
.
to
have_many
(
:namespaces
).
through
(
:geo_node_namespace_links
)
}
it
{
is_expected
.
to
have_many
(
:namespaces
).
through
(
:geo_node_namespace_links
)
}
...
@@ -196,6 +196,51 @@ describe GeoNode, type: :model do
...
@@ -196,6 +196,51 @@ describe GeoNode, type: :model do
end
end
end
end
end
end
context
'when saving'
do
let
(
:oauth_application
)
{
node
.
oauth_application
}
context
'when url is changed'
do
it
"updates the associated OAuth application's redirect_uri"
do
node
.
update!
(
url:
'http://modified-url'
)
expect
(
oauth_application
.
reload
.
redirect_uri
).
to
eq
(
'http://modified-url/oauth/geo/callback'
)
end
end
context
'when alternate_url is added'
do
it
"adds a callback URL to the associated OAuth application's redirect_uri"
do
expected_redirect_uri
=
"
#{
oauth_application
.
redirect_uri
}
\n
http://alternate-url/oauth/geo/callback"
node
.
update!
(
alternate_url:
'http://alternate-url'
)
expect
(
oauth_application
.
reload
.
redirect_uri
).
to
eq
(
expected_redirect_uri
)
end
end
context
'when alternate_url is modified'
do
it
"updates the alternate callback URL in the associated OAuth application's redirect_uri"
do
node
.
update!
(
alternate_url:
'http://alternate-url'
)
oauth_application
.
update!
(
redirect_uri:
"
#{
node
.
oauth_callback_url
}
\n
http://alternate-url/oauth/geo/callback"
)
expected_redirect_uri
=
"
#{
node
.
oauth_callback_url
}
\n
http://modified-alternate-url/oauth/geo/callback"
node
.
update!
(
alternate_url:
'http://modified-alternate-url'
)
expect
(
oauth_application
.
reload
.
redirect_uri
).
to
eq
(
expected_redirect_uri
)
end
end
context
'when alternate_url is cleared'
do
it
"removes the alternate callback URL in the associated OAuth application's redirect_uri"
do
expected_redirect_uri
=
oauth_application
.
redirect_uri
oauth_application
.
update!
(
redirect_uri:
"
#{
node
.
oauth_callback_url
}
\n
http://alternate-url/oauth/geo/callback"
)
node
.
update!
(
alternate_url:
nil
)
expect
(
oauth_application
.
reload
.
redirect_uri
).
to
eq
(
expected_redirect_uri
)
end
end
end
end
end
context
'cache expiration'
do
context
'cache expiration'
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