summaryrefslogtreecommitdiff
path: root/test/web/mastodon_api/controllers/account_controller_test.exs
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2019-12-10 08:55:14 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2019-12-10 08:55:14 +0300
commit835ac2157c53e8c85bd3759efe061dbfbdfc367e (patch)
tree266959488004bd33200c4ae4d664e665b77b2668 /test/web/mastodon_api/controllers/account_controller_test.exs
parent1770602747ae95d95d12c5601f99ced8699e8947 (diff)
parent99623b4eca8ad4af0b8e7adc9dd4765ba2922c8b (diff)
downloadpleroma-835ac2157c53e8c85bd3759efe061dbfbdfc367e.tar.gz
pleroma-835ac2157c53e8c85bd3759efe061dbfbdfc367e.zip
Merge remote-tracking branch 'remotes/upstream/develop' into 1427-oauth-admin-scopes
# Conflicts: # CHANGELOG.md
Diffstat (limited to 'test/web/mastodon_api/controllers/account_controller_test.exs')
-rw-r--r--test/web/mastodon_api/controllers/account_controller_test.exs48
1 files changed, 46 insertions, 2 deletions
diff --git a/test/web/mastodon_api/controllers/account_controller_test.exs b/test/web/mastodon_api/controllers/account_controller_test.exs
index 585cb8a9e..fa08ae4df 100644
--- a/test/web/mastodon_api/controllers/account_controller_test.exs
+++ b/test/web/mastodon_api/controllers/account_controller_test.exs
@@ -144,6 +144,50 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
end
describe "user timelines" do
+ test "respects blocks", %{conn: conn} do
+ user_one = insert(:user)
+ user_two = insert(:user)
+ user_three = insert(:user)
+
+ User.block(user_one, user_two)
+
+ {:ok, activity} = CommonAPI.post(user_two, %{"status" => "User one sux0rz"})
+ {:ok, repeat, _} = CommonAPI.repeat(activity.id, user_three)
+
+ resp =
+ conn
+ |> get("/api/v1/accounts/#{user_two.id}/statuses")
+
+ assert [%{"id" => id}] = json_response(resp, 200)
+ assert id == activity.id
+
+ # Even a blocked user will deliver the full user timeline, there would be
+ # no point in looking at a blocked users timeline otherwise
+ resp =
+ conn
+ |> assign(:user, user_one)
+ |> get("/api/v1/accounts/#{user_two.id}/statuses")
+
+ assert [%{"id" => id}] = json_response(resp, 200)
+ assert id == activity.id
+
+ resp =
+ conn
+ |> get("/api/v1/accounts/#{user_three.id}/statuses")
+
+ assert [%{"id" => id}] = json_response(resp, 200)
+ assert id == repeat.id
+
+ # When viewing a third user's timeline, the blocked users will NOT be
+ # shown.
+ resp =
+ conn
+ |> assign(:user, user_one)
+ |> get("/api/v1/accounts/#{user_three.id}/statuses")
+
+ assert [] = json_response(resp, 200)
+ end
+
test "gets a users statuses", %{conn: conn} do
user_one = insert(:user)
user_two = insert(:user)
@@ -891,7 +935,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
user = insert(:user)
other_user = insert(:user)
- {:ok, user} = User.mute(user, other_user)
+ {:ok, _user_relationships} = User.mute(user, other_user)
conn =
conn
@@ -906,7 +950,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
user = insert(:user)
other_user = insert(:user)
- {:ok, user} = User.block(user, other_user)
+ {:ok, _user_relationship} = User.block(user, other_user)
conn =
conn