From 6908f29e0a170131d2f328d68d36f054b592a0a3 Mon Sep 17 00:00:00 2001 From: Wim Vanderbauwhede Date: Sat, 28 Apr 2018 12:01:43 +0100 Subject: Added a test (written by @andrewzah) for the MR --- test/web/twitter_api/twitter_api_controller_test.exs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/web/twitter_api/twitter_api_controller_test.exs') diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs index 406dace1c..c239239d3 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -784,4 +784,20 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do assert status["id"] == activity.id end end + + test "Convert newlines to
in bio", %{conn: conn} do + user = insert(:user) + + conn = + conn + |> assign(:user, user) + |> post("/api/account/update_profile.json", %{ + "description" => "Hello,\r\nWorld! I\n am a test." + }) + + user = Repo.get!(User, user.id) + assert user.bio == "Hello,
World! I
am a test." + end + + end -- cgit v1.2.3 From bc215f568473bb3801b6eff238fee48f5de2bab8 Mon Sep 17 00:00:00 2001 From: lain Date: Sun, 29 Apr 2018 11:28:26 +0200 Subject: Fix format. --- test/web/twitter_api/twitter_api_controller_test.exs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'test/web/twitter_api/twitter_api_controller_test.exs') diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs index c239239d3..d7113979a 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -786,18 +786,16 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do end test "Convert newlines to
in bio", %{conn: conn} do - user = insert(:user) + user = insert(:user) - conn = - conn - |> assign(:user, user) - |> post("/api/account/update_profile.json", %{ - "description" => "Hello,\r\nWorld! I\n am a test." - }) + conn = + conn + |> assign(:user, user) + |> post("/api/account/update_profile.json", %{ + "description" => "Hello,\r\nWorld! I\n am a test." + }) - user = Repo.get!(User, user.id) - assert user.bio == "Hello,
World! I
am a test." + user = Repo.get!(User, user.id) + assert user.bio == "Hello,
World! I
am a test." end - - end -- cgit v1.2.3 From 89603eda9ea51c5bd3c681fce958a4a6b446debe Mon Sep 17 00:00:00 2001 From: Pierrick Brun Date: Mon, 7 May 2018 20:51:14 +0200 Subject: do not create notification for yourself --- test/web/twitter_api/twitter_api_controller_test.exs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test/web/twitter_api/twitter_api_controller_test.exs') diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs index d7113979a..896fe246d 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -257,8 +257,10 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do end test "with credentials", %{conn: conn, user: current_user} do + other_user = insert(:user) + {:ok, activity} = - ActivityBuilder.insert(%{"to" => [current_user.ap_id]}, %{user: current_user}) + ActivityBuilder.insert(%{"to" => [current_user.ap_id]}, %{user: other_user}) conn = conn -- cgit v1.2.3