diff options
author | Tusooa Zhu <tusooa@kazv.moe> | 2022-06-04 12:56:56 -0400 |
---|---|---|
committer | Tusooa Zhu <tusooa@kazv.moe> | 2022-06-04 12:57:30 -0400 |
commit | fe2d4778eee5e8b4fe24f8e1d16d1065e9430027 (patch) | |
tree | f8035de445ead9170375a9b0502faeb09d3e72a7 /test | |
parent | 72ac940618efe56e14f02e23e5af75ae275a5c26 (diff) | |
download | pleroma-fe2d4778eee5e8b4fe24f8e1d16d1065e9430027.tar.gz pleroma-fe2d4778eee5e8b4fe24f8e1d16d1065e9430027.zip |
Expose content type of status sources
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/mastodon_api/views/status_view_test.exs | 36 |
1 files changed, 36 insertions, 0 deletions
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 44cc003f3..297889449 100644 --- a/test/pleroma/web/mastodon_api/views/status_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/status_view_test.exs @@ -724,4 +724,40 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do status = StatusView.render("show.json", activity: edited) assert status.edited_at end + + test "with a source object" do + note = + insert(:note, + data: %{"source" => %{"content" => "object source", "mediaType" => "text/markdown"}} + ) + + activity = insert(:note_activity, note: note) + + status = StatusView.render("show.json", activity: activity, with_source: true) + assert status.text == "object source" + end + + describe "source.json" do + test "with a source object, renders both source and content type" do + note = + insert(:note, + data: %{"source" => %{"content" => "object source", "mediaType" => "text/markdown"}} + ) + + activity = insert(:note_activity, note: note) + + status = StatusView.render("source.json", activity: activity) + assert status.text == "object source" + assert status.content_type == "text/markdown" + end + + test "with a source string, renders source and put text/plain as the content type" do + note = insert(:note, data: %{"source" => "string source"}) + activity = insert(:note_activity, note: note) + + status = StatusView.render("source.json", activity: activity) + assert status.text == "string source" + assert status.content_type == "text/plain" + end + end end |