1 # Pleroma: A lightweight social networking server
2 # Copyright © 2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ActivityPub.MRF.HellthreadPolicyTest do
9 import Pleroma.Web.ActivityPub.MRF.HellthreadPolicy
11 describe "hellthread filter tests" do
16 "actor" => user.ap_id,
17 "cc" => [user.follower_address],
20 "https://www.w3.org/ns/activitystreams#Public",
21 "https://instace.tld/users/user1",
22 "https://instace.tld/users/user2",
23 "https://instace.tld/users/user3"
27 [user: user, message: message]
30 test "reject test", %{message: message} do
31 Pleroma.Config.put([:mrf_hellthread], %{delist_threshold: 0, reject_threshold: 2})
33 {:reject, nil} = filter(message)
36 test "delist test", %{user: user, message: message} do
37 Pleroma.Config.put([:mrf_hellthread], %{delist_threshold: 2, reject_threshold: 0})
39 {:ok, message} = filter(message)
40 assert user.follower_address in message["to"]
41 assert "https://www.w3.org/ns/activitystreams#Public" in message["cc"]
44 test "excludes follower collection and public URI from threshold count", %{message: message} do
45 Pleroma.Config.put([:mrf_hellthread], %{delist_threshold: 0, reject_threshold: 3})
47 {:ok, _} = filter(message)