diff options
| author | lain <lain@soykaf.club> | 2020-05-06 16:12:36 +0200 |
|---|---|---|
| committer | lain <lain@soykaf.club> | 2020-05-06 16:12:36 +0200 |
| commit | 20baa2eaf04425cf0a2eebc84760be6c12ee7f51 (patch) | |
| tree | 5034177137693546741945fed7476c2fb77b8dbd /test/web/pleroma_api/views | |
| parent | 205313e54146c00374e3edfa951132a7229fa16d (diff) | |
| download | pleroma-20baa2eaf04425cf0a2eebc84760be6c12ee7f51.tar.gz pleroma-20baa2eaf04425cf0a2eebc84760be6c12ee7f51.zip | |
ChatMessages: Add attachments.
Diffstat (limited to 'test/web/pleroma_api/views')
| -rw-r--r-- | test/web/pleroma_api/views/chat_message_view_test.exs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/web/pleroma_api/views/chat_message_view_test.exs b/test/web/pleroma_api/views/chat_message_view_test.exs index 5c4c8b0d5..a13a41daa 100644 --- a/test/web/pleroma_api/views/chat_message_view_test.exs +++ b/test/web/pleroma_api/views/chat_message_view_test.exs @@ -9,12 +9,21 @@ defmodule Pleroma.Web.PleromaAPI.ChatMessageViewTest do alias Pleroma.Object alias Pleroma.Web.CommonAPI alias Pleroma.Web.PleromaAPI.ChatMessageView + alias Pleroma.Web.ActivityPub.ActivityPub import Pleroma.Factory test "it displays a chat message" do user = insert(:user) recipient = insert(:user) + + file = %Plug.Upload{ + content_type: "image/jpg", + path: Path.absname("test/fixtures/image.jpg"), + filename: "an_image.jpg" + } + + {:ok, upload} = ActivityPub.upload(file, actor: user.ap_id) {:ok, activity} = CommonAPI.post_chat_message(user, recipient, "kippis :firefox:") chat = Chat.get(user.id, recipient.ap_id) @@ -30,7 +39,7 @@ defmodule Pleroma.Web.PleromaAPI.ChatMessageViewTest do assert chat_message[:created_at] assert match?([%{shortcode: "firefox"}], chat_message[:emojis]) - {:ok, activity} = CommonAPI.post_chat_message(recipient, user, "gkgkgk") + {:ok, activity} = CommonAPI.post_chat_message(recipient, user, "gkgkgk", media_id: upload.id) object = Object.normalize(activity) @@ -40,5 +49,6 @@ defmodule Pleroma.Web.PleromaAPI.ChatMessageViewTest do assert chat_message_two[:content] == "gkgkgk" assert chat_message_two[:account_id] == recipient.id assert chat_message_two[:chat_id] == chat_message[:chat_id] + assert chat_message_two[:attachment] end end |
