diff options
author | lain <lain@soykaf.club> | 2018-06-03 19:11:22 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2018-06-03 19:11:22 +0200 |
commit | 0f70e83e8c745645703be8084001b1ef92c03823 (patch) | |
tree | ee6ff615eae7e45f1906ccbf77657bf0a93d23d3 /test/web/twitter_api/twitter_api_controller_test.exs | |
parent | 9d054d30bce383437b6bb07c869047f1cb8e164f (diff) | |
download | pleroma-0f70e83e8c745645703be8084001b1ef92c03823.tar.gz |
Better error handling in TwitterApiController.
Diffstat (limited to 'test/web/twitter_api/twitter_api_controller_test.exs')
-rw-r--r-- | test/web/twitter_api/twitter_api_controller_test.exs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs index 03e5824a9..68f4331df 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -260,7 +260,7 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do test "with credentials", %{conn: conn, user: current_user} do other_user = insert(:user) - {:ok, activity} = + {:ok, _activity} = ActivityBuilder.insert(%{"to" => [current_user.ap_id]}, %{user: other_user}) conn = @@ -510,6 +510,24 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do assert json_response(conn, 200) end + + test "with credentials, invalid param", %{conn: conn, user: current_user} do + conn = + conn + |> with_credentials(current_user.nickname, "test") + |> post("/api/favorites/create/wrong.json") + + assert json_response(conn, 400) + end + + test "with credentials, invalid activity", %{conn: conn, user: current_user} do + conn = + conn + |> with_credentials(current_user.nickname, "test") + |> post("/api/favorites/create/1.json") + + assert json_response(conn, 500) + end end describe "POST /api/favorites/destroy/:id" do @@ -793,7 +811,7 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do test "Convert newlines to <br> in bio", %{conn: conn} do user = insert(:user) - conn = + _conn = conn |> assign(:user, user) |> post("/api/account/update_profile.json", %{ @@ -904,6 +922,8 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do |> post("/api/pleroma/delete_account", %{"password" => "test"}) assert json_response(conn, 200) == %{"status" => "success"} + # Wait a second for the started task to end + :timer.sleep(1000) end end end |