aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-04-29 14:53:53 +0200
committerlain <lain@soykaf.club>2020-04-29 14:53:53 +0200
commit20587aa931262a5479c98f13450311a135c5d356 (patch)
tree461eb6ed1b33a28a2452ad16c06693d71ac9b5c8 /test
parenta88734a0a22810bcc47c17fc9120ef7881d670d8 (diff)
downloadpleroma-20587aa931262a5479c98f13450311a135c5d356.tar.gz
Chat message creation: Check actor.
Diffstat (limited to 'test')
-rw-r--r--test/web/activity_pub/object_validator_test.exs13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/web/activity_pub/object_validator_test.exs b/test/web/activity_pub/object_validator_test.exs
index 41f67964a..475b7bb21 100644
--- a/test/web/activity_pub/object_validator_test.exs
+++ b/test/web/activity_pub/object_validator_test.exs
@@ -23,6 +23,19 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidatorTest do
assert {:object, {"The object to create already exists", []}} in cng.errors
end
+
+ test "it is invalid if the object data has a different `to` or `actor` field" do
+ user = insert(:user)
+ recipient = insert(:user)
+ {:ok, object_data, _} = Builder.chat_message(recipient, user.ap_id, "Hey")
+
+ {:ok, create_data, _} = Builder.create(user, object_data, [recipient.ap_id])
+
+ {:error, cng} = ObjectValidator.validate(create_data, [])
+
+ assert {:to, {"Recipients don't match with object recipients", []}} in cng.errors
+ assert {:actor, {"Actor doesn't match with object actor", []}} in cng.errors
+ end
end
describe "chat messages" do