diff options
author | Tusooa Zhu <tusooa@kazv.moe> | 2022-05-29 23:50:31 -0400 |
---|---|---|
committer | Tusooa Zhu <tusooa@kazv.moe> | 2022-05-29 23:50:31 -0400 |
commit | c004eb0fa2c0a754a0fb839a961e35f406c57445 (patch) | |
tree | c87e38728a21f781d47431847e27a893b8505ffe /test | |
parent | 8acfe95f3e9d4183fd513cfe828500c852db4d5f (diff) | |
download | pleroma-c004eb0fa2c0a754a0fb839a961e35f406c57445.tar.gz pleroma-c004eb0fa2c0a754a0fb839a961e35f406c57445.zip |
Implement mastodon api for showing edit history
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/status_controller_test.exs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs index dc6912b7b..d98dc0a92 100644 --- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -1990,4 +1990,50 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do } = result end end + + describe "get status history" do + setup do + oauth_access(["read:statuses"]) + end + + test "unedited post", %{conn: conn} do + activity = insert(:note_activity) + + conn = get(conn, "/api/v1/statuses/#{activity.id}/history") + + assert [_] = json_response_and_validate_schema(conn, 200) + end + + test "edited post", %{conn: conn} do + note = + insert( + :note, + data: %{ + "formerRepresentations" => %{ + "type" => "OrderedCollection", + "orderedItems" => [ + %{ + "type" => "Note", + "content" => "mew mew 2", + "summary" => "title 2" + }, + %{ + "type" => "Note", + "content" => "mew mew 1", + "summary" => "title 1" + } + ], + "totalItems" => 2 + } + } + ) + + activity = insert(:note_activity, note: note) + + conn = get(conn, "/api/v1/statuses/#{activity.id}/history") + + assert [_, %{"spoiler_text" => "title 2"}, %{"spoiler_text" => "title 1"}] = + json_response_and_validate_schema(conn, 200) + end + end end |