X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fpleroma%2Fweb%2Fmastodon_api%2Fviews%2Fstatus_view_test.exs;h=130de1b179bb55152c26dc6f7a781a361eee568f;hb=62e179f446ac7bfada965fac47e9613ce60091b4;hp=caf2594c0330c6052d94ccc4eb9ddd6aa9206479;hpb=829ae13572d051e965dfa9aedeb64753481b5f2b;p=akkoma diff --git a/test/pleroma/web/mastodon_api/views/status_view_test.exs b/test/pleroma/web/mastodon_api/views/status_view_test.exs index caf2594c0..130de1b17 100644 --- a/test/pleroma/web/mastodon_api/views/status_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/status_view_test.exs @@ -14,7 +14,6 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do alias Pleroma.User alias Pleroma.UserRelationship alias Pleroma.Web.CommonAPI - alias Pleroma.Web.CommonAPI.Utils alias Pleroma.Web.MastodonAPI.AccountView alias Pleroma.Web.MastodonAPI.StatusView @@ -240,7 +239,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do object_data = Object.normalize(note, fetch: false).data user = User.get_cached_by_ap_id(note.data["actor"]) - convo_id = Utils.context_to_conversation_id(object_data["context"]) + convo_id = :erlang.crc32(object_data["context"]) status = StatusView.render("show.json", %{activity: note}) @@ -305,7 +304,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do }, akkoma: %{ source: HTML.filter_tags(object_data["content"]) - } + }, + quote_id: nil, + quote: nil } assert status == expected @@ -393,6 +394,30 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do assert status.in_reply_to_id == to_string(note.id) end + test "a quote" do + note = insert(:note_activity) + user = insert(:user) + + {:ok, activity} = CommonAPI.post(user, %{status: "hehe", quote_id: note.id}) + + status = StatusView.render("show.json", %{activity: activity}) + + assert status.quote_id == to_string(note.id) + + [status] = StatusView.render("index.json", %{activities: [activity], as: :activity}) + + assert status.quote_id == to_string(note.id) + end + + test "a quote that we can't resolve" do + note = insert(:note_activity, quoteUri: "oopsie") + + status = StatusView.render("show.json", %{activity: note}) + + assert is_nil(status.quote_id) + assert is_nil(status.quote) + end + test "contains mentions" do user = insert(:user) mentioned = insert(:user)