diff options
| author | Maksim Pechnikov <parallel588@gmail.com> | 2020-05-06 05:55:39 +0300 |
|---|---|---|
| committer | Maksim Pechnikov <parallel588@gmail.com> | 2020-05-06 05:55:39 +0300 |
| commit | fb38b7339ccb6c3d7a3a07b74a6471a0f38622fe (patch) | |
| tree | a6dc7761d53a37be6a1c46af1c3cbc8873ce50d8 /test/web/activity_pub/object_validator_test.exs | |
| parent | fe7a0d660e357a03558be3a95ddbb8b409ef9a9e (diff) | |
| parent | 7612d9403dbaa6741b28dcf427ecad8fd0f70c30 (diff) | |
| download | pleroma-fb38b7339ccb6c3d7a3a07b74a6471a0f38622fe.tar.gz pleroma-fb38b7339ccb6c3d7a3a07b74a6471a0f38622fe.zip | |
Merge branch 'develop' into issue/1276-2
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 3c5c3696e..93989e28a 100644 --- a/test/web/activity_pub/object_validator_test.exs +++ b/test/web/activity_pub/object_validator_test.exs @@ -36,6 +36,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") |
