logo

pleroma

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

test_helper.exs (1282B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. Code.put_compiler_option(:warnings_as_errors, true)
  5. ExUnit.configure(max_cases: System.schedulers_online())
  6. ExUnit.start(exclude: [:federated, :erratic])
  7. if match?({:unix, :darwin}, :os.type()) do
  8. excluded = ExUnit.configuration() |> Keyword.get(:exclude, [])
  9. excluded = excluded ++ [:skip_darwin]
  10. ExUnit.configure(exclude: excluded)
  11. end
  12. Ecto.Adapters.SQL.Sandbox.mode(Pleroma.Repo, :manual)
  13. Mox.defmock(Pleroma.ReverseProxy.ClientMock, for: Pleroma.ReverseProxy.Client)
  14. Mox.defmock(Pleroma.GunMock, for: Pleroma.Gun)
  15. {:ok, _} = Application.ensure_all_started(:ex_machina)
  16. ExUnit.after_suite(fn _results ->
  17. uploads = Pleroma.Config.get([Pleroma.Uploaders.Local, :uploads], "test/uploads")
  18. File.rm_rf!(uploads)
  19. end)
  20. defmodule Pleroma.Test.StaticConfig do
  21. @moduledoc """
  22. This module provides a Config that is completely static, built at startup time from the environment. It's safe to use in testing as it will not modify any state.
  23. """
  24. @behaviour Pleroma.Config.Getting
  25. @config Application.get_all_env(:pleroma)
  26. def get(path, default \\ nil) do
  27. get_in(@config, path) || default
  28. end
  29. end