From d5a824b463e66b91861556b26e4c95e880c89139 Mon Sep 17 00:00:00 2001 From: lain Date: Wed, 16 Dec 2020 20:28:36 +0100 Subject: [PATCH] Tests: Stub the Pipeline mocks with the real modules when needed. --- test/mix/tasks/pleroma/database_test.exs | 2 ++ test/mix/tasks/pleroma/relay_test.exs | 2 ++ test/mix/tasks/pleroma/user_test.exs | 2 ++ test/pleroma/activity_test.exs | 2 ++ test/pleroma/chat/message_reference_test.exs | 2 ++ test/pleroma/conversation/participation_test.exs | 2 ++ .../migration_helper/notification_backfill_test.exs | 2 ++ test/pleroma/notification_test.exs | 2 ++ test/pleroma/object/fetcher_test.exs | 2 ++ test/pleroma/object_test.exs | 2 ++ test/pleroma/stats_test.exs | 2 ++ test/pleroma/user/backup_test.exs | 2 ++ test/pleroma/user/import_test.exs | 2 ++ test/pleroma/user/welcome_chat_message_test.exs | 2 ++ test/pleroma/user_test.exs | 2 ++ .../web/activity_pub/activity_pub_controller_test.exs | 2 ++ test/pleroma/web/activity_pub/activity_pub_test.exs | 2 ++ .../web/activity_pub/mrf/hellthread_policy_test.exs | 2 ++ test/pleroma/web/activity_pub/mrf/simple_policy_test.exs | 2 ++ .../object_validators/accept_validation_test.exs | 2 ++ .../object_validators/announce_validation_test.exs | 2 ++ .../object_validators/chat_validation_test.exs | 2 ++ .../object_validators/emoji_react_handling_test.exs | 2 ++ .../object_validators/like_validation_test.exs | 2 ++ .../object_validators/reject_validation_test.exs | 2 ++ .../activity_pub/object_validators/undo_handling_test.exs | 2 ++ test/pleroma/web/activity_pub/publisher_test.exs | 2 ++ test/pleroma/web/activity_pub/relay_test.exs | 2 ++ test/pleroma/web/activity_pub/side_effects_test.exs | 2 ++ .../activity_pub/transmogrifier/accept_handling_test.exs | 2 ++ .../activity_pub/transmogrifier/announce_handling_test.exs | 2 ++ .../activity_pub/transmogrifier/answer_handling_test.exs | 2 ++ .../activity_pub/transmogrifier/article_handling_test.exs | 2 ++ .../activity_pub/transmogrifier/audio_handling_test.exs | 2 ++ .../activity_pub/transmogrifier/block_handling_test.exs | 1 + .../web/activity_pub/transmogrifier/chat_message_test.exs | 2 ++ .../activity_pub/transmogrifier/delete_handling_test.exs | 2 ++ .../transmogrifier/emoji_react_handling_test.exs | 2 ++ .../activity_pub/transmogrifier/event_handling_test.exs | 1 + .../activity_pub/transmogrifier/follow_handling_test.exs | 2 ++ .../web/activity_pub/transmogrifier/like_handling_test.exs | 2 ++ .../web/activity_pub/transmogrifier/note_handling_test.exs | 2 ++ .../activity_pub/transmogrifier/question_handling_test.exs | 2 ++ .../activity_pub/transmogrifier/reject_handling_test.exs | 2 ++ .../web/activity_pub/transmogrifier/undo_handling_test.exs | 1 + .../transmogrifier/user_update_handling_test.exs | 2 ++ .../activity_pub/transmogrifier/video_handling_test.exs | 2 ++ test/pleroma/web/activity_pub/transmogrifier_test.exs | 2 ++ test/pleroma/web/activity_pub/utils_test.exs | 2 ++ test/pleroma/web/activity_pub/views/object_view_test.exs | 2 ++ test/pleroma/web/activity_pub/views/user_view_test.exs | 2 ++ .../admin_api/controllers/admin_api_controller_test.exs | 2 ++ .../web/admin_api/controllers/chat_controller_test.exs | 2 ++ .../web/admin_api/controllers/relay_controller_test.exs | 2 ++ .../web/admin_api/controllers/status_controller_test.exs | 2 ++ .../web/admin_api/controllers/user_controller_test.exs | 2 ++ test/pleroma/web/common_api_test.exs | 2 ++ test/pleroma/web/federator_test.exs | 2 ++ .../mastodon_api/controllers/account_controller_test.exs | 2 ++ .../controllers/follow_request_controller_test.exs | 2 ++ .../controllers/notification_controller_test.exs | 2 ++ .../web/mastodon_api/controllers/poll_controller_test.exs | 7 +++++++ .../mastodon_api/controllers/status_controller_test.exs | 2 ++ .../mastodon_api/controllers/timeline_controller_test.exs | 2 ++ test/pleroma/web/mastodon_api/mastodon_api_test.exs | 2 ++ test/pleroma/web/mastodon_api/update_credentials_test.exs | 2 ++ test/pleroma/web/mastodon_api/views/account_view_test.exs | 2 ++ .../web/mastodon_api/views/notification_view_test.exs | 2 ++ test/pleroma/web/mastodon_api/views/poll_view_test.exs | 2 ++ test/pleroma/web/mastodon_api/views/status_view_test.exs | 2 ++ test/pleroma/web/o_status/o_status_controller_test.exs | 2 ++ .../pleroma_api/controllers/account_controller_test.exs | 2 ++ .../web/pleroma_api/controllers/chat_controller_test.exs | 2 ++ .../pleroma_api/controllers/emoji_pack_controller_test.exs | 4 +++- .../controllers/emoji_reaction_controller_test.exs | 2 ++ .../controllers/notification_controller_test.exs | 2 ++ .../controllers/user_import_controller_test.exs | 2 ++ .../pleroma_api/views/chat_message_reference_view_test.exs | 2 ++ test/pleroma/web/pleroma_api/views/chat_view_test.exs | 2 ++ test/pleroma/web/push/impl_test.exs | 2 ++ test/pleroma/web/streamer_test.exs | 2 +- .../web/twitter_api/remote_follow_controller_test.exs | 2 ++ test/pleroma/workers/purge_expired_activity_test.exs | 2 ++ 83 files changed, 168 insertions(+), 2 deletions(-) diff --git a/test/mix/tasks/pleroma/database_test.exs b/test/mix/tasks/pleroma/database_test.exs index a4bd41922..e9cb75f3e 100644 --- a/test/mix/tasks/pleroma/database_test.exs +++ b/test/mix/tasks/pleroma/database_test.exs @@ -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) diff --git a/test/mix/tasks/pleroma/relay_test.exs b/test/mix/tasks/pleroma/relay_test.exs index cf48e7dda..316e1911c 100644 --- a/test/mix/tasks/pleroma/relay_test.exs +++ b/test/mix/tasks/pleroma/relay_test.exs @@ -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) diff --git a/test/mix/tasks/pleroma/user_test.exs b/test/mix/tasks/pleroma/user_test.exs index 127771212..355d85e98 100644 --- a/test/mix/tasks/pleroma/user_test.exs +++ b/test/mix/tasks/pleroma/user_test.exs @@ -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) diff --git a/test/pleroma/activity_test.exs b/test/pleroma/activity_test.exs index 105f9f766..ea189aa94 100644 --- a/test/pleroma/activity_test.exs +++ b/test/pleroma/activity_test.exs @@ -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 diff --git a/test/pleroma/chat/message_reference_test.exs b/test/pleroma/chat/message_reference_test.exs index aaa7c1ad4..f93fe943b 100644 --- a/test/pleroma/chat/message_reference_test.exs +++ b/test/pleroma/chat/message_reference_test.exs @@ -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) diff --git a/test/pleroma/conversation/participation_test.exs b/test/pleroma/conversation/participation_test.exs index 415655368..3c1e8953e 100644 --- a/test/pleroma/conversation/participation_test.exs +++ b/test/pleroma/conversation/participation_test.exs @@ -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) diff --git a/test/pleroma/migration_helper/notification_backfill_test.exs b/test/pleroma/migration_helper/notification_backfill_test.exs index 2a62a2b00..86d06f0ea 100644 --- a/test/pleroma/migration_helper/notification_backfill_test.exs +++ b/test/pleroma/migration_helper/notification_backfill_test.exs @@ -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) diff --git a/test/pleroma/notification_test.exs b/test/pleroma/notification_test.exs index a6558f995..84e64beff 100644 --- a/test/pleroma/notification_test.exs +++ b/test/pleroma/notification_test.exs @@ -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) diff --git a/test/pleroma/object/fetcher_test.exs b/test/pleroma/object/fetcher_test.exs index 7df6af7fe..6873e568f 100644 --- a/test/pleroma/object/fetcher_test.exs +++ b/test/pleroma/object/fetcher_test.exs @@ -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"} -> diff --git a/test/pleroma/object_test.exs b/test/pleroma/object_test.exs index 5d4e6fb84..e540e211f 100644 --- a/test/pleroma/object_test.exs +++ b/test/pleroma/object_test.exs @@ -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 diff --git a/test/pleroma/stats_test.exs b/test/pleroma/stats_test.exs index 74bf785b0..994b004ec 100644 --- a/test/pleroma/stats_test.exs +++ b/test/pleroma/stats_test.exs @@ -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) diff --git a/test/pleroma/user/backup_test.exs b/test/pleroma/user/backup_test.exs index f68e4a029..fde4ad5a9 100644 --- a/test/pleroma/user/backup_test.exs +++ b/test/pleroma/user/backup_test.exs @@ -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]) diff --git a/test/pleroma/user/import_test.exs b/test/pleroma/user/import_test.exs index e198cdc08..1039b207a 100644 --- a/test/pleroma/user/import_test.exs +++ b/test/pleroma/user/import_test.exs @@ -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 diff --git a/test/pleroma/user/welcome_chat_message_test.exs b/test/pleroma/user/welcome_chat_message_test.exs index fe26d6e4d..5c851fa49 100644 --- a/test/pleroma/user/welcome_chat_message_test.exs +++ b/test/pleroma/user/welcome_chat_message_test.exs @@ -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 diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index 5d544fe7d..a6ee4d24c 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -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 diff --git a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs index 0063d0482..ebdbc9599 100644 --- a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs @@ -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 diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index 9eb7ae86b..ca919491a 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -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 diff --git a/test/pleroma/web/activity_pub/mrf/hellthread_policy_test.exs b/test/pleroma/web/activity_pub/mrf/hellthread_policy_test.exs index 26f5bcdaa..1ad818811 100644 --- a/test/pleroma/web/activity_pub/mrf/hellthread_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/hellthread_policy_test.exs @@ -10,6 +10,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.HellthreadPolicyTest do alias Pleroma.Web.CommonAPI + @moduletag stubbed_pipeline: true + setup do user = insert(:user) diff --git a/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs b/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs index d7dde62c4..163b0fc0f 100644 --- a/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs @@ -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: [], diff --git a/test/pleroma/web/activity_pub/object_validators/accept_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/accept_validation_test.exs index d6111ba41..8732e94c0 100644 --- a/test/pleroma/web/activity_pub/object_validators/accept_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/accept_validation_test.exs @@ -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) diff --git a/test/pleroma/web/activity_pub/object_validators/announce_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/announce_validation_test.exs index 4771c4698..69de5c204 100644 --- a/test/pleroma/web/activity_pub/object_validators/announce_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/announce_validation_test.exs @@ -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) diff --git a/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs index d7e299224..8e01e61db 100644 --- a/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs @@ -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) diff --git a/test/pleroma/web/activity_pub/object_validators/emoji_react_handling_test.exs b/test/pleroma/web/activity_pub/object_validators/emoji_react_handling_test.exs index 582e6d785..ec6d53f52 100644 --- a/test/pleroma/web/activity_pub/object_validators/emoji_react_handling_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/emoji_react_handling_test.exs @@ -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) diff --git a/test/pleroma/web/activity_pub/object_validators/like_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/like_validation_test.exs index 2c033b7e2..50933638c 100644 --- a/test/pleroma/web/activity_pub/object_validators/like_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/like_validation_test.exs @@ -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) diff --git a/test/pleroma/web/activity_pub/object_validators/reject_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/reject_validation_test.exs index 370bb6e5c..4158e25e1 100644 --- a/test/pleroma/web/activity_pub/object_validators/reject_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/reject_validation_test.exs @@ -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) diff --git a/test/pleroma/web/activity_pub/object_validators/undo_handling_test.exs b/test/pleroma/web/activity_pub/object_validators/undo_handling_test.exs index 75bbcc4b6..00fcd4e9c 100644 --- a/test/pleroma/web/activity_pub/object_validators/undo_handling_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/undo_handling_test.exs @@ -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) diff --git a/test/pleroma/web/activity_pub/publisher_test.exs b/test/pleroma/web/activity_pub/publisher_test.exs index 3503d25b2..bcdc7a9af 100644 --- a/test/pleroma/web/activity_pub/publisher_test.exs +++ b/test/pleroma/web/activity_pub/publisher_test.exs @@ -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 diff --git a/test/pleroma/web/activity_pub/relay_test.exs b/test/pleroma/web/activity_pub/relay_test.exs index 3284980f7..97dd490b6 100644 --- a/test/pleroma/web/activity_pub/relay_test.exs +++ b/test/pleroma/web/activity_pub/relay_test.exs @@ -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" diff --git a/test/pleroma/web/activity_pub/side_effects_test.exs b/test/pleroma/web/activity_pub/side_effects_test.exs index 297fc0b84..a21ebfd7c 100644 --- a/test/pleroma/web/activity_pub/side_effects_test.exs +++ b/test/pleroma/web/activity_pub/side_effects_test.exs @@ -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) diff --git a/test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs index 485216487..d128246d3 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs @@ -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) diff --git a/test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs index c06bbc5e9..45924e09c 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs @@ -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) diff --git a/test/pleroma/web/activity_pub/transmogrifier/answer_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/answer_handling_test.exs index a1c2ba28a..df9ef3311 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/answer_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/answer_handling_test.exs @@ -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 diff --git a/test/pleroma/web/activity_pub/transmogrifier/article_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/article_handling_test.exs index b0ae804c5..8a7fe2c89 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/article_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/article_handling_test.exs @@ -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{ diff --git a/test/pleroma/web/activity_pub/transmogrifier/audio_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/audio_handling_test.exs index 7a2ac5d4d..72ee16bf0 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/audio_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/audio_handling_test.exs @@ -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") diff --git a/test/pleroma/web/activity_pub/transmogrifier/block_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/block_handling_test.exs index 679c33c6c..45d3cf6f4 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/block_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/block_handling_test.exs @@ -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) diff --git a/test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs b/test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs index 2adaa1ade..bda2952d0 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs @@ -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 = %{ diff --git a/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs index cffaa7c44..20a57d475 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs @@ -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 diff --git a/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs index aea4ed6f8..a6f36b994 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs @@ -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) diff --git a/test/pleroma/web/activity_pub/transmogrifier/event_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/event_handling_test.exs index d7c55cfbe..fe9bd7cad 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/event_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/event_handling_test.exs @@ -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 diff --git a/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs index 985c26def..8242b4db7 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs @@ -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 diff --git a/test/pleroma/web/activity_pub/transmogrifier/like_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/like_handling_test.exs index 967bad151..915d2a41d 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/like_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/like_handling_test.exs @@ -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) diff --git a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs index b4a006aec..9f5acefb2 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs @@ -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 diff --git a/test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs index 47f92cf4d..4ed2ab11d 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs @@ -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 diff --git a/test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs index 5a3bef792..76e850354 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs @@ -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) diff --git a/test/pleroma/web/activity_pub/transmogrifier/undo_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/undo_handling_test.exs index fcfc7b4b6..9cd473fab 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/undo_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/undo_handling_test.exs @@ -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) diff --git a/test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs index c62d5e139..9089b4324 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs @@ -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) diff --git a/test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs index 57411fafa..0a68666ad 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs @@ -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 diff --git a/test/pleroma/web/activity_pub/transmogrifier_test.exs b/test/pleroma/web/activity_pub/transmogrifier_test.exs index 66ea7664a..6a793b316 100644 --- a/test/pleroma/web/activity_pub/transmogrifier_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier_test.exs @@ -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 diff --git a/test/pleroma/web/activity_pub/utils_test.exs b/test/pleroma/web/activity_pub/utils_test.exs index be9cd7d13..8283c8692 100644 --- a/test/pleroma/web/activity_pub/utils_test.exs +++ b/test/pleroma/web/activity_pub/utils_test.exs @@ -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) diff --git a/test/pleroma/web/activity_pub/views/object_view_test.exs b/test/pleroma/web/activity_pub/views/object_view_test.exs index f0389845d..a2ac23930 100644 --- a/test/pleroma/web/activity_pub/views/object_view_test.exs +++ b/test/pleroma/web/activity_pub/views/object_view_test.exs @@ -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) diff --git a/test/pleroma/web/activity_pub/views/user_view_test.exs b/test/pleroma/web/activity_pub/views/user_view_test.exs index 98c7c9d09..f23dcdb7d 100644 --- a/test/pleroma/web/activity_pub/views/user_view_test.exs +++ b/test/pleroma/web/activity_pub/views/user_view_test.exs @@ -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) diff --git a/test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs b/test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs index e50d1425b..6a8e24803 100644 --- a/test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs @@ -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) diff --git a/test/pleroma/web/admin_api/controllers/chat_controller_test.exs b/test/pleroma/web/admin_api/controllers/chat_controller_test.exs index 5aefa1e60..d62eb7fac 100644 --- a/test/pleroma/web/admin_api/controllers/chat_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/chat_controller_test.exs @@ -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) diff --git a/test/pleroma/web/admin_api/controllers/relay_controller_test.exs b/test/pleroma/web/admin_api/controllers/relay_controller_test.exs index 379067a62..5397dea5a 100644 --- a/test/pleroma/web/admin_api/controllers/relay_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/relay_controller_test.exs @@ -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) diff --git a/test/pleroma/web/admin_api/controllers/status_controller_test.exs b/test/pleroma/web/admin_api/controllers/status_controller_test.exs index a18ef9e4b..0378b392d 100644 --- a/test/pleroma/web/admin_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/status_controller_test.exs @@ -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) diff --git a/test/pleroma/web/admin_api/controllers/user_controller_test.exs b/test/pleroma/web/admin_api/controllers/user_controller_test.exs index 5705306c7..7e274e791 100644 --- a/test/pleroma/web/admin_api/controllers/user_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/user_controller_test.exs @@ -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) diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs index 585b2c174..3616003f9 100644 --- a/test/pleroma/web/common_api_test.exs +++ b/test/pleroma/web/common_api_test.exs @@ -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]) diff --git a/test/pleroma/web/federator_test.exs b/test/pleroma/web/federator_test.exs index 67001add7..31c3a4d04 100644 --- a/test/pleroma/web/federator_test.exs +++ b/test/pleroma/web/federator_test.exs @@ -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) diff --git a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs index 3361c8669..564145f05 100644 --- a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs @@ -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) diff --git a/test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs index b977b41ae..f67a93f5a 100644 --- a/test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs @@ -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) diff --git a/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs index 9ac8488f6..1ac42de2b 100644 --- a/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs @@ -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) diff --git a/test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs index f41de6448..f0439142d 100644 --- a/test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs @@ -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 @@ test "votes are added to the poll", %{conn: conn} 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") diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs index 30d542dfa..2699d3e70 100644 --- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -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]) diff --git a/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs index 655e35ac6..9256e3dfd 100644 --- a/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs @@ -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 diff --git a/test/pleroma/web/mastodon_api/mastodon_api_test.exs b/test/pleroma/web/mastodon_api/mastodon_api_test.exs index 687fe5585..66032214f 100644 --- a/test/pleroma/web/mastodon_api/mastodon_api_test.exs +++ b/test/pleroma/web/mastodon_api/mastodon_api_test.exs @@ -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) diff --git a/test/pleroma/web/mastodon_api/update_credentials_test.exs b/test/pleroma/web/mastodon_api/update_credentials_test.exs index ed1921c91..933ca08d3 100644 --- a/test/pleroma/web/mastodon_api/update_credentials_test.exs +++ b/test/pleroma/web/mastodon_api/update_credentials_test.exs @@ -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 diff --git a/test/pleroma/web/mastodon_api/views/account_view_test.exs b/test/pleroma/web/mastodon_api/views/account_view_test.exs index 8c77f14d4..84c46f49b 100644 --- a/test/pleroma/web/mastodon_api/views/account_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/account_view_test.exs @@ -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 diff --git a/test/pleroma/web/mastodon_api/views/notification_view_test.exs b/test/pleroma/web/mastodon_api/views/notification_view_test.exs index 9de11a87e..1f90fd7b4 100644 --- a/test/pleroma/web/mastodon_api/views/notification_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/notification_view_test.exs @@ -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}) diff --git a/test/pleroma/web/mastodon_api/views/poll_view_test.exs b/test/pleroma/web/mastodon_api/views/poll_view_test.exs index c655ca438..14f4c415f 100644 --- a/test/pleroma/web/mastodon_api/views/poll_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/poll_view_test.exs @@ -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 diff --git a/test/pleroma/web/mastodon_api/views/status_view_test.exs b/test/pleroma/web/mastodon_api/views/status_view_test.exs index f2a7469ed..f1d28a4f2 100644 --- a/test/pleroma/web/mastodon_api/views/status_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/status_view_test.exs @@ -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 diff --git a/test/pleroma/web/o_status/o_status_controller_test.exs b/test/pleroma/web/o_status/o_status_controller_test.exs index 65b2c22db..0be790426 100644 --- a/test/pleroma/web/o_status/o_status_controller_test.exs +++ b/test/pleroma/web/o_status/o_status_controller_test.exs @@ -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 diff --git a/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs index 07909d48b..899fedf20 100644 --- a/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs @@ -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} = diff --git a/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs index 415c3decd..15e696b17 100644 --- a/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs @@ -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"]) diff --git a/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs index d9385389b..38fbcef96 100644 --- a/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs @@ -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" diff --git a/test/pleroma/web/pleroma_api/controllers/emoji_reaction_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/emoji_reaction_controller_test.exs index bda9c20c6..8f9f38d16 100644 --- a/test/pleroma/web/pleroma_api/controllers/emoji_reaction_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/emoji_reaction_controller_test.exs @@ -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) diff --git a/test/pleroma/web/pleroma_api/controllers/notification_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/notification_controller_test.exs index bb4fe6c49..1f75d7b5c 100644 --- a/test/pleroma/web/pleroma_api/controllers/notification_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/notification_controller_test.exs @@ -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"]) diff --git a/test/pleroma/web/pleroma_api/controllers/user_import_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/user_import_controller_test.exs index d83d33912..34197d1ad 100644 --- a/test/pleroma/web/pleroma_api/controllers/user_import_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/user_import_controller_test.exs @@ -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 diff --git a/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs b/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs index 93eef00a2..56a76b061 100644 --- a/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs +++ b/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs @@ -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) diff --git a/test/pleroma/web/pleroma_api/views/chat_view_test.exs b/test/pleroma/web/pleroma_api/views/chat_view_test.exs index 02484b705..d78726c1c 100644 --- a/test/pleroma/web/pleroma_api/views/chat_view_test.exs +++ b/test/pleroma/web/pleroma_api/views/chat_view_test.exs @@ -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) diff --git a/test/pleroma/web/push/impl_test.exs b/test/pleroma/web/push/impl_test.exs index 2a4a8fd06..b2148ed53 100644 --- a/test/pleroma/web/push/impl_test.exs +++ b/test/pleroma/web/push/impl_test.exs @@ -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"} -> diff --git a/test/pleroma/web/streamer_test.exs b/test/pleroma/web/streamer_test.exs index ad66ddc9d..95f80c392 100644 --- a/test/pleroma/web/streamer_test.exs +++ b/test/pleroma/web/streamer_test.exs @@ -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]) diff --git a/test/pleroma/web/twitter_api/remote_follow_controller_test.exs b/test/pleroma/web/twitter_api/remote_follow_controller_test.exs index a3e784d13..39941ca99 100644 --- a/test/pleroma/web/twitter_api/remote_follow_controller_test.exs +++ b/test/pleroma/web/twitter_api/remote_follow_controller_test.exs @@ -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 diff --git a/test/pleroma/workers/purge_expired_activity_test.exs b/test/pleroma/workers/purge_expired_activity_test.exs index b5938776d..42582021c 100644 --- a/test/pleroma/workers/purge_expired_activity_test.exs +++ b/test/pleroma/workers/purge_expired_activity_test.exs @@ -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)