diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-18 23:02:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-18 23:02:30 +0300 |
commit | 41fe97390ceddf945f3d967b8fdb3de4c66b7dea (patch) | |
tree | 9c8d89a8624828992f06d892cd2f43818ff5dcc8 /spec/finders/personal_access_tokens_finder_spec.rb | |
parent | 0804d2dc31052fb45a1efecedc8e06ce9bc32862 (diff) |
Add latest changes from gitlab-org/gitlab@14-9-stable-eev14.9.0-rc42
Diffstat (limited to 'spec/finders/personal_access_tokens_finder_spec.rb')
-rw-r--r-- | spec/finders/personal_access_tokens_finder_spec.rb | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/spec/finders/personal_access_tokens_finder_spec.rb b/spec/finders/personal_access_tokens_finder_spec.rb index cece80047e1..7607d08dc64 100644 --- a/spec/finders/personal_access_tokens_finder_spec.rb +++ b/spec/finders/personal_access_tokens_finder_spec.rb @@ -17,6 +17,9 @@ RSpec.describe PersonalAccessTokensFinder do let!(:active_impersonation_token) { create(:personal_access_token, :impersonation, user: user) } let!(:expired_impersonation_token) { create(:personal_access_token, :expired, :impersonation, user: user) } let!(:revoked_impersonation_token) { create(:personal_access_token, :revoked, :impersonation, user: user) } + let!(:project_bot) { create(:user, :project_bot) } + let!(:project_member) { create(:project_member, user: project_bot) } + let!(:project_access_token) { create(:personal_access_token, user: project_bot) } subject { finder(params, current_user).execute } @@ -44,7 +47,7 @@ RSpec.describe PersonalAccessTokensFinder do it do is_expected.to contain_exactly(active_personal_access_token, active_impersonation_token, revoked_personal_access_token, expired_personal_access_token, - revoked_impersonation_token, expired_impersonation_token) + revoked_impersonation_token, expired_impersonation_token, project_access_token) end context 'when current_user is not an administrator' do @@ -59,7 +62,7 @@ RSpec.describe PersonalAccessTokensFinder do it do is_expected.to contain_exactly(active_personal_access_token, active_impersonation_token, revoked_personal_access_token, expired_personal_access_token, - revoked_impersonation_token, expired_impersonation_token) + revoked_impersonation_token, expired_impersonation_token, project_access_token) end describe 'with users' do @@ -98,14 +101,14 @@ RSpec.describe PersonalAccessTokensFinder do params[:impersonation] = false end - it { is_expected.to contain_exactly(active_personal_access_token, revoked_personal_access_token, expired_personal_access_token) } + it { is_expected.to contain_exactly(active_personal_access_token, revoked_personal_access_token, expired_personal_access_token, project_access_token) } describe 'with active state' do before do params[:state] = 'active' end - it { is_expected.to contain_exactly(active_personal_access_token) } + it { is_expected.to contain_exactly(active_personal_access_token, project_access_token) } end describe 'with inactive state' do @@ -146,7 +149,7 @@ RSpec.describe PersonalAccessTokensFinder do params[:state] = 'active' end - it { is_expected.to contain_exactly(active_personal_access_token, active_impersonation_token) } + it { is_expected.to contain_exactly(active_personal_access_token, active_impersonation_token, project_access_token) } end describe 'with inactive state' do @@ -208,6 +211,14 @@ RSpec.describe PersonalAccessTokensFinder do revoked_impersonation_token, expired_impersonation_token) end + describe 'filtering human tokens' do + before do + params[:owner_type] = 'human' + end + + it { is_expected.not_to include(project_access_token) } + end + describe 'without impersonation' do before do params[:impersonation] = false |