Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
939B

  1. defmodule Pleroma.Web.ChannelCase do
  2. @moduledoc """
  3. This module defines the test case to be used by
  4. channel tests.
  5. Such tests rely on `Phoenix.ChannelTest` 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 channels
  17. use Phoenix.ChannelTest
  18. # The default endpoint for testing
  19. @endpoint Pleroma.Web.Endpoint
  20. end
  21. end
  22. setup tags do
  23. :ok = Ecto.Adapters.SQL.Sandbox.checkout(Pleroma.Repo)
  24. unless tags[:async] do
  25. Ecto.Adapters.SQL.Sandbox.mode(Pleroma.Repo, {:shared, self()})
  26. end
  27. :ok
  28. end
  29. end