diff options
author | lain <lain@soykaf.club> | 2019-10-02 13:27:55 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2019-10-02 13:27:55 +0200 |
commit | 557223b2b5b60956d3e1a19e9fdae9e9798c4fe2 (patch) | |
tree | 71d711f8932a2bd952f9f54ccef1322c55aed1d7 /test/web/mastodon_api/controllers/status_controller_test.exs | |
parent | 19bc0b8c79765dc485e081651a4e4c589d18b970 (diff) | |
parent | 433f2c0f6854d2838819e08f0fb0a9e8cf058021 (diff) | |
download | pleroma-557223b2b5b60956d3e1a19e9fdae9e9798c4fe2.tar.gz pleroma-557223b2b5b60956d3e1a19e9fdae9e9798c4fe2.zip |
Merge remote-tracking branch 'origin/develop' into reactions
Diffstat (limited to 'test/web/mastodon_api/controllers/status_controller_test.exs')
-rw-r--r-- | test/web/mastodon_api/controllers/status_controller_test.exs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/web/mastodon_api/controllers/status_controller_test.exs b/test/web/mastodon_api/controllers/status_controller_test.exs index b194feae6..b648ad6ff 100644 --- a/test/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/web/mastodon_api/controllers/status_controller_test.exs @@ -547,6 +547,24 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do assert to_string(activity.id) == id end + test "reblogs privately 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", %{"visibility" => "private"}) + + assert %{ + "reblog" => %{"id" => id, "reblogged" => true, "reblogs_count" => 1}, + "reblogged" => true, + "visibility" => "private" + } = json_response(conn, 200) + + assert to_string(activity.id) == id + end + test "reblogged status for another user", %{conn: conn} do activity = insert(:note_activity) user1 = insert(:user) @@ -1149,6 +1167,23 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do assert Enum.empty?(response) end + test "does not return users who have reblogged the status privately", %{ + conn: %{assigns: %{user: user}} = conn, + activity: activity + } do + other_user = insert(:user) + + {:ok, _, _} = CommonAPI.repeat(activity.id, other_user, %{"visibility" => "private"}) + + response = + conn + |> assign(:user, user) + |> get("/api/v1/statuses/#{activity.id}/reblogged_by") + |> json_response(:ok) + + assert Enum.empty?(response) + end + test "does not fail on an unauthenticated request", %{conn: conn, activity: activity} do other_user = insert(:user) {:ok, _, _} = CommonAPI.repeat(activity.id, other_user) |