Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

40 строки
1.0KB

  1. defmodule Pleroma.Web.ConnCase do
  2. @moduledoc """
  3. This module defines the test case to be used by
  4. tests that require setting up a connection.
  5. Such tests rely on `Phoenix.ConnTest` and also
  6. import other functionality to make it easier
  7. to build common datastructures and query the data layer.
  8. Finally, if the test case interacts with the database,
  9. it cannot be async. For this reason, every test runs
  10. inside a transaction which is reset at the beginning
  11. of the test unless the test case is marked as async.
  12. """
  13. use ExUnit.CaseTemplate
  14. using do
  15. quote do
  16. # Import conveniences for testing with connections
  17. use Phoenix.ConnTest
  18. import Pleroma.Web.Router.Helpers
  19. # The default endpoint for testing
  20. @endpoint Pleroma.Web.Endpoint
  21. end
  22. end
  23. setup tags do
  24. Cachex.clear(:user_cache)
  25. :ok = Ecto.Adapters.SQL.Sandbox.checkout(Pleroma.Repo)
  26. unless tags[:async] do
  27. Ecto.Adapters.SQL.Sandbox.mode(Pleroma.Repo, {:shared, self()})
  28. end
  29. {:ok, conn: Phoenix.ConnTest.build_conn()}
  30. end
  31. end