2017-06-12 16:13:22 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
feature 'No Password Alert' do
|
2017-07-24 22:51:14 +00:00
|
|
|
let(:project) { create(:project, :repository, namespace: user.namespace) }
|
2017-06-12 16:13:22 +00:00
|
|
|
|
|
|
|
context 'with internal auth enabled' do
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
2017-06-29 17:06:35 +00:00
|
|
|
visit project_path(project)
|
2017-06-12 16:13:22 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'when user has a password' do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
it 'shows no alert' do
|
|
|
|
expect(page).not_to have_content "You won't be able to pull or push project code via HTTP until you set a password on your account"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when user has password automatically set' do
|
|
|
|
let(:user) { create(:user, password_automatically_set: true) }
|
|
|
|
|
|
|
|
it 'shows a password alert' do
|
|
|
|
expect(page).to have_content "You won't be able to pull or push project code via HTTP until you set a password on your account"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with internal auth disabled' do
|
|
|
|
let(:user) { create(:omniauth_user, extern_uid: 'my-uid', provider: 'saml') }
|
|
|
|
|
|
|
|
before do
|
2017-06-27 18:02:09 +00:00
|
|
|
stub_application_setting(password_authentication_enabled?: false)
|
2017-06-12 16:13:22 +00:00
|
|
|
stub_omniauth_saml_config(enabled: true, auto_link_saml_user: true, allow_single_sign_on: ['saml'], providers: [mock_saml_config])
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when user has no personal access tokens' do
|
|
|
|
it 'has a personal access token alert' do
|
|
|
|
gitlab_sign_in_via('saml', user, 'my-uid')
|
2017-06-29 17:06:35 +00:00
|
|
|
visit project_path(project)
|
2017-06-12 16:13:22 +00:00
|
|
|
|
|
|
|
expect(page).to have_content "You won't be able to pull or push project code via HTTP until you create a personal access token on your account"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when user has a personal access token' do
|
|
|
|
it 'shows no alert' do
|
|
|
|
create(:personal_access_token, user: user)
|
|
|
|
gitlab_sign_in_via('saml', user, 'my-uid')
|
2017-06-29 17:06:35 +00:00
|
|
|
visit project_path(project)
|
2017-06-12 16:13:22 +00:00
|
|
|
|
|
|
|
expect(page).not_to have_content "You won't be able to pull or push project code via HTTP until you create a personal access token on your account"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when user is ldap user' do
|
|
|
|
let(:user) { create(:omniauth_user, password_automatically_set: true) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
2017-06-29 17:06:35 +00:00
|
|
|
visit project_path(project)
|
2017-06-12 16:13:22 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows no alert' do
|
|
|
|
expect(page).not_to have_content "You won't be able to pull or push project code via HTTP until you"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|