diff options
author | lain <lain@soykaf.club> | 2020-05-05 10:19:01 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-05-05 10:19:01 +0200 |
commit | 2cb3f8a8cf4e34f2667d7b505b7fae7c9cb194dd (patch) | |
tree | f5846e26dca69d92cee8a4393f9888b0a250bd53 /test/web/activity_pub/object_validator_test.exs | |
parent | 1974d0cc423efefcbdadd68442d0fbed8f3ee4ab (diff) | |
parent | b1c29e2de8a02ef3093387c1454d290a92fbdef8 (diff) | |
download | pleroma-2cb3f8a8cf4e34f2667d7b505b7fae7c9cb194dd.tar.gz pleroma-2cb3f8a8cf4e34f2667d7b505b7fae7c9cb194dd.zip |
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into feature/delete-validator
Diffstat (limited to 'test/web/activity_pub/object_validator_test.exs')
-rw-r--r-- | test/web/activity_pub/object_validator_test.exs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/web/activity_pub/object_validator_test.exs b/test/web/activity_pub/object_validator_test.exs index 7ab1c8ffb..744c46781 100644 --- a/test/web/activity_pub/object_validator_test.exs +++ b/test/web/activity_pub/object_validator_test.exs @@ -130,6 +130,32 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidatorTest do assert LikeValidator.cast_and_validate(valid_like).valid? end + test "sets the 'to' field to the object actor if no recipients are given", %{ + valid_like: valid_like, + user: user + } do + without_recipients = + valid_like + |> Map.delete("to") + + {:ok, object, _meta} = ObjectValidator.validate(without_recipients, []) + + assert object["to"] == [user.ap_id] + end + + test "sets the context field to the context of the object if no context is given", %{ + valid_like: valid_like, + post_activity: post_activity + } do + without_context = + valid_like + |> Map.delete("context") + + {:ok, object, _meta} = ObjectValidator.validate(without_context, []) + + assert object["context"] == post_activity.data["context"] + end + test "it errors when the actor is missing or not known", %{valid_like: valid_like} do without_actor = Map.delete(valid_like, "actor") |