diff options
author | Alex Gleason <alex@alexgleason.me> | 2022-02-09 11:14:30 -0600 |
---|---|---|
committer | Alex Gleason <alex@alexgleason.me> | 2022-02-09 11:14:30 -0600 |
commit | c735444f3803a8cff15c1a4aaee82b821ef27441 (patch) | |
tree | 506fb60d08c6daa1dd73384eb31a919d9fcd2f65 /test/pleroma | |
parent | 11f03344d385de78e79e35ccfe8c980f9f6e32b3 (diff) | |
parent | fa8e2ffa3f493d5b2911507b0ac06094615e9d8f (diff) | |
download | pleroma-operation-warpsneed.tar.gz |
Merge remote-tracking branch 'origin/develop' into operation-warpsneedoperation-warpsneed
Diffstat (limited to 'test/pleroma')
-rw-r--r-- | test/pleroma/web/common_api_test.exs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs index 4b186ccfc..16af4b923 100644 --- a/test/pleroma/web/common_api_test.exs +++ b/test/pleroma/web/common_api_test.exs @@ -683,6 +683,32 @@ defmodule Pleroma.Web.CommonAPITest do assert {:ok, _activity} = CommonAPI.post(user, %{status: "12345"}) end + test "it validates media attachment limits are correctly enforced" do + clear_config([:instance, :max_media_attachments], 4) + + user = insert(:user) + + file = %Plug.Upload{ + content_type: "image/jpeg", + path: Path.absname("test/fixtures/image.jpg"), + filename: "an_image.jpg" + } + + {:ok, upload} = ActivityPub.upload(file, actor: user.ap_id) + + assert {:error, "Too many attachments"} = + CommonAPI.post(user, %{ + status: "", + media_ids: List.duplicate(upload.id, 5) + }) + + assert {:ok, _activity} = + CommonAPI.post(user, %{ + status: "", + media_ids: [upload.id] + }) + end + test "it can handle activities that expire" do user = insert(:user) |