X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=test%2Fpleroma%2Fweb%2Factivity_pub%2Fpipeline_test.exs;h=e606fa3d11fbc3353ab797b29203f2e41d50b0aa;hb=cea44b6b3ebac3976699d2460ae53d8506b86445;hp=d0e3fb3477be70be33b5afcebf2f5fdaa9343f95;hpb=5db1e6c8d37ea114433afe0a9247314ab92cc52f;p=akkoma
diff --git a/test/pleroma/web/activity_pub/pipeline_test.exs b/test/pleroma/web/activity_pub/pipeline_test.exs
index d0e3fb347..e606fa3d1 100644
--- a/test/pleroma/web/activity_pub/pipeline_test.exs
+++ b/test/pleroma/web/activity_pub/pipeline_test.exs
@@ -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.Web.ActivityPub.PipelineTest do
@@ -8,12 +8,12 @@ defmodule Pleroma.Web.ActivityPub.PipelineTest do
import Mox
import Pleroma.Factory
+ alias Pleroma.ConfigMock
alias Pleroma.Web.ActivityPub.ActivityPubMock
alias Pleroma.Web.ActivityPub.MRFMock
alias Pleroma.Web.ActivityPub.ObjectValidatorMock
alias Pleroma.Web.ActivityPub.SideEffectsMock
alias Pleroma.Web.FederatorMock
- alias Pleroma.ConfigMock
setup :verify_on_exit!
@@ -25,9 +25,6 @@ defmodule Pleroma.Web.ActivityPub.PipelineTest do
MRFMock
|> expect(:pipeline_filter, fn o, m -> {:ok, o, m} end)
- ActivityPubMock
- |> expect(:persist, fn o, m -> {:ok, o, m} end)
-
SideEffectsMock
|> expect(:handle, fn o, m -> {:ok, o, m} end)
|> expect(:handle_after_transaction, fn m -> m end)
@@ -42,6 +39,9 @@ defmodule Pleroma.Web.ActivityPub.PipelineTest do
activity_with_object = %{activity | data: Map.put(activity.data, "object", object)}
+ ActivityPubMock
+ |> expect(:persist, fn _, m -> {:ok, activity, m} end)
+
FederatorMock
|> expect(:publish, fn ^activity_with_object -> :ok end)
@@ -50,7 +50,7 @@ defmodule Pleroma.Web.ActivityPub.PipelineTest do
assert {:ok, ^activity, ^meta} =
Pleroma.Web.ActivityPub.Pipeline.common_pipeline(
- activity,
+ activity.data,
meta
)
end
@@ -59,6 +59,9 @@ defmodule Pleroma.Web.ActivityPub.PipelineTest do
activity = insert(:note_activity)
meta = [local: true]
+ ActivityPubMock
+ |> expect(:persist, fn _, m -> {:ok, activity, m} end)
+
FederatorMock
|> expect(:publish, fn ^activity -> :ok end)
@@ -66,29 +69,35 @@ defmodule Pleroma.Web.ActivityPub.PipelineTest do
|> expect(:get, fn [:instance, :federating] -> true end)
assert {:ok, ^activity, ^meta} =
- Pleroma.Web.ActivityPub.Pipeline.common_pipeline(activity, meta)
+ Pleroma.Web.ActivityPub.Pipeline.common_pipeline(activity.data, meta)
end
test "it goes through validation, filtering, persisting, side effects without federation for remote activities" do
activity = insert(:note_activity)
meta = [local: false]
+ ActivityPubMock
+ |> expect(:persist, fn _, m -> {:ok, activity, m} end)
+
ConfigMock
|> expect(:get, fn [:instance, :federating] -> true end)
assert {:ok, ^activity, ^meta} =
- Pleroma.Web.ActivityPub.Pipeline.common_pipeline(activity, meta)
+ Pleroma.Web.ActivityPub.Pipeline.common_pipeline(activity.data, meta)
end
test "it goes through validation, filtering, persisting, side effects without federation for local activities if federation is deactivated" do
activity = insert(:note_activity)
meta = [local: true]
+ ActivityPubMock
+ |> expect(:persist, fn _, m -> {:ok, activity, m} end)
+
ConfigMock
|> expect(:get, fn [:instance, :federating] -> false end)
assert {:ok, ^activity, ^meta} =
- Pleroma.Web.ActivityPub.Pipeline.common_pipeline(activity, meta)
+ Pleroma.Web.ActivityPub.Pipeline.common_pipeline(activity.data, meta)
end
end
end