X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=test%2Fweb%2Ftwitter_api%2Fviews%2Fuser_view_test.exs;h=7075a237090f1c1dba050c16eac3332ce92d451a;hb=b7923aa304c23963fd51731579a54949fa639762;hp=49f73c2fe1121de682a96137994f15806f1ba27d;hpb=5469fb9561bb886deb8434e545dfb711eb20f341;p=akkoma
diff --git a/test/web/twitter_api/views/user_view_test.exs b/test/web/twitter_api/views/user_view_test.exs
index 49f73c2fe..7075a2370 100644
--- a/test/web/twitter_api/views/user_view_test.exs
+++ b/test/web/twitter_api/views/user_view_test.exs
@@ -20,6 +20,30 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
assert represented["profile_image_url"] == image
end
+ test "A user with emoji in username", %{user: user} do
+ expected =
+ "
man"
+
+ user = %{
+ user
+ | info: %{
+ "source_data" => %{
+ "tag" => [
+ %{
+ "type" => "Emoji",
+ "icon" => %{"url" => "/file.png"},
+ "name" => ":karjalanpiirakka:"
+ }
+ ]
+ }
+ }
+ }
+
+ user = %{user | name: ":karjalanpiirakka: man"}
+ represented = UserView.render("show.json", %{user: user})
+ assert represented["name_html"] == expected
+ end
+
test "A user" do
note_activity = insert(:note_activity)
user = User.get_cached_by_ap_id(note_activity.data["actor"])
@@ -40,7 +64,9 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
"id" => user.id,
"name" => user.name,
"screen_name" => user.nickname,
- "description" => HtmlSanitizeEx.strip_tags(user.bio),
+ "name_html" => user.name,
+ "description" => HtmlSanitizeEx.strip_tags(user.bio |> String.replace("
", "\n")),
+ "description_html" => HtmlSanitizeEx.basic_html(user.bio),
"created_at" => user.inserted_at |> Utils.format_naive_asctime(),
"favourites_count" => 0,
"statuses_count" => 1,
@@ -77,7 +103,9 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
"id" => user.id,
"name" => user.name,
"screen_name" => user.nickname,
- "description" => HtmlSanitizeEx.strip_tags(user.bio),
+ "name_html" => user.name,
+ "description" => HtmlSanitizeEx.strip_tags(user.bio |> String.replace("
", "\n")),
+ "description_html" => HtmlSanitizeEx.basic_html(user.bio),
"created_at" => user.inserted_at |> Utils.format_naive_asctime(),
"favourites_count" => 0,
"statuses_count" => 0,
@@ -115,7 +143,9 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
"id" => follower.id,
"name" => follower.name,
"screen_name" => follower.nickname,
- "description" => HtmlSanitizeEx.strip_tags(follower.bio),
+ "name_html" => follower.name,
+ "description" => HtmlSanitizeEx.strip_tags(follower.bio |> String.replace("
", "\n")),
+ "description_html" => HtmlSanitizeEx.basic_html(follower.bio),
"created_at" => follower.inserted_at |> Utils.format_naive_asctime(),
"favourites_count" => 0,
"statuses_count" => 0,
@@ -160,7 +190,9 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
"id" => user.id,
"name" => user.name,
"screen_name" => user.nickname,
- "description" => HtmlSanitizeEx.strip_tags(user.bio),
+ "name_html" => user.name,
+ "description" => HtmlSanitizeEx.strip_tags(user.bio |> String.replace("
", "\n")),
+ "description_html" => HtmlSanitizeEx.basic_html(user.bio),
"created_at" => user.inserted_at |> Utils.format_naive_asctime(),
"favourites_count" => 0,
"statuses_count" => 0,