Tests: Stub the Pipeline mocks with the real modules when needed.
This commit is contained in:
parent
74596982be
commit
d5a824b463
@ -14,6 +14,8 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup_all do
|
||||
Mix.shell(Mix.Shell.Process)
|
||||
|
||||
|
@ -12,6 +12,8 @@ defmodule Mix.Tasks.Pleroma.RelayTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup_all do
|
||||
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
|
||||
|
@ -20,6 +20,8 @@ defmodule Mix.Tasks.Pleroma.UserTest do
|
||||
import Mock
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup_all do
|
||||
Mix.shell(Mix.Shell.Process)
|
||||
|
||||
|
@ -11,6 +11,8 @@ defmodule Pleroma.ActivityTest do
|
||||
alias Pleroma.ThreadMute
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup_all do
|
||||
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
|
@ -11,6 +11,8 @@ defmodule Pleroma.Chat.MessageReferenceTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
describe "messages" do
|
||||
test "it returns the last message in a chat" do
|
||||
user = insert(:user)
|
||||
|
@ -11,6 +11,8 @@ defmodule Pleroma.Conversation.ParticipationTest do
|
||||
alias Pleroma.User
|
||||
alias Pleroma.Web.CommonAPI
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
test "getting a participation will also preload things" do
|
||||
user = insert(:user)
|
||||
other_user = insert(:user)
|
||||
|
@ -13,6 +13,8 @@ defmodule Pleroma.MigrationHelper.NotificationBackfillTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
describe "fill_in_notification_types" do
|
||||
test "it fills in missing notification types" do
|
||||
user = insert(:user)
|
||||
|
@ -21,6 +21,8 @@ defmodule Pleroma.NotificationTest do
|
||||
alias Pleroma.Web.Push
|
||||
alias Pleroma.Web.Streamer
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
describe "create_notifications" do
|
||||
test "never returns nil" do
|
||||
user = insert(:user)
|
||||
|
@ -13,6 +13,8 @@ defmodule Pleroma.Object.FetcherTest do
|
||||
import Mock
|
||||
import Tesla.Mock
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup do
|
||||
mock(fn
|
||||
%{method: :get, url: "https://mastodon.example.org/users/userisgone"} ->
|
||||
|
@ -14,6 +14,8 @@ defmodule Pleroma.ObjectTest do
|
||||
alias Pleroma.Tests.ObanHelpers
|
||||
alias Pleroma.Web.CommonAPI
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup do
|
||||
mock(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
|
@ -10,6 +10,8 @@ defmodule Pleroma.StatsTest do
|
||||
alias Pleroma.Stats
|
||||
alias Pleroma.Web.CommonAPI
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
describe "user count" do
|
||||
test "it ignores internal users" do
|
||||
_user = insert(:user, local: true)
|
||||
|
@ -16,6 +16,8 @@ defmodule Pleroma.User.BackupTest do
|
||||
alias Pleroma.Web.CommonAPI
|
||||
alias Pleroma.Workers.BackupWorker
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup do
|
||||
clear_config([Pleroma.Upload, :uploader])
|
||||
clear_config([Backup, :limit_days])
|
||||
|
@ -12,6 +12,8 @@ defmodule Pleroma.User.ImportTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup_all do
|
||||
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
|
@ -10,6 +10,8 @@ defmodule Pleroma.User.WelcomeChatMessageTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup do: clear_config([:welcome])
|
||||
|
||||
describe "post_message/1" do
|
||||
|
@ -19,6 +19,8 @@ defmodule Pleroma.UserTest do
|
||||
import ExUnit.CaptureLog
|
||||
import Swoosh.TestAssertions
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup_all do
|
||||
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
|
@ -26,6 +26,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
|
||||
|
||||
require Pleroma.Constants
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup_all do
|
||||
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
|
@ -22,6 +22,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
|
||||
import Pleroma.Factory
|
||||
import Tesla.Mock
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup do
|
||||
mock(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
|
@ -10,6 +10,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.HellthreadPolicyTest do
|
||||
|
||||
alias Pleroma.Web.CommonAPI
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup do
|
||||
user = insert(:user)
|
||||
|
||||
|
@ -9,6 +9,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicyTest do
|
||||
alias Pleroma.Web.ActivityPub.MRF.SimplePolicy
|
||||
alias Pleroma.Web.CommonAPI
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup do:
|
||||
clear_config(:mrf_simple,
|
||||
media_removal: [],
|
||||
|
@ -11,6 +11,8 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AcceptValidationTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup do
|
||||
follower = insert(:user)
|
||||
followed = insert(:user, local: false)
|
||||
|
@ -12,6 +12,8 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AnnounceValidationTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
describe "announces" do
|
||||
setup do
|
||||
user = insert(:user)
|
||||
|
@ -12,6 +12,8 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ChatValidationTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
describe "chat message create activities" do
|
||||
test "it is invalid if the object already exists" do
|
||||
user = insert(:user)
|
||||
|
@ -11,6 +11,8 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.EmojiReactHandlingTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
describe "EmojiReacts" do
|
||||
setup do
|
||||
user = insert(:user)
|
||||
|
@ -12,6 +12,8 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.LikeValidationTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
describe "likes" do
|
||||
setup do
|
||||
user = insert(:user)
|
||||
|
@ -11,6 +11,8 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.RejectValidationTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup do
|
||||
follower = insert(:user)
|
||||
followed = insert(:user, local: false)
|
||||
|
@ -11,6 +11,8 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.UndoHandlingTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
describe "Undos" do
|
||||
setup do
|
||||
user = insert(:user)
|
||||
|
@ -18,6 +18,8 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
|
||||
|
||||
@as_public "https://www.w3.org/ns/activitystreams#Public"
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup do
|
||||
mock(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
|
@ -14,6 +14,8 @@ defmodule Pleroma.Web.ActivityPub.RelayTest do
|
||||
import Pleroma.Factory
|
||||
import Mock
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
test "gets an actor for the relay" do
|
||||
user = Relay.get_actor()
|
||||
assert user.ap_id == "#{Pleroma.Web.Endpoint.url()}/relay"
|
||||
|
@ -23,6 +23,8 @@ defmodule Pleroma.Web.ActivityPub.SideEffectsTest do
|
||||
import Mock
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
describe "handle_after_transaction" do
|
||||
test "it streams out notifications and streams" do
|
||||
author = insert(:user, local: true)
|
||||
|
@ -11,6 +11,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.AcceptHandlingTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
test "it works for incoming accepts which were pre-accepted" do
|
||||
follower = insert(:user)
|
||||
followed = insert(:user)
|
||||
|
@ -12,6 +12,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.AnnounceHandlingTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
test "it works for incoming honk announces" do
|
||||
user = insert(:user, ap_id: "https://honktest/u/test", local: false)
|
||||
other_user = insert(:user)
|
||||
|
@ -12,6 +12,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.AnswerHandlingTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup_all do
|
||||
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
|
@ -11,6 +11,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.ArticleHandlingTest do
|
||||
alias Pleroma.Object.Fetcher
|
||||
alias Pleroma.Web.ActivityPub.Transmogrifier
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
test "Pterotype (Wordpress Plugin) Article" do
|
||||
Tesla.Mock.mock(fn %{url: "https://wedistribute.org/wp-json/pterotype/v1/actor/-blog"} ->
|
||||
%Tesla.Env{
|
||||
|
@ -12,6 +12,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.AudioHandlingTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
test "it works for incoming listens" do
|
||||
_user = insert(:user, ap_id: "http://mastodon.example.org/users/admin")
|
||||
|
||||
|
@ -10,6 +10,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.BlockHandlingTest do
|
||||
alias Pleroma.Web.ActivityPub.Transmogrifier
|
||||
|
||||
import Pleroma.Factory
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
test "it works for incoming blocks" do
|
||||
user = insert(:user)
|
||||
|
@ -12,6 +12,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.ChatMessageTest do
|
||||
alias Pleroma.Object
|
||||
alias Pleroma.Web.ActivityPub.Transmogrifier
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
describe "handle_incoming" do
|
||||
test "handles chonks with attachment" do
|
||||
data = %{
|
||||
|
@ -14,6 +14,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.DeleteHandlingTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup_all do
|
||||
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
|
@ -12,6 +12,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.EmojiReactHandlingTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
test "it works for incoming emoji reactions" do
|
||||
user = insert(:user)
|
||||
other_user = insert(:user, local: false)
|
||||
|
@ -7,6 +7,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.EventHandlingTest do
|
||||
use Pleroma.DataCase
|
||||
|
||||
alias Pleroma.Object.Fetcher
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
test "Mobilizon Event object" do
|
||||
Tesla.Mock.mock(fn
|
||||
|
@ -15,6 +15,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.FollowHandlingTest do
|
||||
import Ecto.Query
|
||||
import Mock
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup_all do
|
||||
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
|
@ -11,6 +11,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.LikeHandlingTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
test "it works for incoming likes" do
|
||||
user = insert(:user)
|
||||
|
||||
|
@ -16,6 +16,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.NoteHandlingTest do
|
||||
import Pleroma.Factory
|
||||
import ExUnit.CaptureLog
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup_all do
|
||||
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
|
@ -12,6 +12,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.QuestionHandlingTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup_all do
|
||||
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
|
@ -12,6 +12,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.RejectHandlingTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
test "it fails for incoming rejects which cannot be correlated" do
|
||||
follower = insert(:user)
|
||||
followed = insert(:user, is_locked: true)
|
||||
|
@ -13,6 +13,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.UndoHandlingTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
test "it works for incoming emoji reaction undos" do
|
||||
user = insert(:user)
|
||||
|
||||
|
@ -11,6 +11,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.UserUpdateHandlingTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
test "it works for incoming update activities" do
|
||||
user = insert(:user, local: false)
|
||||
|
||||
|
@ -11,6 +11,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.VideoHandlingTest do
|
||||
alias Pleroma.Object.Fetcher
|
||||
alias Pleroma.Web.ActivityPub.Transmogrifier
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup_all do
|
||||
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
|
@ -18,6 +18,8 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
||||
import Pleroma.Factory
|
||||
import ExUnit.CaptureLog
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup_all do
|
||||
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
|
@ -16,6 +16,8 @@ defmodule Pleroma.Web.ActivityPub.UtilsTest do
|
||||
|
||||
require Pleroma.Constants
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
describe "fetch the latest Follow" do
|
||||
test "fetches the latest Follow activity" do
|
||||
%Activity{data: %{"type" => "Follow"}} = activity = insert(:follow_activity)
|
||||
|
@ -10,6 +10,8 @@ defmodule Pleroma.Web.ActivityPub.ObjectViewTest do
|
||||
alias Pleroma.Web.ActivityPub.ObjectView
|
||||
alias Pleroma.Web.CommonAPI
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
test "renders a note object" do
|
||||
note = insert(:note)
|
||||
|
||||
|
@ -10,6 +10,8 @@ defmodule Pleroma.Web.ActivityPub.UserViewTest do
|
||||
alias Pleroma.Web.ActivityPub.UserView
|
||||
alias Pleroma.Web.CommonAPI
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
test "Renders a user, including the public key" do
|
||||
user = insert(:user)
|
||||
{:ok, user} = User.ensure_keys_present(user)
|
||||
|
@ -18,6 +18,8 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|
||||
alias Pleroma.User
|
||||
alias Pleroma.Web.CommonAPI
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup_all do
|
||||
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
|
||||
|
@ -14,6 +14,8 @@ defmodule Pleroma.Web.AdminAPI.ChatControllerTest do
|
||||
alias Pleroma.Repo
|
||||
alias Pleroma.Web.CommonAPI
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
defp admin_setup do
|
||||
admin = insert(:user, is_admin: true)
|
||||
token = insert(:oauth_admin_token, user: admin)
|
||||
|
@ -11,6 +11,8 @@ defmodule Pleroma.Web.AdminAPI.RelayControllerTest do
|
||||
alias Pleroma.Repo
|
||||
alias Pleroma.User
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup_all do
|
||||
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
|
||||
|
@ -13,6 +13,8 @@ defmodule Pleroma.Web.AdminAPI.StatusControllerTest do
|
||||
alias Pleroma.User
|
||||
alias Pleroma.Web.CommonAPI
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup do
|
||||
admin = insert(:user, is_admin: true)
|
||||
token = insert(:oauth_admin_token, user: admin)
|
||||
|
@ -19,6 +19,8 @@ defmodule Pleroma.Web.AdminAPI.UserControllerTest do
|
||||
alias Pleroma.Web.CommonAPI
|
||||
alias Pleroma.Web.MediaProxy
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup_all do
|
||||
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
|
||||
|
@ -25,6 +25,8 @@ defmodule Pleroma.Web.CommonAPITest do
|
||||
|
||||
require Pleroma.Constants
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup do: clear_config([:instance, :safe_dm_mentions])
|
||||
setup do: clear_config([:instance, :limit])
|
||||
setup do: clear_config([:instance, :max_pinned_statuses])
|
||||
|
@ -15,6 +15,8 @@ defmodule Pleroma.Web.FederatorTest do
|
||||
import Pleroma.Factory
|
||||
import Mock
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup_all do
|
||||
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
|
||||
|
@ -14,6 +14,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
describe "account fetching" do
|
||||
test "works by id" do
|
||||
%User{id: user_id} = insert(:user)
|
||||
|
@ -10,6 +10,8 @@ defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
describe "locked accounts" do
|
||||
setup do
|
||||
user = insert(:user, is_locked: true)
|
||||
|
@ -12,6 +12,8 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
test "does NOT render account/pleroma/relationship by default" do
|
||||
%{user: user, conn: conn} = oauth_access(["read:notifications"])
|
||||
other_user = insert(:user)
|
||||
|
@ -9,6 +9,11 @@ defmodule Pleroma.Web.MastodonAPI.PollControllerTest do
|
||||
alias Pleroma.Web.CommonAPI
|
||||
|
||||
import Pleroma.Factory
|
||||
import Mox
|
||||
|
||||
setup :set_mox_from_context
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
describe "GET /api/v1/polls/:id" do
|
||||
setup do: oauth_access(["read:statuses"])
|
||||
@ -65,6 +70,8 @@ defmodule Pleroma.Web.MastodonAPI.PollControllerTest do
|
||||
|
||||
object = Object.normalize(activity)
|
||||
|
||||
# Calling this will run a vote in Cachex.fetch, which doesn't have access
|
||||
# to our mocks unless we run in global mode.
|
||||
conn =
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|
@ -19,6 +19,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup do: clear_config([:instance, :federating])
|
||||
setup do: clear_config([:instance, :allow_relay])
|
||||
setup do: clear_config([:rich_media, :enabled])
|
||||
|
@ -11,6 +11,8 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
|
||||
alias Pleroma.User
|
||||
alias Pleroma.Web.CommonAPI
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup do
|
||||
mock(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
|
@ -13,6 +13,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPITest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
describe "follow/3" do
|
||||
test "returns error when followed user is deactivated" do
|
||||
follower = insert(:user)
|
||||
|
@ -11,6 +11,8 @@ defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do
|
||||
import Mock
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup do: clear_config([:instance, :max_account_fields])
|
||||
|
||||
describe "updating credentials" do
|
||||
|
@ -14,6 +14,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
|
||||
import Pleroma.Factory
|
||||
import Tesla.Mock
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup do
|
||||
mock(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
|
@ -22,6 +22,8 @@ defmodule Pleroma.Web.MastodonAPI.NotificationViewTest do
|
||||
alias Pleroma.Web.PleromaAPI.Chat.MessageReferenceView
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
defp test_notifications_rendering(notifications, user, expected_result) do
|
||||
result = NotificationView.render("index.json", %{notifications: notifications, for: user})
|
||||
|
||||
|
@ -12,6 +12,8 @@ defmodule Pleroma.Web.MastodonAPI.PollViewTest do
|
||||
import Pleroma.Factory
|
||||
import Tesla.Mock
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup do
|
||||
mock(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
|
@ -22,6 +22,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
|
||||
import Tesla.Mock
|
||||
import OpenApiSpex.TestAssertions
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup do
|
||||
mock(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
|
@ -15,6 +15,8 @@ defmodule Pleroma.Web.OStatus.OStatusControllerTest do
|
||||
|
||||
require Pleroma.Constants
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup_all do
|
||||
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
|
@ -13,6 +13,8 @@ defmodule Pleroma.Web.PleromaAPI.AccountControllerTest do
|
||||
import Pleroma.Factory
|
||||
import Swoosh.TestAssertions
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
describe "POST /api/v1/pleroma/accounts/confirmation_resend" do
|
||||
setup do
|
||||
{:ok, user} =
|
||||
|
@ -13,6 +13,8 @@ defmodule Pleroma.Web.PleromaAPI.ChatControllerTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
describe "POST /api/v1/pleroma/chats/:id/messages/:message_id/read" do
|
||||
setup do: oauth_access(["write:chats"])
|
||||
|
||||
|
@ -3,12 +3,14 @@
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do
|
||||
use Pleroma.Web.ConnCase, async: false
|
||||
use Pleroma.Web.ConnCase
|
||||
|
||||
import Mock
|
||||
import Tesla.Mock
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
@emoji_path Path.join(
|
||||
Pleroma.Config.get!([:instance, :static_dir]),
|
||||
"emoji"
|
||||
|
@ -13,6 +13,8 @@ defmodule Pleroma.Web.PleromaAPI.EmojiReactionControllerTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
test "PUT /api/v1/pleroma/statuses/:id/reactions/:emoji", %{conn: conn} do
|
||||
user = insert(:user)
|
||||
other_user = insert(:user)
|
||||
|
@ -11,6 +11,8 @@ defmodule Pleroma.Web.PleromaAPI.NotificationControllerTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
describe "POST /api/v1/pleroma/notifications/read" do
|
||||
setup do: oauth_access(["write:notifications"])
|
||||
|
||||
|
@ -11,6 +11,8 @@ defmodule Pleroma.Web.PleromaAPI.UserImportControllerTest do
|
||||
import Pleroma.Factory
|
||||
import Mock
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup do
|
||||
Tesla.Mock.mock(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
|
@ -14,6 +14,8 @@ defmodule Pleroma.Web.PleromaAPI.ChatMessageReferenceViewTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
test "it displays a chat message" do
|
||||
user = insert(:user)
|
||||
recipient = insert(:user)
|
||||
|
@ -16,6 +16,8 @@ defmodule Pleroma.Web.PleromaAPI.ChatViewTest do
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
test "it represents a chat" do
|
||||
user = insert(:user)
|
||||
recipient = insert(:user)
|
||||
|
@ -15,6 +15,8 @@ defmodule Pleroma.Web.Push.ImplTest do
|
||||
alias Pleroma.Web.Push.Impl
|
||||
alias Pleroma.Web.Push.Subscription
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup do
|
||||
Tesla.Mock.mock(fn
|
||||
%{method: :post, url: "https://example.com/example/1234"} ->
|
||||
|
@ -17,7 +17,7 @@ defmodule Pleroma.Web.StreamerTest do
|
||||
alias Pleroma.Web.Streamer
|
||||
alias Pleroma.Web.StreamerView
|
||||
|
||||
@moduletag needs_streamer: true, capture_log: true
|
||||
@moduletag needs_streamer: true, capture_log: true, stubbed_pipeline: true
|
||||
|
||||
setup do: clear_config([:instance, :skip_thread_containment])
|
||||
|
||||
|
@ -14,6 +14,8 @@ defmodule Pleroma.Web.TwitterAPI.RemoteFollowControllerTest do
|
||||
import Pleroma.Factory
|
||||
import Ecto.Query
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
setup do
|
||||
Tesla.Mock.mock(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
|
@ -10,6 +10,8 @@ defmodule Pleroma.Workers.PurgeExpiredActivityTest do
|
||||
|
||||
alias Pleroma.Workers.PurgeExpiredActivity
|
||||
|
||||
@moduletag stubbed_pipeline: true
|
||||
|
||||
test "enqueue job" do
|
||||
activity = insert(:note_activity)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user