diff options
author | lain <lain@soykaf.club> | 2020-04-09 17:18:31 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-04-09 17:18:31 +0200 |
commit | 2cc68414245805dc3b83c200798e424f139e71fc (patch) | |
tree | f2c58b2a6d9e7ea385f22081f0d218de1654f1c0 /test | |
parent | e8fd0dd689be0c7bbca006f7267955329279da98 (diff) | |
download | pleroma-2cc68414245805dc3b83c200798e424f139e71fc.tar.gz |
ChatController: Basic message posting.
Diffstat (limited to 'test')
-rw-r--r-- | test/web/pleroma_api/controllers/chat_controller_test.exs | 17 |
1 files changed, 17 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 6b2db5064..b4230e5ad 100644 --- a/test/web/pleroma_api/controllers/chat_controller_test.exs +++ b/test/web/pleroma_api/controllers/chat_controller_test.exs @@ -9,6 +9,23 @@ defmodule Pleroma.Web.PleromaAPI.ChatControllerTest do import Pleroma.Factory + describe "POST /api/v1/pleroma/chats/:id/messages" do + test "it posts a message to the chat", %{conn: conn} do + user = insert(:user) + other_user = insert(:user) + + {:ok, chat} = Chat.get_or_create(user.id, other_user.ap_id) + + result = + conn + |> assign(:user, user) + |> post("/api/v1/pleroma/chats/#{chat.id}/messages", %{"content" => "Hallo!!"}) + |> json_response(200) + + assert result["content"] == "Hallo!!" + end + end + describe "GET /api/v1/pleroma/chats/:id/messages" do # TODO # - Test that statuses don't show |