debian-mirror-gitlab/spec/features/groups/settings/access_tokens_spec.rb

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

54 lines
1.5 KiB
Ruby
Raw Normal View History

2022-03-02 08:16:31 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Group > Settings > Access Tokens', :js do
let_it_be(:user) { create(:user) }
let_it_be(:bot_user) { create(:user, :project_bot) }
let_it_be(:group) { create(:group) }
let_it_be(:resource_settings_access_tokens_path) { group_settings_access_tokens_path(group) }
before_all do
group.add_owner(user)
end
before do
stub_feature_flags(bootstrap_confirmation_modals: false)
sign_in(user)
end
def create_resource_access_token
group.add_maintainer(bot_user)
create(:personal_access_token, user: bot_user)
end
context 'when user is not a group owner' do
before do
group.add_maintainer(user)
end
it_behaves_like 'resource access tokens missing access rights'
end
describe 'token creation' do
it_behaves_like 'resource access tokens creation', 'group'
context 'when token creation is not allowed' do
it_behaves_like 'resource access tokens creation disallowed', 'Group access token creation is disabled in this group. You can still use and manage existing tokens.'
end
end
describe 'active tokens' do
let!(:resource_access_token) { create_resource_access_token }
it_behaves_like 'active resource access tokens'
end
describe 'inactive tokens' do
let!(:resource_access_token) { create_resource_access_token }
it_behaves_like 'inactive resource access tokens', 'This group has no active access tokens.'
end
end