diff options
author | lain <lain@soykaf.club> | 2018-03-30 14:46:36 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2018-03-30 14:46:36 +0200 |
commit | c1d529ee9491fc0040cd4327c783aabf76cb66a8 (patch) | |
tree | 8aaf3a54d61fe3f83c546d934b81a10216625c37 /test | |
parent | 1f1caab138120cf3e08e9d9311570f2c646003d0 (diff) | |
download | pleroma-c1d529ee9491fc0040cd4327c783aabf76cb66a8.tar.gz pleroma-c1d529ee9491fc0040cd4327c783aabf76cb66a8.zip |
TwApi ActivityView: Add announces.
Diffstat (limited to 'test')
-rw-r--r-- | test/web/twitter_api/views/activity_view_test.exs | 33 |
1 files changed, 33 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 244ffd5c4..7615454da 100644 --- a/test/web/twitter_api/views/activity_view_test.exs +++ b/test/web/twitter_api/views/activity_view_test.exs @@ -6,6 +6,8 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do alias Pleroma.Web.TwitterAPI.ActivityView alias Pleroma.Web.TwitterAPI.UserView alias Pleroma.Web.TwitterAPI.TwitterAPI + alias Pleroma.Repo + alias Pleroma.Activity import Pleroma.Factory test "a create activity with a note" do @@ -86,4 +88,35 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do assert result == expected end + + test "an announce activity" do + user = insert(:user) + other_user = insert(:user, %{nickname: "shp"}) + + {:ok, activity} = CommonAPI.post(user, %{"status" => "Hey @shp!"}) + {:ok, announce, _object} = CommonAPI.repeat(activity.id, other_user) + + convo_id = TwitterAPI.context_to_conversation_id(activity.data["object"]["context"]) + + activity = Repo.get(Activity, activity.id) + + result = ActivityView.render("activity.json", activity: announce) + + expected = %{ + "activity_type" => "repeat", + "created_at" => announce.data["published"] |> Utils.date_to_asctime(), + "external_url" => announce.data["id"], + "id" => announce.id, + "is_local" => true, + "is_post_verb" => false, + "statusnet_html" => "shp retweeted a status.", + "text" => "shp retweeted a status.", + "uri" => "tag:#{announce.data["id"]}:objectType=note", + "user" => UserView.render("show.json", user: other_user), + "retweeted_status" => ActivityView.render("activity.json", activity: activity), + "statusnet_conversation_id" => convo_id + } + + assert result == expected + end end |