From aef3a3ca46afb98a93e1893162fb012ce433c368 Mon Sep 17 00:00:00 2001 From: Ekaterina Vaartis Date: Thu, 18 Apr 2019 22:04:37 +0300 Subject: [PATCH] Fix tests that used finmoji --- test/formatter_test.exs | 8 ++++---- test/web/activity_pub/transmogrifier_test.exs | 2 +- test/web/common_api/common_api_test.exs | 10 +++++----- test/web/common_api/common_api_utils_test.exs | 10 +++++----- test/web/push/impl_test.exs | 4 ++-- test/web/twitter_api/twitter_api_test.exs | 7 +++---- test/web/twitter_api/views/activity_view_test.exs | 6 +++--- 7 files changed, 23 insertions(+), 24 deletions(-) diff --git a/test/formatter_test.exs b/test/formatter_test.exs index e74985c4e..97eb2f583 100644 --- a/test/formatter_test.exs +++ b/test/formatter_test.exs @@ -245,10 +245,10 @@ defmodule Pleroma.FormatterTest do end test "it adds cool emoji" do - text = "I love :moominmamma:" + text = "I love :firefox:" expected_result = - "I love \"moominmamma\"" + "I love \"firefox\"" assert Formatter.emojify(text) == expected_result end @@ -269,10 +269,10 @@ defmodule Pleroma.FormatterTest do end test "it returns the emoji used in the text" do - text = "I love :moominmamma:" + text = "I love :firefox:" assert Formatter.get_emoji(text) == [ - {"moominmamma", "/finmoji/128px/moominmamma-128.png", "Finmoji"} + {"firefox", "/emoji/Firefox.gif", ["Gif", "Fun"]} ] end diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs index 6bb81a054..7d301b0d4 100644 --- a/test/web/activity_pub/transmogrifier_test.exs +++ b/test/web/activity_pub/transmogrifier_test.exs @@ -946,7 +946,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do test "it strips internal fields" do user = insert(:user) - {:ok, activity} = CommonAPI.post(user, %{"status" => "#2hu :moominmamma:"}) + {:ok, activity} = CommonAPI.post(user, %{"status" => "#2hu :firefox:"}) {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data) diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs index 3d2bb8929..a5b07c446 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/web/common_api/common_api_test.exs @@ -40,19 +40,19 @@ defmodule Pleroma.Web.CommonAPITest do test "it adds emoji in the object" do user = insert(:user) - {:ok, activity} = CommonAPI.post(user, %{"status" => ":moominmamma:"}) + {:ok, activity} = CommonAPI.post(user, %{"status" => ":firefox:"}) - assert Object.normalize(activity).data["emoji"]["moominmamma"] + assert Object.normalize(activity).data["emoji"]["firefox"] end test "it adds emoji when updating profiles" do - user = insert(:user, %{name: ":karjalanpiirakka:"}) + user = insert(:user, %{name: ":firefox:"}) CommonAPI.update(user) user = User.get_cached_by_ap_id(user.ap_id) - [karjalanpiirakka] = user.info.source_data["tag"] + [firefox] = user.info.source_data["tag"] - assert karjalanpiirakka["name"] == ":karjalanpiirakka:" + assert firefox["name"] == ":firefox:" end describe "posting" do diff --git a/test/web/common_api/common_api_utils_test.exs b/test/web/common_api/common_api_utils_test.exs index f0c59d5c3..837a66063 100644 --- a/test/web/common_api/common_api_utils_test.exs +++ b/test/web/common_api/common_api_utils_test.exs @@ -37,21 +37,21 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do end test "parses emoji from name and bio" do - {:ok, user} = UserBuilder.insert(%{name: ":karjalanpiirakka:", bio: ":perkele:"}) + {:ok, user} = UserBuilder.insert(%{name: ":blank:", bio: ":firefox:"}) expected = [ %{ "type" => "Emoji", - "icon" => %{"type" => "Image", "url" => "#{Endpoint.url()}/finmoji/128px/perkele-128.png"}, - "name" => ":perkele:" + "icon" => %{"type" => "Image", "url" => "#{Endpoint.url()}/emoji/Firefox.gif"}, + "name" => ":firefox:" }, %{ "type" => "Emoji", "icon" => %{ "type" => "Image", - "url" => "#{Endpoint.url()}/finmoji/128px/karjalanpiirakka-128.png" + "url" => "#{Endpoint.url()}/emoji/blank.png" }, - "name" => ":karjalanpiirakka:" + "name" => ":blank:" } ] diff --git a/test/web/push/impl_test.exs b/test/web/push/impl_test.exs index 6bac2c9f6..49b2a9203 100644 --- a/test/web/push/impl_test.exs +++ b/test/web/push/impl_test.exs @@ -107,7 +107,7 @@ defmodule Pleroma.Web.Push.ImplTest do "type" => "Create", "object" => %{ "content" => - "Lorem ipsum dolor sit amet, consectetur :bear: adipiscing elit. Fusce sagittis finibus turpis." + "Lorem ipsum dolor sit amet, consectetur :firefox: adipiscing elit. Fusce sagittis finibus turpis." } } } @@ -129,7 +129,7 @@ defmodule Pleroma.Web.Push.ImplTest do insert(:note, %{ data: %{ "content" => - "Lorem ipsum dolor sit amet, consectetur :bear: adipiscing elit. Fusce sagittis finibus turpis." + "Lorem ipsum dolor sit amet, consectetur :firefox: adipiscing elit. Fusce sagittis finibus turpis." } }) diff --git a/test/web/twitter_api/twitter_api_test.exs b/test/web/twitter_api/twitter_api_test.exs index 5bea1037a..6b4cefacf 100644 --- a/test/web/twitter_api/twitter_api_test.exs +++ b/test/web/twitter_api/twitter_api_test.exs @@ -41,7 +41,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do input = %{ "status" => - "Hello again, @shp.\nThis is on another :moominmamma: line. #2hu #epic #phantasmagoric", + "Hello again, @shp.\nThis is on another :firefox: line. #2hu #epic #phantasmagoric", "media_ids" => [object.id] } @@ -49,7 +49,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do object = Object.normalize(activity.data["object"]) expected_text = - "Hello again, @shp.<script></script>
This is on another :moominmamma: line.
image.jpg" + "Hello again, @shp.<script></script>
This is on another :firefox: line.
image.jpg" assert get_in(object.data, ["content"]) == expected_text assert get_in(object.data, ["type"]) == "Note" @@ -65,8 +65,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do assert Enum.member?(get_in(activity.data, ["to"]), "shp") assert activity.local == true - assert %{"moominmamma" => "http://localhost:4001/finmoji/128px/moominmamma-128.png"} = - object.data["emoji"] + assert %{"firefox" => "http://localhost:4001/emoji/Firefox.gif"} = object.data["emoji"] # hashtags assert object.data["tag"] == ["2hu", "epic", "phantasmagoric"] diff --git a/test/web/twitter_api/views/activity_view_test.exs b/test/web/twitter_api/views/activity_view_test.exs index b5440c612..d84ab7420 100644 --- a/test/web/twitter_api/views/activity_view_test.exs +++ b/test/web/twitter_api/views/activity_view_test.exs @@ -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 = - "\"woollysocks\" meow" + "\"firefox\" meow" assert result["summary"] == expected assert result["summary_html"] == expected_html