summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-07-03 15:13:27 +0200
committerlain <lain@soykaf.club>2020-07-03 15:13:27 +0200
commit4a7b89e37217af4d98746bb934b8264d7a8de51d (patch)
tree6577ba0f539ba1acbf097c5cbe90a920146851cb /test
parent3ca9af1f9fef081830820b5bea90f789e460b83a (diff)
downloadpleroma-4a7b89e37217af4d98746bb934b8264d7a8de51d.tar.gz
pleroma-4a7b89e37217af4d98746bb934b8264d7a8de51d.zip
ChatMessageValidator: Additional validation.
Diffstat (limited to 'test')
-rw-r--r--test/web/activity_pub/object_validator_test.exs11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/web/activity_pub/object_validator_test.exs b/test/web/activity_pub/object_validator_test.exs
index f38bf7e08..c1a872297 100644
--- a/test/web/activity_pub/object_validator_test.exs
+++ b/test/web/activity_pub/object_validator_test.exs
@@ -223,6 +223,17 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidatorTest do
refute match?({:ok, _object, _meta}, ObjectValidator.validate(valid_chat_message, []))
end
+ test "does not validate if the recipient is not accepting chat messages", %{
+ valid_chat_message: valid_chat_message,
+ recipient: recipient
+ } do
+ recipient
+ |> Ecto.Changeset.change(%{accepts_chat_messages: false})
+ |> Pleroma.Repo.update!()
+
+ 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