Mastodon API: do not create a following relationship if the corresponding follow...
[akkoma] / test / web / common_api / common_api_test.exs
index b80523160eca66bdf4f85d05c3cf44874a332396..9b7fce3a0900b39d905842a113775f8eb4ff57f8 100644 (file)
@@ -640,6 +640,14 @@ defmodule Pleroma.Web.CommonAPITest do
       assert Repo.get(Activity, follow_activity_two.id).data["state"] == "reject"
       assert Repo.get(Activity, follow_activity_three.id).data["state"] == "pending"
     end
+
+    test "doesn't create a following relationship if the corresponding follow request doesn't exist" do
+      user = insert(:user, locked: true)
+      not_follower = insert(:user)
+      CommonAPI.accept_follow_request(not_follower, user)
+
+      assert Pleroma.FollowingRelationship.following?(not_follower, user) == false
+    end
   end
 
   describe "vote/3" do