Test that only author can reblog a private status
authorEgor Kislitsyn <egor@kislitsyn.com>
Mon, 18 Jan 2021 17:01:00 +0000 (21:01 +0400)
committerEgor Kislitsyn <egor@kislitsyn.com>
Mon, 18 Jan 2021 17:01:00 +0000 (21:01 +0400)
test/pleroma/web/common_api_test.exs

index 2f7dc38e41f89e87413768a5f9c479fdcc471e80..7067f1b59092ac9a840bf28be2331fce74a3afca 100644 (file)
@@ -745,14 +745,19 @@ defmodule Pleroma.Web.CommonAPITest 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