2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
FactoryBot.define do
|
|
|
|
factory :deploy_token do
|
2019-12-21 20:55:43 +05:30
|
|
|
token { nil }
|
|
|
|
token_encrypted { Gitlab::CryptoHelper.aes256_gcm_encrypt(SecureRandom.hex(50)) }
|
2018-05-09 12:01:36 +05:30
|
|
|
sequence(:name) { |n| "PDT #{n}" }
|
2019-12-21 20:55:43 +05:30
|
|
|
read_repository { true }
|
|
|
|
read_registry { true }
|
|
|
|
revoked { false }
|
2018-05-09 12:01:36 +05:30
|
|
|
expires_at { 5.days.from_now }
|
2020-03-09 13:42:32 +05:30
|
|
|
deploy_token_type { DeployToken.deploy_token_types[:project_type] }
|
2018-05-09 12:01:36 +05:30
|
|
|
|
|
|
|
trait :revoked do
|
2019-12-21 20:55:43 +05:30
|
|
|
revoked { true }
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|
2018-10-15 14:42:47 +05:30
|
|
|
|
|
|
|
trait :gitlab_deploy_token do
|
2019-12-21 20:55:43 +05:30
|
|
|
name { DeployToken::GITLAB_DEPLOY_TOKEN_NAME }
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
trait :expired do
|
|
|
|
expires_at { Date.today - 1.month }
|
|
|
|
end
|
2020-03-09 13:42:32 +05:30
|
|
|
|
|
|
|
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-05-09 12:01:36 +05:30
|
|
|
end
|
|
|
|
end
|