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=9f8bf4cdcfda9fe5cd92ff31d4bb4c241b6163e1;hpb=c41012053a6eb3e190f8ae69ad26db184d3555d2;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 9f8bf4cdc..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,
@@ -59,7 +85,9 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
"statusnet_profile_url" => user.ap_id,
"cover_photo" => banner,
"background_image" => nil,
- "is_local" => true
+ "is_local" => true,
+ "locked" => false,
+ "default_scope" => "public"
}
assert represented == UserView.render("show.json", %{user: user})
@@ -75,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,
@@ -94,7 +124,9 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
"statusnet_profile_url" => user.ap_id,
"cover_photo" => banner,
"background_image" => nil,
- "is_local" => true
+ "is_local" => true,
+ "locked" => false,
+ "default_scope" => "public"
}
assert represented == UserView.render("show.json", %{user: user, for: follower})
@@ -111,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,
@@ -130,7 +164,9 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
"statusnet_profile_url" => follower.ap_id,
"cover_photo" => banner,
"background_image" => nil,
- "is_local" => true
+ "is_local" => true,
+ "locked" => false,
+ "default_scope" => "public"
}
assert represented == UserView.render("show.json", %{user: follower, for: user})
@@ -154,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,
@@ -173,7 +211,9 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
"statusnet_profile_url" => user.ap_id,
"cover_photo" => banner,
"background_image" => nil,
- "is_local" => true
+ "is_local" => true,
+ "locked" => false,
+ "default_scope" => "public"
}
blocker = Repo.get(User, blocker.id)