Verified Commit 00523bdf authored by Alex Gleason's avatar Alex Gleason
Browse files

Test pinned private statuses in AccountController

parent 88c21b92
......@@ -5,7 +5,9 @@
defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
use Pleroma.Web.ConnCase
alias Pleroma.Object
alias Pleroma.Repo
alias Pleroma.Tests.ObanHelpers
alias Pleroma.User
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.InternalFetchActor
......@@ -404,15 +406,6 @@ test "gets users statuses", %{conn: conn} do
assert id_two == to_string(
test "unimplemented pinned statuses feature", %{conn: conn} do
note = insert(:note_activity)
user = User.get_cached_by_ap_id(["actor"])
conn = get(conn, "/api/v1/accounts/#{}/statuses?pinned=true")
assert json_response_and_validate_schema(conn, 200) == []
test "gets an users media, excludes reblogs", %{conn: conn} do
note = insert(:note_activity)
user = User.get_cached_by_ap_id(["actor"])
......@@ -1038,6 +1031,35 @@ test "returns pinned statuses", %{conn: conn, user: user, activity: %{id: activi
test "view pinned private statuses" do
user = insert(:user)
reader = insert(:user)
# Create a private status and pin it
{:ok, %{id: activity_id} = activity} =, %{status: "psst", visibility: "private"})
%{data: %{"id" => object_ap_id}} = Object.normalize(activity)
{:ok, _} = User.add_pinned_object_id(user, object_ap_id)
%{conn: conn} = oauth_access(["read:statuses"], user: reader)
# A non-follower can't see the pinned status
assert [] ==
|> get("/api/v1/accounts/#{}/statuses?pinned=true")
|> json_response_and_validate_schema(200)
# Follow the user, then the pinned status can be seen
CommonAPI.follow(reader, user)
assert [%{"id" => ^activity_id, "pinned" => true}] =
|> get("/api/v1/accounts/#{}/statuses?pinned=true")
|> json_response_and_validate_schema(200)
test "blocking / unblocking a user" do
%{conn: conn} = oauth_access(["follow"])
other_user = insert(:user)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment