1 defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do
4 alias Pleroma.Web.CommonAPI
5 alias Pleroma.Web.CommonAPI.Utils
6 alias Pleroma.Web.TwitterAPI.ActivityView
7 alias Pleroma.Web.TwitterAPI.UserView
8 alias Pleroma.Web.TwitterAPI.TwitterAPI
11 test "a create activity with a note" do
13 other_user = insert(:user, %{nickname: "shp"})
15 {:ok, activity} = CommonAPI.post(user, %{"status" => "Hey @shp!"})
17 result = ActivityView.render("activity.json", activity: activity)
19 convo_id = TwitterAPI.context_to_conversation_id(activity.data["object"]["context"])
22 "activity_type" => "post",
25 UserView.render("show.json", %{user: other_user})
27 "created_at" => activity.data["object"]["published"] |> Utils.date_to_asctime,
28 "external_url" => activity.data["object"]["id"],
32 "in_reply_to_status_id" => nil,
34 "is_post_verb" => true,
35 "possibly_sensitive" => false,
38 "statusnet_conversation_id" => convo_id,
40 "Hey <span><a href=\"http://localhost:4001/users/nick1\">@<span>shp</span></a></span>!",
42 "text" => "Hey @shp!",
43 "uri" => activity.data["object"]["id"],
44 "user" => UserView.render("show.json", %{user: user})
47 assert result == expected