token.rb 660 B

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