summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLain Soykaf <lain@lain.com>2024-03-17 16:57:45 +0400
committerLain Soykaf <lain@lain.com>2024-03-17 16:57:45 +0400
commitcaf855cf9cb9a5cadd2519237c9e7916007f4850 (patch)
treefb122be9531219c39fea93f59eac37d1318c38f7 /test
parent0450da88b6f10f2eb61ecb1758f9f4b4e95182c8 (diff)
downloadpleroma-caf855cf9cb9a5cadd2519237c9e7916007f4850.tar.gz
pleroma-caf855cf9cb9a5cadd2519237c9e7916007f4850.zip
ActivityPub.Publisher: Don't try federating if a user doesn't have an inbox.
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/web/activity_pub/publisher_test.exs12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/pleroma/web/activity_pub/publisher_test.exs b/test/pleroma/web/activity_pub/publisher_test.exs
index 7aa06a5c4..870f1f77a 100644
--- a/test/pleroma/web/activity_pub/publisher_test.exs
+++ b/test/pleroma/web/activity_pub/publisher_test.exs
@@ -25,6 +25,17 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
setup_all do: clear_config([:instance, :federating], true)
+ describe "should_federate?/1" do
+ test "it returns false when the inbox is nil" do
+ refute Publisher.should_federate?(nil, false)
+ refute Publisher.should_federate?(nil, true)
+ end
+
+ test "it returns true when public is true" do
+ assert Publisher.should_federate?(false, true)
+ end
+ end
+
describe "gather_webfinger_links/1" do
test "it returns links" do
user = insert(:user)
@@ -205,6 +216,7 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
refute called(Instances.set_reachable(inbox))
end
+ @tag capture_log: true
test_with_mock "calls `Instances.set_unreachable` on target inbox on non-2xx HTTP response code",
Instances,
[:passthrough],