X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=test%2Fsupport%2Fdata_case.ex;h=0ee2aa4a23204da337cef9d7e6ce9a573e11ff96;hb=bbedbaaf5cf1b9a76c656e7ef26df4dec2cc91bf;hp=0427682a203873867734dddbb7e54af2bf587271;hpb=3f88e33a71ce02cdea722c322f1e86672aa5ff69;p=akkoma diff --git a/test/support/data_case.ex b/test/support/data_case.ex index 0427682a2..0ee2aa4a2 100644 --- a/test/support/data_case.ex +++ b/test/support/data_case.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.DataCase do @@ -64,7 +64,7 @@ defmodule Pleroma.DataCase do end) end - setup tags do + def setup_multi_process_mode(tags) do :ok = Ecto.Adapters.SQL.Sandbox.checkout(Pleroma.Repo) if tags[:async] do @@ -72,11 +72,16 @@ defmodule Pleroma.DataCase do Mox.set_mox_private() else Ecto.Adapters.SQL.Sandbox.mode(Pleroma.Repo, {:shared, self()}) - Mox.stub_with(Pleroma.CachexMock, Pleroma.CachexProxy) + Mox.set_mox_global() + Mox.stub_with(Pleroma.CachexMock, Pleroma.CachexProxy) clear_cachex() end + :ok + end + + def setup_streamer(tags) do if tags[:needs_streamer] do start_supervised(%{ id: Pleroma.Web.Streamer.registry(), @@ -85,6 +90,12 @@ defmodule Pleroma.DataCase do }) end + :ok + end + + setup tags do + setup_multi_process_mode(tags) + setup_streamer(tags) stub_pipeline() Mox.verify_on_exit!()