From 51d5951c022c401c767924bab97854c8f2143089 Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Mon, 18 Jan 2021 21:01:00 +0400 Subject: [PATCH] Test that only author can reblog a private status --- test/pleroma/web/common_api_test.exs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs index 2f7dc38e4..7067f1b59 100644 --- a/test/pleroma/web/common_api_test.exs +++ b/test/pleroma/web/common_api_test.exs @@ -745,14 +745,19 @@ test "repeating a status privately" do end test "author can repeat own private statuses" do - user = insert(:user) + author = insert(:user) + follower = insert(:user) + CommonAPI.follow(follower, author) - {:ok, activity} = CommonAPI.post(user, %{status: "cofe", visibility: "private"}) + {:ok, activity} = CommonAPI.post(author, %{status: "cofe", visibility: "private"}) - {:ok, %Activity{} = announce_activity} = CommonAPI.repeat(activity.id, user) + {:ok, %Activity{} = announce_activity} = CommonAPI.repeat(activity.id, author) assert Visibility.is_private?(announce_activity) refute Visibility.visible_for_user?(announce_activity, nil) + + assert Visibility.visible_for_user?(activity, follower) + assert {:error, :not_found} = CommonAPI.repeat(activity.id, follower) end test "favoriting a status" do