diff options
author | Roger Braun <roger@rogerbraun.net> | 2017-04-15 14:09:54 +0200 |
---|---|---|
committer | Roger Braun <roger@rogerbraun.net> | 2017-04-15 14:09:54 +0200 |
commit | 4799dc6991682489e8f1701946685a7725ad0a6a (patch) | |
tree | e1f7652fa3dd6ddd218158552b1045d6544b1d5b /test/web/twitter_api/twitter_api_controller_test.exs | |
parent | 60c60de330fe8fe03594da89831351099c8c9037 (diff) | |
download | pleroma-4799dc6991682489e8f1701946685a7725ad0a6a.tar.gz |
Add retweeting to TwAPI controller.
Diffstat (limited to 'test/web/twitter_api/twitter_api_controller_test.exs')
-rw-r--r-- | test/web/twitter_api/twitter_api_controller_test.exs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs index 814f457b9..0eb1b60c5 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -197,6 +197,25 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do end end + describe "POST /api/statuses/retweet/:id" do + setup [:valid_user] + test "without valid credentials", %{conn: conn} do + note_activity = insert(:note_activity) + conn = post conn, "/api/statuses/retweet/#{note_activity.id}.json" + assert json_response(conn, 403) == %{"error" => "Invalid credentials."} + end + + 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") + + assert json_response(conn, 200) + end + end + defp valid_user(_context) do { :ok, user } = UserBuilder.insert(%{nickname: "lambda", ap_id: "lambda"}) [user: user] |