diff options
| author | Mark Felder <feld@FreeBSD.org> | 2020-09-10 16:02:11 -0500 |
|---|---|---|
| committer | Mark Felder <feld@FreeBSD.org> | 2020-09-10 16:05:22 -0500 |
| commit | 55562ca9362d66553ea3638c91174bbeb6c637f1 (patch) | |
| tree | bb0b57d0a40dec779b0bfbfcbf65f3b9d3bea2b3 /test/web/pleroma_api/views | |
| parent | 39f7fc5b8ef781c98136d1f9be50a14bff394233 (diff) | |
| parent | 6316350918d1f55167fa384d55f385ff2c93e6bb (diff) | |
| download | pleroma-55562ca9362d66553ea3638c91174bbeb6c637f1.tar.gz pleroma-55562ca9362d66553ea3638c91174bbeb6c637f1.zip | |
Merge branch 'develop' into feature/gen-magic
Diffstat (limited to 'test/web/pleroma_api/views')
| -rw-r--r-- | test/web/pleroma_api/views/chat/message_reference_view_test.exs | 15 | ||||
| -rw-r--r-- | test/web/pleroma_api/views/chat_view_test.exs | 3 |
2 files changed, 15 insertions, 3 deletions
diff --git a/test/web/pleroma_api/views/chat/message_reference_view_test.exs b/test/web/pleroma_api/views/chat/message_reference_view_test.exs index e5b165255..40dbae3cd 100644 --- a/test/web/pleroma_api/views/chat/message_reference_view_test.exs +++ b/test/web/pleroma_api/views/chat/message_reference_view_test.exs @@ -43,7 +43,17 @@ defmodule Pleroma.Web.PleromaAPI.Chat.MessageReferenceViewTest do assert chat_message[:unread] == false assert match?([%{shortcode: "firefox"}], chat_message[:emojis]) - {:ok, activity} = CommonAPI.post_chat_message(recipient, user, "gkgkgk", media_id: upload.id) + clear_config([:rich_media, :enabled], true) + + Tesla.Mock.mock(fn + %{url: "https://example.com/ogp"} -> + %Tesla.Env{status: 200, body: File.read!("test/fixtures/rich_media/ogp.html")} + end) + + {:ok, activity} = + CommonAPI.post_chat_message(recipient, user, "gkgkgk https://example.com/ogp", + media_id: upload.id + ) object = Object.normalize(activity) @@ -52,10 +62,11 @@ defmodule Pleroma.Web.PleromaAPI.Chat.MessageReferenceViewTest do chat_message_two = MessageReferenceView.render("show.json", chat_message_reference: cm_ref) assert chat_message_two[:id] == cm_ref.id - assert chat_message_two[:content] == "gkgkgk" + assert chat_message_two[:content] == object.data["content"] assert chat_message_two[:account_id] == recipient.id assert chat_message_two[:chat_id] == chat_message[:chat_id] assert chat_message_two[:attachment] assert chat_message_two[:unread] == true + assert chat_message_two[:card] end end diff --git a/test/web/pleroma_api/views/chat_view_test.exs b/test/web/pleroma_api/views/chat_view_test.exs index 14eecb1bd..02484b705 100644 --- a/test/web/pleroma_api/views/chat_view_test.exs +++ b/test/web/pleroma_api/views/chat_view_test.exs @@ -26,7 +26,8 @@ defmodule Pleroma.Web.PleromaAPI.ChatViewTest do assert represented_chat == %{ id: "#{chat.id}", - account: AccountView.render("show.json", user: recipient), + account: + AccountView.render("show.json", user: recipient, skip_visibility_check: true), unread: 0, last_message: nil, updated_at: Utils.to_masto_date(chat.updated_at) |
