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
|
|
|
|
token { SecureRandom.hex(50) }
|
2017-03-23 09:08:39 -04:00
|
|
|
sequence(:name) { |n| "PAT #{n}" }
|
2016-04-18 06:18:54 -04:00
|
|
|
revoked false
|
|
|
|
expires_at { 5.days.from_now }
|
2016-11-22 03:53:53 -05:00
|
|
|
scopes ['api']
|
2016-12-28 11:19:08 -05:00
|
|
|
impersonation false
|
2016-12-27 11:26:57 -05:00
|
|
|
|
2017-03-01 11:59:03 -05:00
|
|
|
trait :impersonation do
|
|
|
|
impersonation true
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :revoked do
|
2016-12-27 11:26:57 -05:00
|
|
|
revoked true
|
|
|
|
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
|
|
|
|
token nil
|
2016-12-28 11:19:08 -05:00
|
|
|
end
|
2016-04-18 06:18:54 -04:00
|
|
|
end
|
|
|
|
end
|