Merge branch 'develop' into gun
This commit is contained in:
commit
9bae9b1b1b
108 changed files with 1075 additions and 390 deletions
|
|
@ -26,12 +26,10 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
|
|||
:ok
|
||||
end
|
||||
|
||||
clear_config([:instance, :federating]) do
|
||||
Config.put([:instance, :federating], true)
|
||||
end
|
||||
setup do: clear_config([:instance, :federating], true)
|
||||
|
||||
describe "/relay" do
|
||||
clear_config([:instance, :allow_relay])
|
||||
setup do: clear_config([:instance, :allow_relay])
|
||||
|
||||
test "with the relay active, it returns the relay user", %{conn: conn} do
|
||||
res =
|
||||
|
|
@ -1227,8 +1225,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
|
|||
|> json_response(403)
|
||||
end
|
||||
|
||||
clear_config([:media_proxy])
|
||||
clear_config([Pleroma.Upload])
|
||||
setup do: clear_config([:media_proxy])
|
||||
setup do: clear_config([Pleroma.Upload])
|
||||
|
||||
test "POST /api/ap/upload_media", %{conn: conn} do
|
||||
user = insert(:user)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
|
|||
:ok
|
||||
end
|
||||
|
||||
clear_config([:instance, :federating])
|
||||
setup do: clear_config([:instance, :federating])
|
||||
|
||||
describe "streaming out participations" do
|
||||
test "it streams them out" do
|
||||
|
|
@ -1396,7 +1396,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
|
|||
end
|
||||
|
||||
describe "deletion" do
|
||||
clear_config([:instance, :rewrite_policy])
|
||||
setup do: clear_config([:instance, :rewrite_policy])
|
||||
|
||||
test "it reverts deletion on error" do
|
||||
note = insert(:note_activity)
|
||||
|
|
@ -1580,7 +1580,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
|
|||
end
|
||||
|
||||
describe "update" do
|
||||
clear_config([:instance, :max_pinned_statuses])
|
||||
setup do: clear_config([:instance, :max_pinned_statuses])
|
||||
|
||||
test "it creates an update activity with the new user data" do
|
||||
user = insert(:user)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.HellthreadPolicyTest do
|
|||
[user: user, message: message]
|
||||
end
|
||||
|
||||
clear_config(:mrf_hellthread)
|
||||
setup do: clear_config(:mrf_hellthread)
|
||||
|
||||
describe "reject" do
|
||||
test "rejects the message if the recipient count is above reject_threshold", %{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.KeywordPolicyTest do
|
|||
|
||||
alias Pleroma.Web.ActivityPub.MRF.KeywordPolicy
|
||||
|
||||
clear_config(:mrf_keyword)
|
||||
setup do: clear_config(:mrf_keyword)
|
||||
|
||||
setup do
|
||||
Pleroma.Config.put([:mrf_keyword], %{reject: [], federated_timeline_removal: [], replace: []})
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.MentionPolicyTest do
|
|||
|
||||
alias Pleroma.Web.ActivityPub.MRF.MentionPolicy
|
||||
|
||||
clear_config(:mrf_mention)
|
||||
setup do: clear_config(:mrf_mention)
|
||||
|
||||
test "pass filter if allow list is empty" do
|
||||
Pleroma.Config.delete([:mrf_mention])
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ defmodule Pleroma.Web.ActivityPub.MRFTest do
|
|||
end
|
||||
|
||||
describe "describe/0" do
|
||||
clear_config([:instance, :rewrite_policy])
|
||||
setup do: clear_config([:instance, :rewrite_policy])
|
||||
|
||||
test "it works as expected with noop policy" do
|
||||
expected = %{
|
||||
|
|
|
|||
|
|
@ -9,12 +9,11 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicyTest do
|
|||
alias Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy
|
||||
alias Pleroma.Web.ActivityPub.Visibility
|
||||
|
||||
clear_config([:mrf_object_age]) do
|
||||
Config.put(:mrf_object_age,
|
||||
threshold: 172_800,
|
||||
actions: [:delist, :strip_followers]
|
||||
)
|
||||
end
|
||||
setup do:
|
||||
clear_config(:mrf_object_age,
|
||||
threshold: 172_800,
|
||||
actions: [:delist, :strip_followers]
|
||||
)
|
||||
|
||||
setup_all do
|
||||
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.RejectNonPublicTest do
|
|||
|
||||
alias Pleroma.Web.ActivityPub.MRF.RejectNonPublic
|
||||
|
||||
clear_config([:mrf_rejectnonpublic])
|
||||
setup do: clear_config([:mrf_rejectnonpublic])
|
||||
|
||||
describe "public message" do
|
||||
test "it's allowed when address is public" do
|
||||
|
|
|
|||
|
|
@ -8,18 +8,17 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicyTest do
|
|||
alias Pleroma.Config
|
||||
alias Pleroma.Web.ActivityPub.MRF.SimplePolicy
|
||||
|
||||
clear_config([:mrf_simple]) do
|
||||
Config.put(:mrf_simple,
|
||||
media_removal: [],
|
||||
media_nsfw: [],
|
||||
federated_timeline_removal: [],
|
||||
report_removal: [],
|
||||
reject: [],
|
||||
accept: [],
|
||||
avatar_removal: [],
|
||||
banner_removal: []
|
||||
)
|
||||
end
|
||||
setup do:
|
||||
clear_config(:mrf_simple,
|
||||
media_removal: [],
|
||||
media_nsfw: [],
|
||||
federated_timeline_removal: [],
|
||||
report_removal: [],
|
||||
reject: [],
|
||||
accept: [],
|
||||
avatar_removal: [],
|
||||
banner_removal: []
|
||||
)
|
||||
|
||||
describe "when :media_removal" do
|
||||
test "is empty" do
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.SubchainPolicyTest do
|
|||
"type" => "Create",
|
||||
"object" => %{"content" => "hi"}
|
||||
}
|
||||
|
||||
clear_config([:mrf_subchain, :match_actor])
|
||||
setup do: clear_config([:mrf_subchain, :match_actor])
|
||||
|
||||
test "it matches and processes subchains when the actor matches a configured target" do
|
||||
Pleroma.Config.put([:mrf_subchain, :match_actor], %{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.UserAllowListPolicyTest do
|
|||
|
||||
alias Pleroma.Web.ActivityPub.MRF.UserAllowListPolicy
|
||||
|
||||
clear_config([:mrf_user_allowlist, :localhost])
|
||||
setup do: clear_config([:mrf_user_allowlist, :localhost])
|
||||
|
||||
test "pass filter if allow list is empty" do
|
||||
actor = insert(:user)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do
|
|||
alias Pleroma.Web.ActivityPub.MRF.VocabularyPolicy
|
||||
|
||||
describe "accept" do
|
||||
clear_config([:mrf_vocabulary, :accept])
|
||||
setup do: clear_config([:mrf_vocabulary, :accept])
|
||||
|
||||
test "it accepts based on parent activity type" do
|
||||
Pleroma.Config.put([:mrf_vocabulary, :accept], ["Like"])
|
||||
|
|
@ -65,7 +65,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do
|
|||
end
|
||||
|
||||
describe "reject" do
|
||||
clear_config([:mrf_vocabulary, :reject])
|
||||
setup do: clear_config([:mrf_vocabulary, :reject])
|
||||
|
||||
test "it rejects based on parent activity type" do
|
||||
Pleroma.Config.put([:mrf_vocabulary, :reject], ["Like"])
|
||||
|
|
|
|||
|
|
@ -23,9 +23,7 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
|
|||
:ok
|
||||
end
|
||||
|
||||
clear_config_all([:instance, :federating]) do
|
||||
Pleroma.Config.put([:instance, :federating], true)
|
||||
end
|
||||
setup_all do: clear_config([:instance, :federating], true)
|
||||
|
||||
describe "gather_webfinger_links/1" do
|
||||
test "it returns links" do
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ defmodule Pleroma.Web.ActivityPub.RelayTest do
|
|||
end
|
||||
|
||||
describe "publish/1" do
|
||||
clear_config([:instance, :federating])
|
||||
setup do: clear_config([:instance, :federating])
|
||||
|
||||
test "returns error when activity not `Create` type" do
|
||||
activity = insert(:like_activity)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.FollowHandlingTest do
|
|||
end
|
||||
|
||||
describe "handle_incoming" do
|
||||
clear_config([:user, :deny_follow_blocked])
|
||||
setup do: clear_config([:user, :deny_follow_blocked])
|
||||
|
||||
test "it works for osada follow request" do
|
||||
user = insert(:user)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
:ok
|
||||
end
|
||||
|
||||
clear_config([:instance, :max_remote_account_fields])
|
||||
setup do: clear_config([:instance, :max_remote_account_fields])
|
||||
|
||||
describe "handle_incoming" do
|
||||
test "it ignores an incoming notice if we already have it" do
|
||||
|
|
@ -1351,11 +1351,8 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
end
|
||||
|
||||
describe "`handle_incoming/2`, Mastodon format `replies` handling" do
|
||||
clear_config([:activitypub, :note_replies_output_limit]) do
|
||||
Pleroma.Config.put([:activitypub, :note_replies_output_limit], 5)
|
||||
end
|
||||
|
||||
clear_config([:instance, :federation_incoming_replies_max_depth])
|
||||
setup do: clear_config([:activitypub, :note_replies_output_limit], 5)
|
||||
setup do: clear_config([:instance, :federation_incoming_replies_max_depth])
|
||||
|
||||
setup do
|
||||
data =
|
||||
|
|
@ -1394,11 +1391,8 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
end
|
||||
|
||||
describe "`handle_incoming/2`, Pleroma format `replies` handling" do
|
||||
clear_config([:activitypub, :note_replies_output_limit]) do
|
||||
Pleroma.Config.put([:activitypub, :note_replies_output_limit], 5)
|
||||
end
|
||||
|
||||
clear_config([:instance, :federation_incoming_replies_max_depth])
|
||||
setup do: clear_config([:activitypub, :note_replies_output_limit], 5)
|
||||
setup do: clear_config([:instance, :federation_incoming_replies_max_depth])
|
||||
|
||||
setup do
|
||||
user = insert(:user)
|
||||
|
|
@ -1882,7 +1876,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
end
|
||||
|
||||
describe "fix_in_reply_to/2" do
|
||||
clear_config([:instance, :federation_incoming_replies_max_depth])
|
||||
setup do: clear_config([:instance, :federation_incoming_replies_max_depth])
|
||||
|
||||
setup do
|
||||
data = Poison.decode!(File.read!("test/fixtures/mastodon-post-activity.json"))
|
||||
|
|
@ -2145,9 +2139,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
end
|
||||
|
||||
describe "set_replies/1" do
|
||||
clear_config([:activitypub, :note_replies_output_limit]) do
|
||||
Pleroma.Config.put([:activitypub, :note_replies_output_limit], 2)
|
||||
end
|
||||
setup do: clear_config([:activitypub, :note_replies_output_limit], 2)
|
||||
|
||||
test "returns unmodified object if activity doesn't have self-replies" do
|
||||
data = Poison.decode!(File.read!("test/fixtures/mastodon-post-activity.json"))
|
||||
|
|
|
|||
|
|
@ -37,9 +37,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectViewTest do
|
|||
end
|
||||
|
||||
describe "note activity's `replies` collection rendering" do
|
||||
clear_config([:activitypub, :note_replies_output_limit]) do
|
||||
Pleroma.Config.put([:activitypub, :note_replies_output_limit], 5)
|
||||
end
|
||||
setup do: clear_config([:activitypub, :note_replies_output_limit], 5)
|
||||
|
||||
test "renders `replies` collection for a note activity" do
|
||||
user = insert(:user)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue