blob: 657915f99763639d34dc42f1ab2b2bfb82f95004 (
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
|
# frozen_string_literal: true
FactoryBot.define do
factory :deploy_token do
token { nil }
token_encrypted { Gitlab::CryptoHelper.aes256_gcm_encrypt(SecureRandom.hex(50)) }
sequence(:name) { |n| "PDT #{n}" }
read_repository { true }
read_registry { true }
write_registry { false }
revoked { false }
expires_at { 5.days.from_now }
deploy_token_type { DeployToken.deploy_token_types[:project_type] }
trait :revoked do
revoked { true }
end
trait :gitlab_deploy_token do
name { DeployToken::GITLAB_DEPLOY_TOKEN_NAME }
end
trait :expired do
expires_at { Date.today - 1.month }
end
trait :group do
deploy_token_type { DeployToken.deploy_token_types[:group_type] }
end
trait :project do
deploy_token_type { DeployToken.deploy_token_types[:project_type] }
end
end
end
|