Commit 0871d6c2 authored by peterhegman's avatar peterhegman

Add specs for admin 2FA badge visibility

parent c882d163
......@@ -49,6 +49,7 @@ RSpec.describe 'Groups > Members > List members', :js do
end
describe 'when user has 2FA enabled' do
let_it_be(:admin) { create(:admin) }
let_it_be(:user_with_2fa) { create(:user, :two_factor_via_otp) }
before do
......@@ -63,6 +64,15 @@ RSpec.describe 'Groups > Members > List members', :js do
expect(find_member_row(user_with_2fa)).to have_content('2FA')
end
it 'shows 2FA badge to admins' do
sign_in(admin)
gitlab_enable_admin_mode_sign_in(admin)
visit group_group_members_path(group)
expect(find_member_row(user_with_2fa)).to have_content('2FA')
end
it 'does not show 2FA badge to users with access level below "Owner"' do
group.add_maintainer(user1)
......
......@@ -8,7 +8,7 @@ RSpec.describe 'Project members list' do
let(:user1) { create(:user, name: 'John Doe') }
let(:user2) { create(:user, name: 'Mary Jane') }
let(:group) { create(:group) }
let(:project) { create(:project, namespace: group) }
let(:project) { create(:project, :internal, namespace: group) }
before do
stub_feature_flags(invite_members_group_modal: false)
......@@ -119,6 +119,7 @@ RSpec.describe 'Project members list' do
end
describe 'when user has 2FA enabled' do
let_it_be(:admin) { create(:admin) }
let_it_be(:user_with_2fa) { create(:user, :two_factor_via_otp) }
before do
......@@ -133,6 +134,15 @@ RSpec.describe 'Project members list' do
expect(find_member_row(user_with_2fa)).to have_content('2FA')
end
it 'shows 2FA badge to admins' do
sign_in(admin)
gitlab_enable_admin_mode_sign_in(admin)
visit_members_page
expect(find_member_row(user_with_2fa)).to have_content('2FA')
end
it 'does not show 2FA badge to users with access level below "Maintainer"' do
group.add_developer(user1)
......
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