From 422d0f324fa18743129ce81139319ead7cb579ce Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Sun, 17 Sep 2017 13:09:49 +0200 Subject: MastodonAPI: Add user favorites endpoint. --- test/web/mastodon_api/mastodon_api_controller_test.exs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test') diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs index 4261ac6b1..56888140d 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@ -341,4 +341,21 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do [account] = results["accounts"] assert account["acct"] == "shp@social.heldscal.la" end + + test "returns the favorites of a user", %{conn: conn} do + user = insert(:user) + other_user = insert(:user) + + {:ok, _} = CommonAPI.post(other_user, %{"status" => "bla"}) + {:ok, activity} = CommonAPI.post(other_user, %{"status" => "traps are happy"}) + + {:ok, _, _} = CommonAPI.favorite(activity.id, user) + + conn = conn + |> assign(:user, user) + |> get("/api/v1/favourites") + + assert [status] = json_response(conn, 200) + assert status["id"] == activity.id + end end -- cgit v1.2.3