Refactor User.post_register_action/1 emails
[akkoma] / test / web / activity_pub / object_validators / accept_validation_test.exs
index 7f5dc14affbf51344a9703d011fef46ba84b7463..d6111ba414c498362bd466bcd771f3d46ab43be9 100644 (file)
@@ -4,9 +4,10 @@
 
 defmodule Pleroma.Web.ActivityPub.ObjectValidators.AcceptValidationTest do
   use Pleroma.DataCase
+
   alias Pleroma.Web.ActivityPub.Builder
-  alias Pleroma.Web.ActivityPub.Pipeline
   alias Pleroma.Web.ActivityPub.ObjectValidator
+  alias Pleroma.Web.ActivityPub.Pipeline
 
   import Pleroma.Factory
 
@@ -41,4 +42,15 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AcceptValidationTest do
 
     assert {:error, _} = ObjectValidator.validate(accept_data, [])
   end
+
+  test "for an accepted follow, it only validates if the actor of the accept is the followed actor",
+       %{accept_data: accept_data} do
+    stranger = insert(:user)
+
+    accept_data =
+      accept_data
+      |> Map.put("actor", stranger.ap_id)
+
+    assert {:error, _} = ObjectValidator.validate(accept_data, [])
+  end
 end