diff options
author | Roger Braun <roger@rogerbraun.net> | 2017-09-17 13:09:49 +0200 |
---|---|---|
committer | Roger Braun <roger@rogerbraun.net> | 2017-09-17 13:09:49 +0200 |
commit | 422d0f324fa18743129ce81139319ead7cb579ce (patch) | |
tree | 92bb87867f9093be0cce9ffe7503d0fd5d8dfb80 /test | |
parent | 6d5bd4dcc0b5c323718c70a6815a7f46e314d74b (diff) | |
download | pleroma-422d0f324fa18743129ce81139319ead7cb579ce.tar.gz pleroma-422d0f324fa18743129ce81139319ead7cb579ce.zip |
MastodonAPI: Add user favorites endpoint.
Diffstat (limited to 'test')
-rw-r--r-- | test/web/mastodon_api/mastodon_api_controller_test.exs | 17 |
1 files changed, 17 insertions, 0 deletions
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 |