don't use global mocks in setup callbacks
This commit is contained in:
parent
b962b24e6f
commit
12635bc156
3 changed files with 8 additions and 5 deletions
|
@ -11,6 +11,11 @@ defmodule Pleroma.ActivityTest do
|
||||||
alias Pleroma.ThreadMute
|
alias Pleroma.ThreadMute
|
||||||
import Pleroma.Factory
|
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
|
test "returns an activity by it's AP id" do
|
||||||
activity = insert(:note_activity)
|
activity = insert(:note_activity)
|
||||||
found_activity = Activity.get_by_ap_id(activity.data["id"])
|
found_activity = Activity.get_by_ap_id(activity.data["id"])
|
||||||
|
@ -107,8 +112,6 @@ test "when association is not loaded" do
|
||||||
|
|
||||||
describe "search" do
|
describe "search" do
|
||||||
setup do
|
setup do
|
||||||
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
|
||||||
|
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
params = %{
|
params = %{
|
||||||
|
|
|
@ -13,7 +13,7 @@ defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do
|
||||||
import Tesla.Mock
|
import Tesla.Mock
|
||||||
import Mock
|
import Mock
|
||||||
|
|
||||||
setup do
|
setup_all do
|
||||||
mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||||
:ok
|
:ok
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,8 +13,8 @@ defmodule Pleroma.Web.Push.ImplTest do
|
||||||
|
|
||||||
import Pleroma.Factory
|
import Pleroma.Factory
|
||||||
|
|
||||||
setup_all do
|
setup do
|
||||||
Tesla.Mock.mock_global(fn
|
Tesla.Mock.mock(fn
|
||||||
%{method: :post, url: "https://example.com/example/1234"} ->
|
%{method: :post, url: "https://example.com/example/1234"} ->
|
||||||
%Tesla.Env{status: 200}
|
%Tesla.Env{status: 200}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue