diff options
author | lain <lain@soykaf.club> | 2018-03-30 15:17:13 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2018-03-30 15:17:13 +0200 |
commit | 1f32ba052c52ad974d17d8b65fb2c66b61eceffe (patch) | |
tree | 034fc0ae955f0add32de20083c94dcafd108c734 /test | |
parent | 4afbef39f49948ddd3b1cd1bbda58ff7e3ac2785 (diff) | |
download | pleroma-1f32ba052c52ad974d17d8b65fb2c66b61eceffe.tar.gz pleroma-1f32ba052c52ad974d17d8b65fb2c66b61eceffe.zip |
TwApi ActivityView: Add follows.
Diffstat (limited to 'test')
-rw-r--r-- | test/web/twitter_api/views/activity_view_test.exs | 29 |
1 files changed, 29 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 7615454da..eca69cdfe 100644 --- a/test/web/twitter_api/views/activity_view_test.exs +++ b/test/web/twitter_api/views/activity_view_test.exs @@ -8,6 +8,8 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do alias Pleroma.Web.TwitterAPI.TwitterAPI alias Pleroma.Repo alias Pleroma.Activity + alias Pleroma.User + alias Pleroma.Web.ActivityPub.ActivityPub import Pleroma.Factory test "a create activity with a note" do @@ -119,4 +121,31 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do assert result == expected end + + test "A follow activity" do + user = insert(:user) + other_user = insert(:user, %{nickname: "shp"}) + + {:ok, activity} = CommonAPI.post(user, %{"status" => "Hey @shp!"}) + {:ok, follower} = User.follow(user, other_user) + {:ok, follow} = ActivityPub.follow(follower, other_user) + + result = ActivityView.render("activity.json", activity: follow) + + expected = %{ + "activity_type" => "follow", + "attentions" => [], + "created_at" => follow.data["published"] |> Utils.date_to_asctime(), + "external_url" => follow.data["id"], + "id" => follow.id, + "in_reply_to_status_id" => nil, + "is_local" => true, + "is_post_verb" => false, + "statusnet_html" => "#{user.nickname} started following shp", + "text" => "#{user.nickname} started following shp", + "user" => UserView.render("show.json", user: user) + } + + assert result == expected + end end |