diff options
author | Sadposter <hannah+pleroma@coffee-and-dreams.uk> | 2019-07-23 15:05:19 +0100 |
---|---|---|
committer | Sadposter <hannah+pleroma@coffee-and-dreams.uk> | 2019-07-23 15:08:41 +0100 |
commit | fd1fa5a2ec922575bc8b75dabe224337977c8e3e (patch) | |
tree | b9ddfa4ea96661a1a919fef7cae13745b8bd7af7 | |
parent | eacf61d823f8bc4398dee883aa86171ec4757fe9 (diff) | |
download | pleroma-fd1fa5a2ec922575bc8b75dabe224337977c8e3e.tar.gz |
add tests for unauthed reqs to liked/reblogged_by
-rw-r--r-- | test/web/mastodon_api/mastodon_api_controller_test.exs | 28 |
1 files changed, 28 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 a3e4c4136..00ca320d3 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@ -3786,6 +3786,20 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do assert Enum.empty?(response) end + + test "does not fail on an unauthententicated request", %{conn: conn, activity: activity} do + other_user = insert(:user) + {:ok, _, _} = CommonAPI.favorite(activity.id, other_user) + + response = + conn + |> assign(:user, nil) + |> get("/api/v1/#{activity.id}/favourited_by") + |> json_response(:ok) + + [%{"id" => id}] = response + assert id == other_user.id + end end describe "GET /api/v1/statuses/:id/reblogged_by" do @@ -3843,6 +3857,20 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do assert Enum.empty?(response) end + + test "does not fail on an unauthententicated request", %{conn: conn, activity: activity} do + other_user = insert(:user) + {:ok, _, _} = CommonAPI.favorite(activity.id, other_user) + + response = + conn + |> assign(:user, nil) + |> get("/api/v1/#{activity.id}/reblogged_by") + |> json_response(:ok) + + [%{"id" => id}] = response + assert id == other_user.id + end end describe "POST /auth/password, with valid parameters" do |