diff options
author | rinpatch <rinpatch@sdf.org> | 2020-09-07 16:38:16 +0000 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2020-09-08 12:51:38 +0300 |
commit | 718c7cc8473282a9239cc125e10b54df7ed5e0fe (patch) | |
tree | bcfe2dd9311c36a8e94130e102dcbad7287c4c23 /test | |
parent | 73dd5bdb7dcdf804bdbabcf632671d4de5042ebc (diff) | |
download | pleroma-718c7cc8473282a9239cc125e10b54df7ed5e0fe.tar.gz |
Merge branch 'fix/apc2s-limits' into 'develop'
AP C2S: Restrict character limit on Note
Closes #2
See merge request pleroma/secteam/pleroma!9
Diffstat (limited to 'test')
-rw-r--r-- | test/web/activity_pub/activity_pub_controller_test.exs | 16 |
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 |