diff options
author | Maksim Pechnikov <parallel588@gmail.com> | 2020-09-18 07:08:37 +0300 |
---|---|---|
committer | Maksim Pechnikov <parallel588@gmail.com> | 2020-09-18 07:08:37 +0300 |
commit | 2ec0dcf00194544449a5d7768ab10777b294895b (patch) | |
tree | 1c2f097403f48e6f43894ac792ce77dc5992b32d /test/web/pleroma_api/controllers/chat_controller_test.exs | |
parent | 5a8ea0a5b07c22d567a60af36345483fe880b638 (diff) | |
parent | 49584a9928f02b461a0356332440084473ea6b69 (diff) | |
download | pleroma-2ec0dcf00194544449a5d7768ab10777b294895b.tar.gz pleroma-2ec0dcf00194544449a5d7768ab10777b294895b.zip |
Merge branch 'develop' into issue/2099
Diffstat (limited to 'test/web/pleroma_api/controllers/chat_controller_test.exs')
-rw-r--r-- | test/web/pleroma_api/controllers/chat_controller_test.exs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/test/web/pleroma_api/controllers/chat_controller_test.exs b/test/web/pleroma_api/controllers/chat_controller_test.exs index 7be5fe09c..44a78a738 100644 --- a/test/web/pleroma_api/controllers/chat_controller_test.exs +++ b/test/web/pleroma_api/controllers/chat_controller_test.exs @@ -100,7 +100,7 @@ defmodule Pleroma.Web.PleromaAPI.ChatControllerTest do |> post("/api/v1/pleroma/chats/#{chat.id}/messages") |> json_response_and_validate_schema(400) - assert result + assert %{"error" => "no_content"} == result end test "it works with an attachment", %{conn: conn, user: user} do @@ -126,6 +126,23 @@ defmodule Pleroma.Web.PleromaAPI.ChatControllerTest do assert result["attachment"] end + + test "gets MRF reason when rejected", %{conn: conn, user: user} do + clear_config([:mrf_keyword, :reject], ["GNO"]) + clear_config([:mrf, :policies], [Pleroma.Web.ActivityPub.MRF.KeywordPolicy]) + + other_user = insert(:user) + + {:ok, chat} = Chat.get_or_create(user.id, other_user.ap_id) + + result = + conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/pleroma/chats/#{chat.id}/messages", %{"content" => "GNO/Linux"}) + |> json_response_and_validate_schema(422) + + assert %{"error" => "[KeywordPolicy] Matches with rejected keyword"} == result + end end describe "DELETE /api/v1/pleroma/chats/:id/messages/:message_id" do |