diff options
author | lain <lain@soykaf.club> | 2020-04-20 12:08:47 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-04-20 12:08:47 +0200 |
commit | 5b6818b3e5dc39e328f6f8d4b8f4587e5e1cef94 (patch) | |
tree | fdda33fa406fc12e4fac23f285ed4a8af04e5083 /test/web/common_api/common_api_test.exs | |
parent | ce23673ca1539350802326c62d6e72bd040950f6 (diff) | |
download | pleroma-5b6818b3e5dc39e328f6f8d4b8f4587e5e1cef94.tar.gz |
CommonAPI: Obey local limit for chat messages.
Diffstat (limited to 'test/web/common_api/common_api_test.exs')
-rw-r--r-- | test/web/common_api/common_api_test.exs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs index 1984aac8d..c17e30210 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/web/common_api/common_api_test.exs @@ -23,6 +23,8 @@ defmodule Pleroma.Web.CommonAPITest do setup do: clear_config([:instance, :max_pinned_statuses]) describe "posting chat messages" do + setup do: clear_config([:instance, :chat_limit]) + test "it posts a chat message" do author = insert(:user) recipient = insert(:user) @@ -47,6 +49,22 @@ defmodule Pleroma.Web.CommonAPITest do assert Chat.get(author.id, recipient.ap_id) assert Chat.get(recipient.id, author.ap_id) end + + test "it reject messages over the local limit" do + Pleroma.Config.put([:instance, :chat_limit], 2) + + author = insert(:user) + recipient = insert(:user) + + {:error, message} = + CommonAPI.post_chat_message( + author, + recipient, + "123" + ) + + assert message == :content_too_long + end end test "when replying to a conversation / participation, it will set the correct context id even if no explicit reply_to is given" do |