diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-16 15:07:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-16 15:07:11 +0300 |
commit | d87800c3cfa21bde64704542d61a587c5ff4306e (patch) | |
tree | 4921659e458ef0b21a637ba68a2765c93e4f20b7 /spec/controllers | |
parent | 8ae36d93f1a63874b584f0488fde88c1fee999c4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/omniauth_callbacks_controller_spec.rb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/spec/controllers/omniauth_callbacks_controller_spec.rb b/spec/controllers/omniauth_callbacks_controller_spec.rb index 0f470d9344a..75bdad8b19e 100644 --- a/spec/controllers/omniauth_callbacks_controller_spec.rb +++ b/spec/controllers/omniauth_callbacks_controller_spec.rb @@ -513,7 +513,6 @@ RSpec.describe OmniauthCallbacksController, type: :controller, feature_category: it 'denies login if sign up is enabled, but block_auto_created_users is set' do post :saml, params: { SAMLResponse: mock_saml_response } - expect(flash[:alert]).to start_with 'Your account is pending approval' end @@ -608,6 +607,25 @@ RSpec.describe OmniauthCallbacksController, type: :controller, feature_category: it { expect { post_action }.not_to raise_error } end + + context 'with a non default SAML provider' do + let(:user) { create(:omniauth_user, extern_uid: 'my-uid', provider: 'saml') } + + controller(described_class) do + alias_method :saml_okta, :handle_omniauth + end + + before do + allow(AuthHelper).to receive(:saml_providers).and_return([:saml, :saml_okta]) + allow(@routes).to receive(:generate_extras).and_return(['/users/auth/saml_okta/callback', []]) + end + + it 'authenticate with SAML module' do + expect(@controller).to receive(:omniauth_flow).with(Gitlab::Auth::Saml).and_call_original + post :saml_okta, params: { SAMLResponse: mock_saml_response } + expect(request.env['warden']).to be_authenticated + end + end end describe 'enable admin mode' do |