diff options
author | lain <lain@soykaf.club> | 2020-05-12 13:23:09 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-05-12 13:23:09 +0200 |
commit | ec72cba43ec4f45faadf1b06a6d014cd4136707e (patch) | |
tree | 291b918ffe881c15b981d02a4805b348d3706249 /test | |
parent | dcb5cda324c5a8233c100e49d0ad137a5daffd71 (diff) | |
download | pleroma-ec72cba43ec4f45faadf1b06a6d014cd4136707e.tar.gz |
Chat Controller: Add basic error handling.
Diffstat (limited to 'test')
-rw-r--r-- | test/web/pleroma_api/controllers/chat_controller_test.exs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/web/pleroma_api/controllers/chat_controller_test.exs b/test/web/pleroma_api/controllers/chat_controller_test.exs index 86ccbb117..75d4903ed 100644 --- a/test/web/pleroma_api/controllers/chat_controller_test.exs +++ b/test/web/pleroma_api/controllers/chat_controller_test.exs @@ -88,6 +88,8 @@ defmodule Pleroma.Web.PleromaAPI.ChatControllerTest do {:ok, message} = CommonAPI.post_chat_message(user, recipient, "Hello darkness my old friend") + {:ok, other_message} = CommonAPI.post_chat_message(recipient, user, "nico nico ni") + object = Object.normalize(message, false) chat = Chat.get(user.id, recipient.ap_id) @@ -99,6 +101,16 @@ defmodule Pleroma.Web.PleromaAPI.ChatControllerTest do |> json_response_and_validate_schema(200) assert result["id"] == to_string(object.id) + + object = Object.normalize(other_message, false) + + result = + conn + |> put_req_header("content-type", "application/json") + |> delete("/api/v1/pleroma/chats/#{chat.id}/messages/#{object.id}") + |> json_response(400) + + assert result == %{"error" => "could_not_delete"} end end |