1 defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenterTest do
3 alias Pleroma.{User, Activity, Object}
4 alias Pleroma.Web.TwitterAPI.Representers.{UserRepresenter, ActivityRepresenter, ObjectRepresenter}
5 alias Pleroma.Builders.UserBuilder
8 {:ok, user} = UserBuilder.insert
9 {:ok, mentioned_user } = UserBuilder.insert(%{nickname: "shp", ap_id: "shp"})
10 {:ok, follower} = UserBuilder.insert(%{following: [User.ap_followers(user)]})
18 "mediaType" => "image/jpg",
19 "href" => "http://example.org/image.jpg"
26 content = "Some content mentioning @shp"
27 date = DateTime.utc_now() |> DateTime.to_iso8601
34 User.ap_followers(user),
35 "https://www.w3.org/ns/activitystreams#Public",
38 "actor" => User.ap_id(user),
43 "inReplyToStatusId" => 213123,
44 "statusnetConversationId" => 4711,
56 "user" => UserRepresenter.to_map(user, %{for: follower}),
59 "statusnet_html" => content,
61 "is_post_verb" => true,
63 "in_reply_to_status_id" => 213123,
64 "statusnet_conversation_id" => 4711,
66 ObjectRepresenter.to_map(object)
69 UserRepresenter.to_map(mentioned_user, %{for: follower})
73 assert ActivityRepresenter.to_map(activity, %{user: user, for: follower, mentioned: [mentioned_user]}) == expected_status