Use "repeated" instead of "retweeted" for repeated statuses in Twitter API
[akkoma] / test / web / twitter_api / views / activity_view_test.exs
index 7ef0270cc01583124057b4d94dffdc9927d7f528..43bd77f782965db1bb5a16424c5f4e5140a976e8 100644 (file)
@@ -91,16 +91,16 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do
   test "a create activity with a summary containing emoji" do
     {:ok, activity} =
       CommonAPI.post(insert(:user), %{
-        "spoiler_text" => ":woollysocks: meow",
+        "spoiler_text" => ":firefox: meow",
         "status" => "."
       })
 
     result = ActivityView.render("activity.json", activity: activity)
 
-    expected = ":woollysocks: meow"
+    expected = ":firefox: meow"
 
     expected_html =
-      "<img height=\"32px\" width=\"32px\" alt=\"woollysocks\" title=\"woollysocks\" src=\"http://localhost:4001/finmoji/128px/woollysocks-128.png\" /> meow"
+      "<img class=\"emoji\" alt=\"firefox\" title=\"firefox\" src=\"http://localhost:4001/emoji/Firefox.gif\" /> meow"
 
     assert result["summary"] == expected
     assert result["summary_html"] == expected_html
@@ -295,8 +295,8 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do
       "id" => announce.id,
       "is_local" => true,
       "is_post_verb" => false,
-      "statusnet_html" => "shp retweeted a status.",
-      "text" => "shp retweeted a status.",
+      "statusnet_html" => "shp repeated a status.",
+      "text" => "shp repeated 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),
@@ -360,7 +360,7 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do
 
   test "a peertube video" do
     {:ok, object} =
-      ActivityPub.fetch_object_from_id(
+      Pleroma.Object.Fetcher.fetch_object_from_id(
         "https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3"
       )
 
@@ -371,4 +371,14 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do
     assert length(result["attachments"]) == 1
     assert result["summary"] == "Friday Night"
   end
+
+  test "special characters are not escaped in text field for status created" do
+    text = "<3 is on the way"
+
+    {:ok, activity} = CommonAPI.post(insert(:user), %{"status" => text})
+
+    result = ActivityView.render("activity.json", activity: activity)
+
+    assert result["text"] == text
+  end
 end