token.rb 698 B

123456789101112131415161718192021222324252627282930313233
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. FactoryBot.define do
  3. factory :token, aliases: %i[token_api api_token] do
  4. user
  5. name { Faker::Lorem.unique.word }
  6. action { 'api' }
  7. persistent { true }
  8. preferences do
  9. permission_hash = permissions.index_with do |_permission|
  10. true
  11. end
  12. {
  13. permission: permission_hash
  14. }
  15. end
  16. transient do
  17. permissions { [] }
  18. end
  19. factory :token_password_reset, aliases: %i[password_reset_token] do
  20. action { 'PasswordReset' }
  21. end
  22. factory :token_ical, aliases: %i[ical_token] do
  23. action { 'iCal' }
  24. persistent { true }
  25. end
  26. end
  27. end