aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorlambda <lain@soykaf.club>2019-04-15 10:26:23 +0000
committerlambda <lain@soykaf.club>2019-04-15 10:26:23 +0000
commit56956de6fa1818d52e870fe719e6e20a0e408a30 (patch)
tree79a41776b8f64cfa54e183d19766f55191534232 /test
parentf358295cbe8f1d250e92dcc9265cdc83cb2cabdd (diff)
parent679a8ef629bf08f2ade88ea358b661589e29264f (diff)
downloadpleroma-56956de6fa1818d52e870fe719e6e20a0e408a30.tar.gz
Merge branch 'fix/status-reblogged' into 'develop'
Assign reblogged in the Mastodon reblog status view Closes #812 See merge request pleroma/pleroma!1057
Diffstat (limited to 'test')
-rw-r--r--test/web/mastodon_api/mastodon_api_controller_test.exs37
1 files changed, 35 insertions, 2 deletions
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs
index 69e6e56a1..48dc8dd2f 100644
--- a/test/web/mastodon_api/mastodon_api_controller_test.exs
+++ b/test/web/mastodon_api/mastodon_api_controller_test.exs
@@ -1008,8 +1008,41 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
|> assign(:user, user)
|> post("/api/v1/statuses/#{activity.id}/reblog")
- assert %{"reblog" => %{"id" => id, "reblogged" => true, "reblogs_count" => 1}} =
- json_response(conn, 200)
+ assert %{
+ "reblog" => %{"id" => id, "reblogged" => true, "reblogs_count" => 1},
+ "reblogged" => true
+ } = 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)
+ user2 = insert(:user)
+ user3 = insert(:user)
+ {:ok, reblog_activity1, _object} = CommonAPI.repeat(activity.id, user1)
+ {:ok, _, _object} = CommonAPI.repeat(activity.id, user2)
+
+ conn_res =
+ conn
+ |> assign(:user, user3)
+ |> get("/api/v1/statuses/#{reblog_activity1.id}")
+
+ assert %{
+ "reblog" => %{"id" => id, "reblogged" => false, "reblogs_count" => 2},
+ "reblogged" => false
+ } = json_response(conn_res, 200)
+
+ conn_res =
+ conn
+ |> assign(:user, user2)
+ |> get("/api/v1/statuses/#{reblog_activity1.id}")
+
+ assert %{
+ "reblog" => %{"id" => id, "reblogged" => true, "reblogs_count" => 2},
+ "reblogged" => true
+ } = json_response(conn_res, 200)
assert to_string(activity.id) == id
end