Merge branch 'develop' into media-preview-proxy
This commit is contained in:
commit
4ee99dafcc
123 changed files with 1809 additions and 308 deletions
|
|
@ -905,6 +905,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
|
|||
end
|
||||
|
||||
describe "POST /users/:nickname/outbox (C2S)" do
|
||||
setup do: clear_config([:instance, :limit])
|
||||
|
||||
setup do
|
||||
[
|
||||
activity: %{
|
||||
|
|
@ -1121,6 +1123,20 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
|
|||
assert cirno_object.data["actor"] == cirno.ap_id
|
||||
assert cirno_object.data["attributedTo"] == cirno.ap_id
|
||||
end
|
||||
|
||||
test "Character limitation", %{conn: conn, activity: activity} do
|
||||
Pleroma.Config.put([:instance, :limit], 5)
|
||||
user = insert(:user)
|
||||
|
||||
result =
|
||||
conn
|
||||
|> assign(:user, user)
|
||||
|> put_req_header("content-type", "application/activity+json")
|
||||
|> post("/users/#{user.nickname}/outbox", activity)
|
||||
|> json_response(400)
|
||||
|
||||
assert result == "Note is over the character limit"
|
||||
end
|
||||
end
|
||||
|
||||
describe "/relay/followers" do
|
||||
|
|
|
|||
60
test/web/activity_pub/mrf/force_bot_unlisted_policy_test.exs
Normal file
60
test/web/activity_pub/mrf/force_bot_unlisted_policy_test.exs
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Web.ActivityPub.MRF.ForceBotUnlistedPolicyTest do
|
||||
use Pleroma.DataCase
|
||||
import Pleroma.Factory
|
||||
|
||||
alias Pleroma.Web.ActivityPub.MRF.ForceBotUnlistedPolicy
|
||||
@public "https://www.w3.org/ns/activitystreams#Public"
|
||||
|
||||
defp generate_messages(actor) do
|
||||
{%{
|
||||
"actor" => actor.ap_id,
|
||||
"type" => "Create",
|
||||
"object" => %{},
|
||||
"to" => [@public, "f"],
|
||||
"cc" => [actor.follower_address, "d"]
|
||||
},
|
||||
%{
|
||||
"actor" => actor.ap_id,
|
||||
"type" => "Create",
|
||||
"object" => %{"to" => ["f", actor.follower_address], "cc" => ["d", @public]},
|
||||
"to" => ["f", actor.follower_address],
|
||||
"cc" => ["d", @public]
|
||||
}}
|
||||
end
|
||||
|
||||
test "removes from the federated timeline by nickname heuristics 1" do
|
||||
actor = insert(:user, %{nickname: "annoying_ebooks@example.com"})
|
||||
|
||||
{message, except_message} = generate_messages(actor)
|
||||
|
||||
assert ForceBotUnlistedPolicy.filter(message) == {:ok, except_message}
|
||||
end
|
||||
|
||||
test "removes from the federated timeline by nickname heuristics 2" do
|
||||
actor = insert(:user, %{nickname: "cirnonewsnetworkbot@meow.cat"})
|
||||
|
||||
{message, except_message} = generate_messages(actor)
|
||||
|
||||
assert ForceBotUnlistedPolicy.filter(message) == {:ok, except_message}
|
||||
end
|
||||
|
||||
test "removes from the federated timeline by actor type Application" do
|
||||
actor = insert(:user, %{actor_type: "Application"})
|
||||
|
||||
{message, except_message} = generate_messages(actor)
|
||||
|
||||
assert ForceBotUnlistedPolicy.filter(message) == {:ok, except_message}
|
||||
end
|
||||
|
||||
test "removes from the federated timeline by actor type Service" do
|
||||
actor = insert(:user, %{actor_type: "Service"})
|
||||
|
||||
{message, except_message} = generate_messages(actor)
|
||||
|
||||
assert ForceBotUnlistedPolicy.filter(message) == {:ok, except_message}
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue