logo

pleroma

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

test_helper.exs (1317B)


  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. ExUnit.configure(capture_log: true, max_cases: System.schedulers_online())
  5. ExUnit.start(exclude: [:federated])
  6. if match?({:unix, :darwin}, :os.type()) do
  7. excluded = ExUnit.configuration() |> Keyword.get(:exclude, [])
  8. excluded = excluded ++ [:skip_darwin]
  9. ExUnit.configure(exclude: excluded)
  10. end
  11. Ecto.Adapters.SQL.Sandbox.mode(Pleroma.Repo, :manual)
  12. Mox.defmock(Pleroma.ReverseProxy.ClientMock, for: Pleroma.ReverseProxy.Client)
  13. Mox.defmock(Pleroma.GunMock, for: Pleroma.Gun)
  14. {:ok, _} = Application.ensure_all_started(:ex_machina)
  15. ExUnit.after_suite(fn _results ->
  16. uploads = Pleroma.Config.get([Pleroma.Uploaders.Local, :uploads], "test/uploads")
  17. File.rm_rf!(uploads)
  18. end)
  19. defmodule Pleroma.Test.StaticConfig do
  20. @moduledoc """
  21. 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.
  22. """
  23. @behaviour Pleroma.Config.Getting
  24. @config Application.get_all_env(:pleroma)
  25. @impl true
  26. def get(path, default \\ nil) do
  27. get_in(@config, path) || default
  28. end
  29. @impl true
  30. def get!(path) do
  31. get_in(@config, path)
  32. end
  33. end