aboutsummaryrefslogtreecommitdiff
path: root/test/web/twitter_api/twitter_api_controller_test.exs
diff options
context:
space:
mode:
authorRoger Braun <roger@rogerbraun.net>2017-04-25 12:01:00 +0200
committerRoger Braun <roger@rogerbraun.net>2017-04-25 12:01:00 +0200
commit5a3be8ad1b76a2d9828d9991a8dd20d12673fd71 (patch)
tree698c59073ec1fa4dfa2f65ab5ac5897aaa848180 /test/web/twitter_api/twitter_api_controller_test.exs
parentaef7e943e7a2a6924f3914142b53a6f862577c52 (diff)
parenta25adfbfeedb049f44bb05275ce1040ed00a4ad2 (diff)
downloadpleroma-5a3be8ad1b76a2d9828d9991a8dd20d12673fd71.tar.gz
Merge branch 'dtluna/pleroma-bugfix/deny-empty-posts' into develop
Diffstat (limited to 'test/web/twitter_api/twitter_api_controller_test.exs')
-rw-r--r--test/web/twitter_api/twitter_api_controller_test.exs19
1 files changed, 15 insertions, 4 deletions
diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs
index 0761d0566..766268ce9 100644
--- a/test/web/twitter_api/twitter_api_controller_test.exs
+++ b/test/web/twitter_api/twitter_api_controller_test.exs
@@ -31,10 +31,21 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
end
test "with credentials", %{conn: conn, user: user} do
- conn = conn
- |> with_credentials(user.nickname, "test")
- |> post("/api/statuses/update.json", %{ status: "Nice meme." })
+ conn_with_creds = conn |> with_credentials(user.nickname, "test")
+ request_path = "/api/statuses/update.json"
+
+ error_response = %{"request" => request_path,
+ "error" => "Client must provide a 'status' parameter with a value."}
+ conn = conn_with_creds |> post(request_path)
+ assert json_response(conn, 400) == error_response
+
+ conn = conn_with_creds |> post(request_path, %{ status: "" })
+ assert json_response(conn, 400) == error_response
+
+ conn = conn_with_creds |> post(request_path, %{ status: " " })
+ assert json_response(conn, 400) == error_response
+ conn = conn_with_creds |> post(request_path, %{ status: "Nice meme." })
assert json_response(conn, 200) == ActivityRepresenter.to_map(Repo.one(Activity), %{user: user})
end
end
@@ -139,7 +150,7 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
setup [:valid_user]
test "without any params", %{conn: conn} do
conn = get(conn, "/api/statuses/user_timeline.json")
- assert json_response(conn, 400) == %{"error" => "You need to specify screen_name or user_id"}
+ assert json_response(conn, 400) == %{"error" => "You need to specify screen_name or user_id", "request" => "/api/statuses/user_timeline.json"}
end
test "with user_id", %{conn: conn} do