From 50409326a853db7bd9f538f0ddbec805c134920f Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Fri, 15 Sep 2017 14:17:36 +0200 Subject: Refactor posting and make character limit configurable. --- test/web/common_api/common_api_utils_test.exs | 16 ++++++++++++++++ test/web/twitter_api/twitter_api_test.exs | 3 ++- test/web/twitter_api/twitter_api_utils_test.exs | 16 ---------------- test/web/twitter_api/views/user_view_test.exs | 3 ++- 4 files changed, 20 insertions(+), 18 deletions(-) create mode 100644 test/web/common_api/common_api_utils_test.exs delete mode 100644 test/web/twitter_api/twitter_api_utils_test.exs (limited to 'test') diff --git a/test/web/common_api/common_api_utils_test.exs b/test/web/common_api/common_api_utils_test.exs new file mode 100644 index 000000000..a159c0835 --- /dev/null +++ b/test/web/common_api/common_api_utils_test.exs @@ -0,0 +1,16 @@ +defmodule Pleroma.Web.CommonAPI.UtilsTest do + alias Pleroma.Web.CommonAPI.Utils + use Pleroma.DataCase + + test "it adds attachment links to a given text and attachment set" do + name = "Sakura%20Mana%20%E2%80%93%20Turned%20on%20by%20a%20Senior%20OL%20with%20a%20Temptating%20Tight%20Skirt-s%20Full%20Hipline%20and%20Panty%20Shot-%20Beautiful%20Thick%20Thighs-%20and%20Erotic%20Ass-%20-2015-%20--%20Oppaitime%208-28-2017%206-50-33%20PM.png" + + attachment = %{ + "url" => [%{"href" => name}] + } + + res = Utils.add_attachments("", [attachment]) + + assert res == "
\nSakura Mana – Turned on by a Se…" + end +end diff --git a/test/web/twitter_api/twitter_api_test.exs b/test/web/twitter_api/twitter_api_test.exs index d5c94d2c7..1cf48dd4b 100644 --- a/test/web/twitter_api/twitter_api_test.exs +++ b/test/web/twitter_api/twitter_api_test.exs @@ -1,7 +1,8 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do use Pleroma.DataCase alias Pleroma.Builders.{UserBuilder, ActivityBuilder} - alias Pleroma.Web.TwitterAPI.{TwitterAPI,UserView,Utils} + alias Pleroma.Web.TwitterAPI.{TwitterAPI, UserView} + alias Pleroma.Web.CommonAPI.Utils alias Pleroma.{Activity, User, Object, Repo} alias Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter alias Pleroma.Web.ActivityPub.ActivityPub diff --git a/test/web/twitter_api/twitter_api_utils_test.exs b/test/web/twitter_api/twitter_api_utils_test.exs deleted file mode 100644 index ff03414d6..000000000 --- a/test/web/twitter_api/twitter_api_utils_test.exs +++ /dev/null @@ -1,16 +0,0 @@ -defmodule Pleroma.Web.TwitterAPI.UtilsTest do - alias Pleroma.Web.TwitterAPI.Utils - use Pleroma.DataCase - - test "it adds attachment links to a given text and attachment set" do - name = "Sakura%20Mana%20%E2%80%93%20Turned%20on%20by%20a%20Senior%20OL%20with%20a%20Temptating%20Tight%20Skirt-s%20Full%20Hipline%20and%20Panty%20Shot-%20Beautiful%20Thick%20Thighs-%20and%20Erotic%20Ass-%20-2015-%20--%20Oppaitime%208-28-2017%206-50-33%20PM.png" - - attachment = %{ - "url" => [%{"href" => name}] - } - - res = Utils.add_attachments("", [attachment]) - - assert res == "
\nSakura Mana – Turned on by a Se…" - end -end diff --git a/test/web/twitter_api/views/user_view_test.exs b/test/web/twitter_api/views/user_view_test.exs index 7b3289422..886af6b66 100644 --- a/test/web/twitter_api/views/user_view_test.exs +++ b/test/web/twitter_api/views/user_view_test.exs @@ -2,7 +2,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do use Pleroma.DataCase alias Pleroma.User - alias Pleroma.Web.TwitterAPI.{UserView, Utils} + alias Pleroma.Web.TwitterAPI.UserView + alias Pleroma.Web.CommonAPI.Utils alias Pleroma.Builders.UserBuilder import Pleroma.Factory -- cgit v1.2.3