logo

pleroma

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

test_helper.exs (1225B)


  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.start(exclude: [:federated, :erratic])
  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. def get(path, default \\ nil) do
  26. get_in(@config, path) || default
  27. end
  28. end