diff options
author | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2020-02-24 07:28:35 +0000 |
---|---|---|
committer | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2020-02-24 07:28:35 +0000 |
commit | 1e1156b64572e764b7faec13d731c2da647f0de7 (patch) | |
tree | 4370ed1120cf0c1fecd1c7e4ed3a56769845a18b /test/object | |
parent | 1961a680ec8fb333fa34a7b102820388c9cf5aa6 (diff) | |
parent | 8f0ca19b9cafeedc70df2d60bd7bd7c6bf7aa160 (diff) | |
download | pleroma-1e1156b64572e764b7faec13d731c2da647f0de7.tar.gz pleroma-1e1156b64572e764b7faec13d731c2da647f0de7.zip |
Merge branch '1505-threads-federation' into 'develop'
[#1505] Threads / replies federation
Closes #1505
See merge request pleroma/pleroma!2129
Diffstat (limited to 'test/object')
-rw-r--r-- | test/object/fetcher_test.exs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/object/fetcher_test.exs b/test/object/fetcher_test.exs index 2aad7a588..3afd35648 100644 --- a/test/object/fetcher_test.exs +++ b/test/object/fetcher_test.exs @@ -26,6 +26,31 @@ defmodule Pleroma.Object.FetcherTest do :ok end + describe "max thread distance restriction" do + @ap_id "http://mastodon.example.org/@admin/99541947525187367" + + clear_config([:instance, :federation_incoming_replies_max_depth]) + + test "it returns thread depth exceeded error if thread depth is exceeded" do + Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 0) + + assert {:error, "Max thread distance exceeded."} = + Fetcher.fetch_object_from_id(@ap_id, depth: 1) + end + + test "it fetches object if max thread depth is restricted to 0 and depth is not specified" do + Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 0) + + assert {:ok, _} = Fetcher.fetch_object_from_id(@ap_id) + end + + test "it fetches object if requested depth does not exceed max thread depth" do + Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 10) + + assert {:ok, _} = Fetcher.fetch_object_from_id(@ap_id, depth: 10) + end + end + describe "actor origin containment" do test "it rejects objects with a bogus origin" do {:error, _} = Fetcher.fetch_object_from_id("https://info.pleroma.site/activity.json") |