diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/web/mastodon_api/mastodon_api_controller_test.exs | 14 | ||||
-rw-r--r-- | test/web/twitter_api/twitter_api_controller_test.exs | 7 | ||||
-rw-r--r-- | test/web/twitter_api/twitter_api_test.exs | 2 |
3 files changed, 15 insertions, 8 deletions
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs index d781af675..6cdb75d08 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@ -121,4 +121,18 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do assert Repo.get(Activity, activity.id) == activity end end + + describe "reblogging" do + test "reblogs and returns the reblogged status", %{conn: conn} do + activity = insert(:note_activity) + user = insert(:user) + + conn = conn + |> assign(:user, user) + |> post("/api/v1/statuses/#{activity.id}/reblog") + + assert %{"id" => id, "reblogged" => true, "reblogs_count" => 1} = json_response(conn, 200) + assert activity.id == id + end + end end diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs index 89b8c2eeb..2c89509ff 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -354,13 +354,6 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do request_path = "/api/statuses/retweet/#{note_activity.id}.json" - 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) diff --git a/test/web/twitter_api/twitter_api_test.exs b/test/web/twitter_api/twitter_api_test.exs index bbb261eff..c1c9b2d22 100644 --- a/test/web/twitter_api/twitter_api_test.exs +++ b/test/web/twitter_api/twitter_api_test.exs @@ -290,7 +290,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do note_activity = insert(:note_activity) activity_user = Repo.get_by!(User, ap_id: note_activity.data["actor"]) - {:ok, status} = TwitterAPI.retweet(user, note_activity) + {:ok, status} = TwitterAPI.repeat(user, note_activity.id) updated_activity = Activity.get_by_ap_id(note_activity.data["id"]) assert status == ActivityRepresenter.to_map(updated_activity, %{user: activity_user, for: user}) |