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_html = "Some content mentioning <a href='shp'>@shp</shp>"
27 content = HtmlSanitizeEx.strip_tags(content_html)
28 date = DateTime.utc_now() |> DateTime.to_iso8601
35 User.ap_followers(user),
36 "https://www.w3.org/ns/activitystreams#Public",
39 "actor" => User.ap_id(user),
43 "content" => content_html,
44 "inReplyToStatusId" => 213123,
45 "statusnetConversationId" => 4711,
57 "user" => UserRepresenter.to_map(user, %{for: follower}),
60 "statusnet_html" => content_html,
62 "is_post_verb" => true,
64 "in_reply_to_status_id" => 213123,
65 "statusnet_conversation_id" => 4711,
67 ObjectRepresenter.to_map(object)
70 UserRepresenter.to_map(mentioned_user, %{for: follower})
74 assert ActivityRepresenter.to_map(activity, %{user: user, for: follower, mentioned: [mentioned_user]}) == expected_status