logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/

test.exs (6187B)


  1. import Config
  2. # We don't run a server during test. If one is required,
  3. # you can enable the server option below.
  4. config :pleroma, Pleroma.Web.Endpoint,
  5. http: [port: 4001],
  6. url: [port: 4001],
  7. server: true
  8. # Disable captha for tests
  9. config :pleroma, Pleroma.Captcha,
  10. # It should not be enabled for automatic tests
  11. enabled: false,
  12. # A fake captcha service for tests
  13. method: Pleroma.Captcha.Mock
  14. # Print only warnings and errors during test
  15. config :logger, :console,
  16. level: :warning,
  17. format: "\n[$level] $message\n"
  18. config :pleroma, :auth, oauth_consumer_strategies: []
  19. config :pleroma, Pleroma.Upload,
  20. filters: [],
  21. link_name: false,
  22. default_description: :filename
  23. config :pleroma, Pleroma.Uploaders.Local, uploads: "test/uploads"
  24. config :pleroma, Pleroma.Emails.Mailer, adapter: Swoosh.Adapters.Test, enabled: true
  25. config :pleroma, :instance,
  26. email: "admin@example.com",
  27. notify_email: "noreply@example.com",
  28. skip_thread_containment: false,
  29. federating: false,
  30. external_user_synchronization: false,
  31. static_dir: "test/instance_static/"
  32. config :pleroma, :activitypub, sign_object_fetches: false, follow_handshake_timeout: 0
  33. # Configure your database
  34. config :pleroma, Pleroma.Repo,
  35. adapter: Ecto.Adapters.Postgres,
  36. username: "postgres",
  37. password: "postgres",
  38. database: "pleroma_test",
  39. hostname: System.get_env("DB_HOST") || "localhost",
  40. port: System.get_env("DB_PORT") || "5432",
  41. pool: Ecto.Adapters.SQL.Sandbox,
  42. pool_size: System.schedulers_online() * 2,
  43. log: false
  44. config :pleroma, :dangerzone, override_repo_pool_size: true
  45. # Reduce hash rounds for testing
  46. config :pleroma, :password, iterations: 1
  47. config :tesla, adapter: Tesla.Mock
  48. config :pleroma, :rich_media,
  49. enabled: false,
  50. ignore_hosts: [],
  51. ignore_tld: ["local", "localdomain", "lan"],
  52. max_body: 2_000_000
  53. config :pleroma, :instance,
  54. multi_factor_authentication: [
  55. totp: [
  56. # digits 6 or 8
  57. digits: 6,
  58. period: 30
  59. ],
  60. backup_codes: [
  61. number: 2,
  62. length: 6
  63. ]
  64. ]
  65. config :web_push_encryption, :vapid_details,
  66. subject: "mailto:administrator@example.com",
  67. public_key:
  68. "BLH1qVhJItRGCfxgTtONfsOKDc9VRAraXw-3NsmjMngWSh7NxOizN6bkuRA7iLTMPS82PjwJAr3UoK9EC1IFrz4",
  69. private_key: "_-XZ0iebPrRfZ_o0-IatTdszYa8VCH1yLN-JauK7HHA"
  70. config :pleroma, Oban, testing: :manual
  71. config :pleroma, Pleroma.ScheduledActivity,
  72. daily_user_limit: 2,
  73. total_user_limit: 3,
  74. enabled: false
  75. config :pleroma, :rate_limit, %{}
  76. config :pleroma, :http_security, report_uri: "https://endpoint.com"
  77. config :pleroma, :http, send_user_agent: false
  78. rum_enabled = System.get_env("RUM_ENABLED") == "true"
  79. config :pleroma, :database, rum_enabled: rum_enabled
  80. IO.puts("RUM enabled: #{rum_enabled}")
  81. config :joken, default_signer: "yU8uHKq+yyAkZ11Hx//jcdacWc8yQ1bxAAGrplzB0Zwwjkp35v0RK9SO8WTPr6QZ"
  82. config :pleroma, Pleroma.ReverseProxy.Client, Pleroma.ReverseProxy.ClientMock
  83. config :pleroma, :modules, runtime_dir: "test/fixtures/modules"
  84. config :pleroma, Pleroma.Gun, Pleroma.GunMock
  85. config :pleroma, Pleroma.Emails.NewUsersDigestEmail, enabled: true
  86. config :pleroma, Pleroma.Web.Plugs.RemoteIp, enabled: false
  87. config :pleroma, Pleroma.Web.ApiSpec.CastAndValidate, strict: true
  88. config :tzdata, :autoupdate, :disabled
  89. config :pleroma, :mrf, policies: []
  90. config :pleroma, :pipeline,
  91. object_validator: Pleroma.Web.ActivityPub.ObjectValidatorMock,
  92. mrf: Pleroma.Web.ActivityPub.MRFMock,
  93. activity_pub: Pleroma.Web.ActivityPub.ActivityPubMock,
  94. side_effects: Pleroma.Web.ActivityPub.SideEffectsMock,
  95. federator: Pleroma.Web.FederatorMock,
  96. config: Pleroma.ConfigMock
  97. config :pleroma, :cachex, provider: Pleroma.CachexMock
  98. config :pleroma, Pleroma.Web.WebFinger, update_nickname_on_user_fetch: false
  99. config :pleroma, :side_effects,
  100. ap_streamer: Pleroma.Web.ActivityPub.ActivityPubMock,
  101. logger: Pleroma.LoggerMock
  102. config :pleroma, Pleroma.Search, module: Pleroma.Search.DatabaseSearch
  103. config :pleroma, Pleroma.Search.Meilisearch, url: "http://127.0.0.1:7700/", private_key: nil
  104. # Reduce recompilation time
  105. # https://dashbit.co/blog/speeding-up-re-compilation-of-elixir-projects
  106. config :phoenix, :plug_init_mode, :runtime
  107. config :pleroma, :config_impl, Pleroma.UnstubbedConfigMock
  108. config :pleroma, Pleroma.PromEx, disabled: true
  109. # Mox definitions. Only read during compile time.
  110. config :pleroma, Pleroma.User.Backup, config_impl: Pleroma.UnstubbedConfigMock
  111. config :pleroma, Pleroma.Uploaders.S3, ex_aws_impl: Pleroma.Uploaders.S3.ExAwsMock
  112. config :pleroma, Pleroma.Uploaders.S3, config_impl: Pleroma.UnstubbedConfigMock
  113. config :pleroma, Pleroma.Upload, config_impl: Pleroma.UnstubbedConfigMock
  114. config :pleroma, Pleroma.ScheduledActivity, config_impl: Pleroma.UnstubbedConfigMock
  115. config :pleroma, Pleroma.Web.RichMedia.Helpers, config_impl: Pleroma.StaticStubbedConfigMock
  116. config :pleroma, Pleroma.Uploaders.IPFS, config_impl: Pleroma.UnstubbedConfigMock
  117. config :pleroma, Pleroma.Web.Plugs.HTTPSecurityPlug, config_impl: Pleroma.StaticStubbedConfigMock
  118. config :pleroma, Pleroma.Web.Plugs.HTTPSignaturePlug, config_impl: Pleroma.StaticStubbedConfigMock
  119. config :pleroma, Pleroma.Signature, http_signatures_impl: Pleroma.StubbedHTTPSignaturesMock
  120. peer_module =
  121. if String.to_integer(System.otp_release()) >= 25 do
  122. :peer
  123. else
  124. :slave
  125. end
  126. config :pleroma, Pleroma.Cluster, peer_module: peer_module
  127. config :pleroma, Pleroma.Application,
  128. background_migrators: false,
  129. internal_fetch: false,
  130. load_custom_modules: false,
  131. max_restarts: 100,
  132. streamer_registry: false,
  133. test_http_pools: true
  134. config :pleroma, Pleroma.Web.Streaming, sync_streaming: true
  135. config :pleroma, Pleroma.Uploaders.Uploader, timeout: 1_000
  136. config :pleroma, Pleroma.Emoji.Loader, test_emoji: true
  137. config :pleroma, Pleroma.Web.RichMedia.Backfill,
  138. stream_out: Pleroma.Web.ActivityPub.ActivityPubMock
  139. config :pleroma, Pleroma.Web.Plugs.HTTPSecurityPlug, enable: false
  140. config :pleroma, Pleroma.User.Backup, tempdir: "test/tmp"
  141. if File.exists?("./config/test.secret.exs") do
  142. import_config "test.secret.exs"
  143. else
  144. IO.puts(
  145. "You may want to create test.secret.exs to declare custom database connection parameters."
  146. )
  147. end