summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>2020-07-07 07:06:29 +0200
committerrinpatch <rinpatch@sdf.org>2020-09-08 20:21:34 +0300
commit10ef532c63431811b3998ed7b14aea21755a2b57 (patch)
tree9071a98208b3a9275b61e3df68f3419a3dca1107 /test
parenta781ac6ca5b7ab23eea795331db0a3fff406630e (diff)
downloadpleroma-10ef532c63431811b3998ed7b14aea21755a2b57.tar.gz
pleroma-10ef532c63431811b3998ed7b14aea21755a2b57.zip
AP C2S: Restrict character limit on Note
Diffstat (limited to 'test')
-rw-r--r--test/web/activity_pub/activity_pub_controller_test.exs16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/web/activity_pub/activity_pub_controller_test.exs b/test/web/activity_pub/activity_pub_controller_test.exs
index 57988dc1e..0517571f2 100644
--- a/test/web/activity_pub/activity_pub_controller_test.exs
+++ b/test/web/activity_pub/activity_pub_controller_test.exs
@@ -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