2019-07-25 01:11:48 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-12-13 19:13:44 -05:00
|
|
|
FactoryBot.define do
|
2016-04-18 06:18:54 -04:00
|
|
|
factory :personal_access_token do
|
|
|
|
user
|
2017-03-23 09:08:39 -04:00
|
|
|
sequence(:name) { |n| "PAT #{n}" }
|
2019-10-01 20:06:26 -04:00
|
|
|
revoked { false }
|
2016-04-18 06:18:54 -04:00
|
|
|
expires_at { 5.days.from_now }
|
2019-10-01 20:06:26 -04:00
|
|
|
scopes { ['api'] }
|
|
|
|
impersonation { false }
|
2016-12-27 11:26:57 -05:00
|
|
|
|
2019-02-20 06:39:37 -05:00
|
|
|
after(:build) { |personal_access_token| personal_access_token.ensure_token }
|
|
|
|
|
2017-03-01 11:59:03 -05:00
|
|
|
trait :impersonation do
|
2019-10-01 20:06:26 -04:00
|
|
|
impersonation { true }
|
2017-03-01 11:59:03 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :revoked do
|
2019-10-01 20:06:26 -04:00
|
|
|
revoked { true }
|
2016-12-27 11:26:57 -05:00
|
|
|
end
|
|
|
|
|
2017-03-01 11:59:03 -05:00
|
|
|
trait :expired do
|
2016-12-27 11:26:57 -05:00
|
|
|
expires_at { 1.day.ago }
|
|
|
|
end
|
2016-12-28 11:19:08 -05:00
|
|
|
|
2017-03-01 11:59:03 -05:00
|
|
|
trait :invalid do
|
2019-10-01 20:06:26 -04:00
|
|
|
token_digest { nil }
|
2016-12-28 11:19:08 -05:00
|
|
|
end
|
2016-04-18 06:18:54 -04:00
|
|
|
end
|
|
|
|
end
|