Commit 665b177d authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'rs-platform-feature-spec-parity' into 'master'

CE-EE parity for Platform feature specs

Closes #6499

See merge request gitlab-org/gitlab-ee!6190
parents 4efaef25 798da716
require 'spec_helper'
feature 'Login' do
before do
stub_licensed_features(extended_audit_events: true)
end
it 'creates a security event for an invalid password login' do
user = create(:user, password: 'not-the-default')
expect { gitlab_sign_in(user) }
.to change { SecurityEvent.where(entity_id: -1).count }.from(0).to(1)
end
it 'creates a security event for an invalid OAuth login' do
stub_omniauth_saml_config(
enabled: true,
auto_link_saml_user: false,
allow_single_sign_on: ['saml'],
providers: [mock_saml_config]
)
user = create(:omniauth_user, :two_factor, extern_uid: 'my-uid', provider: 'saml')
expect { gitlab_sign_in_via('saml', user, 'wrong-uid') }
.to change { SecurityEvent.where(entity_id: -1).count }.from(0).to(1)
end
end
......@@ -4,8 +4,6 @@ describe 'User visits the profile preferences page' do
let(:user) { create(:user) }
before do
stub_licensed_features(ide: true)
sign_in(user)
visit(profile_preferences_path)
......
......@@ -186,16 +186,6 @@ feature 'Login' do
enter_code(user.current_otp)
expect(current_path).to eq root_path
end
it 'creates a security event after failed OAuth login' do
stub_omniauth_saml_config(enabled: true, auto_link_saml_user: false, allow_single_sign_on: ['saml'], providers: [mock_saml_config])
stub_licensed_features(extended_audit_events: true)
user = create(:omniauth_user, :two_factor, extern_uid: 'my-uid', provider: 'saml')
gitlab_sign_in_via('saml', user, 'wrong-uid')
expect(SecurityEvent.where(entity_id: -1).count).to eq(1)
end
end
end
......@@ -213,14 +203,10 @@ feature 'Login' do
end
it 'blocks invalid login' do
stub_licensed_features(extended_audit_events: true)
user = create(:user, password: 'not-the-default')
gitlab_sign_in(user)
expect(page).to have_content('Invalid Login or password.')
expect(SecurityEvent.where(entity_id: -1).count).to eq(1)
end
end
......
......@@ -152,8 +152,13 @@ module LoginHelpers
end
def stub_saml_authorize_path_helpers
allow_any_instance_of(Object).to receive(:user_saml_omniauth_authorize_path).and_return('/users/auth/saml')
allow_any_instance_of(Object).to receive(:omniauth_authorize_path).with(:user, "saml").and_return('/users/auth/saml')
allow_any_instance_of(ActionDispatch::Routing::RoutesProxy)
.to receive(:user_saml_omniauth_authorize_path)
.and_return('/users/auth/saml')
allow(Devise::OmniAuth::UrlHelpers)
.to receive(:omniauth_authorize_path)
.with(:user, "saml")
.and_return('/users/auth/saml')
end
def stub_omniauth_config(messages)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment