Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into remake-remodel-dms
[akkoma] / test / web / activity_pub / object_validator_test.exs
index bf0bfdfaf4d97b1babc12316674197e0f8df6049..3ac5ecaf4ae6573949644f0921a477684092f6e0 100644 (file)
@@ -1,16 +1,17 @@
 defmodule Pleroma.Web.ActivityPub.ObjectValidatorTest do
   use Pleroma.DataCase
 
+  alias Pleroma.Web.ActivityPub.Builder
   alias Pleroma.Web.ActivityPub.ObjectValidator
   alias Pleroma.Web.ActivityPub.ObjectValidators.LikeValidator
   alias Pleroma.Web.ActivityPub.Utils
   alias Pleroma.Web.CommonAPI
-  alias Pleroma.Web.ActivityPub.Builder
 
   import Pleroma.Factory
 
   describe "chat messages" do
     setup do
+      clear_config([:instance, :remote_limit])
       user = insert(:user)
       recipient = insert(:user, local: false)
 
@@ -23,6 +24,13 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidatorTest do
       assert {:ok, _object, _meta} = ObjectValidator.validate(valid_chat_message, [])
     end
 
+    test "does not validate if the message is longer than the remote_limit", %{
+      valid_chat_message: valid_chat_message
+    } do
+      Pleroma.Config.put([:instance, :remote_limit], 2)
+      refute match?({:ok, _object, _meta}, ObjectValidator.validate(valid_chat_message, []))
+    end
+
     test "does not validate if the actor or the recipient is not in our system", %{
       valid_chat_message: valid_chat_message
     } do