X-Git-Url: https://git.logografos.com/?a=blobdiff_plain;f=test%2Fpleroma%2Fweb%2Fcommon_api_test.exs;h=e60691995c51bdd829f0f67a3abbddc9fe919db9;hb=a127041c8b3e31c9fa487dd5ca4faa29a0a59e6e;hp=5c9103e9fc742b8082a432d8ac9ca2ce1929ec32;hpb=40bfe7919694619570c3e2192dff895c78ce44b9;p=anni diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs old mode 100644 new mode 100755 index 5c9103e..e606919 --- a/test/pleroma/web/common_api_test.exs +++ b/test/pleroma/web/common_api_test.exs @@ -279,6 +279,24 @@ defmodule Pleroma.Web.CommonAPITest do assert {:reject, "[KeywordPolicy] Matches with rejected keyword"} == CommonAPI.post_chat_message(author, recipient, "GNO/Linux") end + + test "it reject messages with attachments not belonging to user" do + author = insert(:user) + not_author = insert(:user) + recipient = author + + attachment = insert(:attachment, %{user: not_author}) + + {:error, message} = + CommonAPI.post_chat_message( + author, + recipient, + "123", + media_id: attachment.id + ) + + assert message == :forbidden + end end describe "unblocking" do