2019-07-25 05:11:48 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-19 16:11:12 +00:00
|
|
|
FactoryBot.define do
|
|
|
|
factory :deploy_token do
|
2019-10-02 00:06:26 +00:00
|
|
|
token { nil }
|
|
|
|
token_encrypted { Gitlab::CryptoHelper.aes256_gcm_encrypt(SecureRandom.hex(50)) }
|
2018-03-19 16:11:12 +00:00
|
|
|
sequence(:name) { |n| "PDT #{n}" }
|
2019-10-02 00:06:26 +00:00
|
|
|
read_repository { true }
|
|
|
|
read_registry { true }
|
2020-04-14 00:09:57 +00:00
|
|
|
write_registry { false }
|
2019-10-02 00:06:26 +00:00
|
|
|
revoked { false }
|
2018-03-19 16:11:12 +00:00
|
|
|
expires_at { 5.days.from_now }
|
2020-02-06 12:10:29 +00:00
|
|
|
deploy_token_type { DeployToken.deploy_token_types[:project_type] }
|
2018-03-19 16:11:12 +00:00
|
|
|
|
|
|
|
trait :revoked do
|
2019-10-02 00:06:26 +00:00
|
|
|
revoked { true }
|
2018-03-19 16:11:12 +00:00
|
|
|
end
|
2018-04-16 20:47:35 +00:00
|
|
|
|
|
|
|
trait :gitlab_deploy_token do
|
2019-10-02 00:06:26 +00:00
|
|
|
name { DeployToken::GITLAB_DEPLOY_TOKEN_NAME }
|
2018-04-16 20:47:35 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :expired do
|
|
|
|
expires_at { Date.today - 1.month }
|
|
|
|
end
|
2020-02-06 12:10:29 +00:00
|
|
|
|
|
|
|
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
|
2018-03-19 16:11:12 +00:00
|
|
|
end
|
|
|
|
end
|