debian-mirror-gitlab/spec/features/admin/admin_disables_two_factor_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
934 B
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2019-12-04 20:38:33 +05:30
require 'spec_helper'
2015-09-11 14:41:01 +05:30
2020-06-23 00:09:42 +05:30
RSpec.describe 'Admin disables 2FA for a user' do
2018-11-08 19:23:39 +05:30
it 'successfully', :js do
2021-12-11 22:18:48 +05:30
stub_feature_flags(bootstrap_confirmation_modals: false)
2021-02-22 17:27:13 +05:30
admin = create(:admin)
sign_in(admin)
gitlab_enable_admin_mode_sign_in(admin)
2015-09-11 14:41:01 +05:30
user = create(:user, :two_factor)
edit_user(user)
page.within('.two-factor-status') do
2018-03-17 18:26:18 +05:30
accept_confirm { click_link 'Disable' }
2015-09-11 14:41:01 +05:30
end
page.within('.two-factor-status') do
expect(page).to have_content 'Disabled'
expect(page).not_to have_button 'Disable'
end
end
2018-11-08 19:23:39 +05:30
it 'for a user without 2FA enabled' do
2021-02-22 17:27:13 +05:30
admin = create(:admin)
sign_in(admin)
gitlab_enable_admin_mode_sign_in(admin)
2015-09-11 14:41:01 +05:30
user = create(:user)
edit_user(user)
page.within('.two-factor-status') do
expect(page).not_to have_button 'Disable'
end
end
def edit_user(user)
visit admin_user_path(user)
end
end