summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMark Felder <feld@feld.me>2024-08-06 11:15:35 -0400
committerMark Felder <feld@feld.me>2024-08-06 11:16:04 -0400
commitf8bdcaa161575e40097a82481009620edc5a0696 (patch)
tree85464761e8908d90670e8c411df21f2fd309ab36 /test
parent16ba2742b78b136d8e89edfe7847dc3d2f35ed14 (diff)
downloadpleroma-f8bdcaa161575e40097a82481009620edc5a0696.tar.gz
pleroma-f8bdcaa161575e40097a82481009620edc5a0696.zip
Split Federator.publish_one/1 into a second function called prepare_one/1
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/web/activity_pub/publisher_test.exs27
1 files changed, 18 insertions, 9 deletions
diff --git a/test/pleroma/web/activity_pub/publisher_test.exs b/test/pleroma/web/activity_pub/publisher_test.exs
index 1992fb228..370b4b4d2 100644
--- a/test/pleroma/web/activity_pub/publisher_test.exs
+++ b/test/pleroma/web/activity_pub/publisher_test.exs
@@ -151,18 +151,20 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
_actor = insert(:user)
assert {:ok, %{body: "port 42"}} =
- Publisher.publish_one(%{
+ Publisher.prepare_one(%{
inbox: inbox42,
activity_id: activity.id,
unreachable_since: true
})
+ |> Publisher.publish_one()
assert {:ok, %{body: "port 80"}} =
- Publisher.publish_one(%{
+ Publisher.prepare_one(%{
inbox: inbox80,
activity_id: activity.id,
unreachable_since: true
})
+ |> Publisher.publish_one()
end
test_with_mock "calls `Instances.set_reachable` on successful federation if `unreachable_since` is not specified",
@@ -174,7 +176,8 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
activity = insert(:note_activity)
assert {:ok, _} =
- Publisher.publish_one(%{inbox: inbox, activity_id: activity.id})
+ Publisher.prepare_one(%{inbox: inbox, activity_id: activity.id})
+ |> Publisher.publish_one()
assert called(Instances.set_reachable(inbox))
end
@@ -188,11 +191,12 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
activity = insert(:note_activity)
assert {:ok, _} =
- Publisher.publish_one(%{
+ Publisher.prepare_one(%{
inbox: inbox,
activity_id: activity.id,
unreachable_since: NaiveDateTime.utc_now()
})
+ |> Publisher.publish_one()
assert called(Instances.set_reachable(inbox))
end
@@ -206,11 +210,12 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
activity = insert(:note_activity)
assert {:ok, _} =
- Publisher.publish_one(%{
+ Publisher.prepare_one(%{
inbox: inbox,
activity_id: activity.id,
unreachable_since: nil
})
+ |> Publisher.publish_one()
refute called(Instances.set_reachable(inbox))
end
@@ -224,7 +229,8 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
activity = insert(:note_activity)
assert {:cancel, _} =
- Publisher.publish_one(%{inbox: inbox, activity_id: activity.id})
+ Publisher.prepare_one(%{inbox: inbox, activity_id: activity.id})
+ |> Publisher.publish_one()
assert called(Instances.set_unreachable(inbox))
end
@@ -239,10 +245,11 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
assert capture_log(fn ->
assert {:error, _} =
- Publisher.publish_one(%{
+ Publisher.prepare_one(%{
inbox: inbox,
activity_id: activity.id
})
+ |> Publisher.publish_one()
end) =~ "connrefused"
assert called(Instances.set_unreachable(inbox))
@@ -257,7 +264,8 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
activity = insert(:note_activity)
assert {:ok, _} =
- Publisher.publish_one(%{inbox: inbox, activity_id: activity.id})
+ Publisher.prepare_one(%{inbox: inbox, activity_id: activity.id})
+ |> Publisher.publish_one()
refute called(Instances.set_unreachable(inbox))
end
@@ -272,11 +280,12 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
assert capture_log(fn ->
assert {:error, _} =
- Publisher.publish_one(%{
+ Publisher.prepare_one(%{
inbox: inbox,
activity_id: activity.id,
unreachable_since: NaiveDateTime.utc_now()
})
+ |> Publisher.publish_one()
end) =~ "connrefused"
refute called(Instances.set_unreachable(inbox))