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
c06cc70a
Commit
c06cc70a
authored
Apr 23, 2019
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert Rails.application.env_config after using mock_auth_hash
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
24c9c458
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
3 deletions
+18
-3
ee/spec/controllers/groups/omniauth_callbacks_controller_spec.rb
.../controllers/groups/omniauth_callbacks_controller_spec.rb
+5
-1
spec/controllers/omniauth_callbacks_controller_spec.rb
spec/controllers/omniauth_callbacks_controller_spec.rb
+5
-1
spec/support/controllers/ldap_omniauth_callbacks_controller_shared_context.rb
...lers/ldap_omniauth_callbacks_controller_shared_context.rb
+5
-1
spec/support/helpers/login_helpers.rb
spec/support/helpers/login_helpers.rb
+3
-0
No files found.
ee/spec/controllers/groups/omniauth_callbacks_controller_spec.rb
View file @
c06cc70a
...
...
@@ -41,11 +41,15 @@ describe Groups::OmniauthCallbacksController do
context
"valid credentials"
do
before
do
mock_auth_hash
(
provider
,
uid
,
user
.
email
,
response_object:
saml_response
)
@original_env_config_omniauth_auth
=
mock_auth_hash
(
provider
,
uid
,
user
.
email
,
response_object:
saml_response
)
stub_omniauth_provider
(
provider
,
context:
request
)
stub_last_request_id
(
last_request_id
)
end
after
do
Rails
.
application
.
env_config
[
'omniauth.auth'
]
=
@original_env_config_omniauth_auth
end
shared_examples
"and identity already linked"
do
let!
(
:user
)
{
create_linked_user
}
...
...
spec/controllers/omniauth_callbacks_controller_spec.rb
View file @
c06cc70a
...
...
@@ -9,10 +9,14 @@ describe OmniauthCallbacksController, type: :controller do
let
(
:user
)
{
create
(
:omniauth_user
,
extern_uid:
extern_uid
,
provider:
provider
)
}
before
do
mock_auth_hash
(
provider
.
to_s
,
+
extern_uid
,
user
.
email
)
@original_env_config_omniauth_auth
=
mock_auth_hash
(
provider
.
to_s
,
+
extern_uid
,
user
.
email
)
stub_omniauth_provider
(
provider
,
context:
request
)
end
after
do
Rails
.
application
.
env_config
[
'omniauth.auth'
]
=
@original_env_config_omniauth_auth
end
context
'when the user is on the last sign in attempt'
do
let
(
:extern_uid
)
{
'my-uid'
}
...
...
spec/support/controllers/ldap_omniauth_callbacks_controller_shared_context.rb
View file @
c06cc70a
...
...
@@ -25,9 +25,13 @@ shared_context 'Ldap::OmniauthCallbacksController' do
described_class
.
define_providers!
Rails
.
application
.
reload_routes!
mock_auth_hash
(
provider
.
to_s
,
uid
,
user
.
email
)
@original_env_config_omniauth_auth
=
mock_auth_hash
(
provider
.
to_s
,
uid
,
user
.
email
)
stub_omniauth_provider
(
provider
,
context:
request
)
allow
(
Gitlab
::
Auth
::
LDAP
::
Access
).
to
receive
(
:allowed?
).
and_return
(
valid_login?
)
end
after
do
Rails
.
application
.
env_config
[
'omniauth.auth'
]
=
@original_env_config_omniauth_auth
end
end
spec/support/helpers/login_helpers.rb
View file @
c06cc70a
...
...
@@ -118,7 +118,10 @@ module LoginHelpers
response_object:
response_object
}
})
original_env_config_omniauth_auth
=
Rails
.
application
.
env_config
[
'omniauth.auth'
]
Rails
.
application
.
env_config
[
'omniauth.auth'
]
=
OmniAuth
.
config
.
mock_auth
[
provider
.
to_sym
]
original_env_config_omniauth_auth
end
def
saml_xml
(
raw_saml_response
)
...
...
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