blob: 1bee3be1ddba8e565e61eae45007fc807a28a26b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Group > Settings > Access Tokens', :js, feature_category: :authentication_and_authorization do
include Spec::Support::Helpers::ModalHelpers
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
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
|