Max media attachment count
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
60deddb7e5
commit
e473bcf7a0
6 changed files with 58 additions and 2 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue