diff options
author | Rémy Coutable <remy@rymai.me> | 2017-06-27 13:29:45 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-06-27 13:29:45 +0300 |
commit | 6a2186c7e4d94a6d85573dd207be615a4a4d1b04 (patch) | |
tree | 984284f01148ae3cfd948fb79081b2f392639c79 /spec/support | |
parent | 7e9a52d05bf3378c5bb730fd54b4da4db1e705be (diff) | |
parent | 7eb26c7ff7a78df9cb8fe5b30d48c80ce4eb8a99 (diff) |
Merge branch 'pat-alert-when-signin-disabled' into 'master'
Provide hint to create a personal access token for Git over HTTP
See merge request !12105
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/login_helpers.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/support/login_helpers.rb b/spec/support/login_helpers.rb index 879386b5437..4c88958264b 100644 --- a/spec/support/login_helpers.rb +++ b/spec/support/login_helpers.rb @@ -89,4 +89,25 @@ module LoginHelpers }) Rails.application.env_config['omniauth.auth'] = OmniAuth.config.mock_auth[:saml] end + + def mock_saml_config + OpenStruct.new(name: 'saml', label: 'saml', args: { + assertion_consumer_service_url: 'https://localhost:3443/users/auth/saml/callback', + idp_cert_fingerprint: '26:43:2C:47:AF:F0:6B:D0:07:9C:AD:A3:74:FE:5D:94:5F:4E:9E:52', + idp_sso_target_url: 'https://idp.example.com/sso/saml', + issuer: 'https://localhost:3443/', + name_identifier_format: 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient' + }) + end + + def stub_omniauth_saml_config(messages) + Rails.application.env_config['devise.mapping'] = Devise.mappings[:user] + Rails.application.routes.disable_clear_and_finalize = true + Rails.application.routes.draw do + post '/users/auth/saml' => 'omniauth_callbacks#saml' + end + allow(Gitlab::OAuth::Provider).to receive_messages(providers: [:saml], config_for: mock_saml_config) + stub_omniauth_setting(messages) + expect_any_instance_of(Object).to receive(:omniauth_authorize_path).with(:user, "saml").and_return('/users/auth/saml') + end end |