diff options
author | dtluna <dtluna@openmailbox.org> | 2017-04-24 01:11:38 +0300 |
---|---|---|
committer | dtluna <dtluna@openmailbox.org> | 2017-04-24 01:11:38 +0300 |
commit | f723b2369160ee08f7155e299aa44410b26b7e51 (patch) | |
tree | 28002bd419c12b812598a95d8bd2b49fef06b9ba /test/web/twitter_api/twitter_api_controller_test.exs | |
parent | 6b6bc9435c3c8ea86a1463c491c80ba28b0b1cc7 (diff) | |
download | pleroma-f723b2369160ee08f7155e299aa44410b26b7e51.tar.gz |
Add error response to self-repeats
Diffstat (limited to 'test/web/twitter_api/twitter_api_controller_test.exs')
-rw-r--r-- | test/web/twitter_api/twitter_api_controller_test.exs | 18 |
1 files changed, 14 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 0bd27c8c7..a5551fa82 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -328,11 +328,21 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do test "with credentials", %{conn: conn, user: current_user} do note_activity = insert(:note_activity) - conn = conn - |> with_credentials(current_user.nickname, "test") - |> post("/api/statuses/retweet/#{note_activity.id}.json") + request_path = "/api/statuses/retweet/#{note_activity.id}.json" - assert json_response(conn, 200) + user = Repo.get_by(User, ap_id: note_activity.data["actor"]) + response = conn + |> with_credentials(user.nickname, "test") + |> post(request_path) + assert json_response(response, 400) == %{"error" => "You cannot repeat your own notice.", + "request" => request_path} + + response = conn + |> with_credentials(current_user.nickname, "test") + |> post(request_path) + activity = Repo.get(Activity, note_activity.id) + current_user = Repo.get_by(User, ap_id: note_activity.data["actor"]) + assert json_response(response, 200) == ActivityRepresenter.to_map(activity, %{user: current_user}) end end |