don't use global mocks in setup callbacks

This commit is contained in:
Alexander Strizhakov 2020-05-13 09:20:25 +03:00
parent b962b24e6f
commit 12635bc156
No known key found for this signature in database
GPG Key ID: 022896A53AEF1381
3 changed files with 8 additions and 5 deletions

View File

@ -11,6 +11,11 @@ defmodule Pleroma.ActivityTest do
alias Pleroma.ThreadMute
import Pleroma.Factory
setup_all do
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
:ok
end
test "returns an activity by it's AP id" do
activity = insert(:note_activity)
found_activity = Activity.get_by_ap_id(activity.data["id"])
@ -107,8 +112,6 @@ test "when association is not loaded" do
describe "search" do
setup do
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
user = insert(:user)
params = %{

View File

@ -13,7 +13,7 @@ defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do
import Tesla.Mock
import Mock
setup do
setup_all do
mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
:ok
end

View File

@ -13,8 +13,8 @@ defmodule Pleroma.Web.Push.ImplTest do
import Pleroma.Factory
setup_all do
Tesla.Mock.mock_global(fn
setup do
Tesla.Mock.mock(fn
%{method: :post, url: "https://example.com/example/1234"} ->
%Tesla.Env{status: 200}