diff options
author | Henry Jameson <me@hjkos.com> | 2018-08-27 17:07:26 +0300 |
---|---|---|
committer | Henry Jameson <me@hjkos.com> | 2018-08-27 17:07:26 +0300 |
commit | 0f1c629d657f569058c36fb0f0c7855a261d5257 (patch) | |
tree | ff8af640c3c28ae0bd7ba474e79bbadfb56a7693 /test | |
parent | 9b046d2a8481c50e244071be1192830e0bbd08bc (diff) | |
download | pleroma-0f1c629d657f569058c36fb0f0c7855a261d5257.tar.gz pleroma-0f1c629d657f569058c36fb0f0c7855a261d5257.zip |
better solution, added test.
Diffstat (limited to 'test')
-rw-r--r-- | test/web/twitter_api/views/activity_view_test.exs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/web/twitter_api/views/activity_view_test.exs b/test/web/twitter_api/views/activity_view_test.exs index a101e4ae8..b9a8efdad 100644 --- a/test/web/twitter_api/views/activity_view_test.exs +++ b/test/web/twitter_api/views/activity_view_test.exs @@ -126,6 +126,33 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do assert result == expected end + test "a like activity for deleted post" do + user = insert(:user) + other_user = insert(:user, %{nickname: "shp"}) + + {:ok, activity} = CommonAPI.post(user, %{"status" => "Hey @shp!"}) + {:ok, like, _object} = CommonAPI.favorite(activity.id, other_user) + CommonAPI.delete(activity.id, user) + + result = ActivityView.render("activity.json", activity: like) + + expected = %{ + "activity_type" => "like", + "created_at" => like.data["published"] |> Utils.date_to_asctime(), + "external_url" => like.data["id"], + "id" => like.id, + "in_reply_to_status_id" => nil, + "is_local" => true, + "is_post_verb" => false, + "statusnet_html" => "shp favorited a status.", + "text" => "shp favorited a status.", + "uri" => "tag:#{like.data["id"]}:objectType=Favourite", + "user" => UserView.render("show.json", user: other_user) + } + + assert result == expected + end + test "an announce activity" do user = insert(:user) other_user = insert(:user, %{nickname: "shp"}) |