sync bio sanitization code in tests
authorensra <ensra@users.noreply.github.com>
Tue, 21 Aug 2018 14:24:06 +0000 (15:24 +0100)
committerensra <ensra@users.noreply.github.com>
Tue, 21 Aug 2018 14:24:06 +0000 (15:24 +0100)
test/web/twitter_api/views/user_view_test.exs

index fefb6bdcc32307be17db10d3bfea46c83eec70c7..180b7602ee80dedd259b0ee8d8993e3b96338ca2 100644 (file)
@@ -65,8 +65,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
       "name" => user.name,
       "screen_name" => user.nickname,
       "name_html" => user.name,
-      "description" => HtmlSanitizeEx.strip_tags(user.bio),
-      "description_html" => HtmlSanitizeEx.strip_tags(user.bio),
+      "description" => HtmlSanitizeEx.strip_tags(user.bio |> String.replace("<br>", "\n")),
+      "description_html" => HtmlSanitizeEx.basic_html(user.bio),
       "created_at" => user.inserted_at |> Utils.format_naive_asctime(),
       "favourites_count" => 0,
       "statuses_count" => 1,
@@ -104,8 +104,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
       "name" => user.name,
       "screen_name" => user.nickname,
       "name_html" => user.name,
-      "description" => HtmlSanitizeEx.strip_tags(user.bio),
-      "description_html" => HtmlSanitizeEx.strip_tags(user.bio),
+      "description" => HtmlSanitizeEx.strip_tags(user.bio |> String.replace("<br>", "\n")),
+      "description_html" => HtmlSanitizeEx.basic_html(user.bio),
       "created_at" => user.inserted_at |> Utils.format_naive_asctime(),
       "favourites_count" => 0,
       "statuses_count" => 0,
@@ -144,8 +144,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
       "name" => follower.name,
       "screen_name" => follower.nickname,
       "name_html" => follower.name,
-      "description" => HtmlSanitizeEx.strip_tags(follower.bio),
-      "description_html" => HtmlSanitizeEx.strip_tags(follower.bio),
+      "description" => HtmlSanitizeEx.strip_tags(user.bio |> String.replace("<br>", "\n")),
+      "description_html" => HtmlSanitizeEx.basic_html(user.bio),
       "created_at" => follower.inserted_at |> Utils.format_naive_asctime(),
       "favourites_count" => 0,
       "statuses_count" => 0,
@@ -191,8 +191,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
       "name" => user.name,
       "screen_name" => user.nickname,
       "name_html" => user.name,
-      "description" => HtmlSanitizeEx.strip_tags(user.bio),
-      "description_html" => HtmlSanitizeEx.strip_tags(user.bio),
+      "description" => HtmlSanitizeEx.strip_tags(user.bio |> String.replace("<br>", "\n")),
+      "description_html" => HtmlSanitizeEx.basic_html(user.bio),
       "created_at" => user.inserted_at |> Utils.format_naive_asctime(),
       "favourites_count" => 0,
       "statuses_count" => 0,