summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMark Felder <feld@feld.me>2023-12-26 15:54:14 -0500
committerMark Felder <feld@feld.me>2023-12-26 15:54:21 -0500
commitd472bafec19cee269e7c943bafae7c805785acd7 (patch)
tree2c7c0199b3c23d84787cc940c4ab24a9d594bce1 /test
parent603e9f6a92e8ea2d2d34d2af26ec2b12fe4b8543 (diff)
downloadpleroma-d472bafec19cee269e7c943bafae7c805785acd7.tar.gz
pleroma-d472bafec19cee269e7c943bafae7c805785acd7.zip
Mark instances as unreachable when returning a 403 from an object fetch
This is a definite sign the instance is blocked and they are enforcing authorized_fetch
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/object/fetcher_test.exs15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/pleroma/object/fetcher_test.exs b/test/pleroma/object/fetcher_test.exs
index 53c9277d6..80272946c 100644
--- a/test/pleroma/object/fetcher_test.exs
+++ b/test/pleroma/object/fetcher_test.exs
@@ -25,6 +25,9 @@ defmodule Pleroma.Object.FetcherTest do
%{method: :get, url: "https://mastodon.example.org/users/userisgone404"} ->
%Tesla.Env{status: 404}
+ %{method: :get, url: "https://octodon.social/users/cwebber/statuses/111647596861000656"} ->
+ %Tesla.Env{status: 403}
+
%{
method: :get,
url:
@@ -233,6 +236,18 @@ defmodule Pleroma.Object.FetcherTest do
)
end
+ test "handle HTTP 403 response" do
+ object_id = "https://octodon.social/users/cwebber/statuses/111647596861000656"
+ Instances.set_reachable(object_id)
+
+ assert Instances.reachable?(object_id)
+
+ assert {:error, "Object fetch has been denied"} ==
+ Fetcher.fetch_object_from_id(object_id)
+
+ refute Instances.reachable?(object_id)
+ end
+
test "it can fetch pleroma polls with attachments" do
{:ok, object} =
Fetcher.fetch_object_from_id("https://patch.cx/objects/tesla_mock/poll_attachment")