pgp_key.rb 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. FactoryBot.define do
  3. factory :pgp_key, aliases: [:'pgp_key/zammad@localhost'] do
  4. updated_at { Time.zone.now }
  5. updated_by_id { user.id }
  6. created_by_id { user.id }
  7. transient do
  8. fixture { 'zammad@localhost' }
  9. user { association :admin }
  10. end
  11. key { Rails.root.join("spec/fixtures/files/pgp/#{fixture}.pub.asc").read }
  12. trait :with_private do
  13. key { Rails.root.join("spec/fixtures/files/pgp/#{fixture}.asc").read }
  14. passphrase { Rails.root.join("spec/fixtures/files/pgp/#{fixture}.passphrase").read }
  15. end
  16. factory :'pgp_key/pgp1@example.com' do
  17. transient do
  18. fixture { 'pgp1@example.com' }
  19. end
  20. end
  21. factory :'pgp_key/pgp2@example.com' do
  22. transient do
  23. fixture { 'pgp2@example.com' }
  24. end
  25. end
  26. factory :'pgp_key/pgp3@example.com' do
  27. transient do
  28. fixture { 'pgp3@example.com' }
  29. end
  30. end
  31. factory :'pgp_key/multipgp2@example.com' do
  32. transient do
  33. fixture { 'multipgp2@example.com' }
  34. end
  35. end
  36. factory :'pgp_key/noexpirepgp1@example.com' do
  37. transient do
  38. fixture { 'noexpirepgp1@example.com' }
  39. end
  40. end
  41. factory :'pgp_key/pgp+smime-sender@example.com' do
  42. transient do
  43. fixture { 'pgp+smime-sender@example.com' }
  44. end
  45. end
  46. factory :'pgp_key/pgp+smime-recipient@example.com' do
  47. transient do
  48. fixture { 'pgp+smime-recipient@example.com' }
  49. end
  50. end
  51. end
  52. end