diff options
| author | lain <lain@soykaf.club> | 2020-05-04 19:24:04 +0200 |
|---|---|---|
| committer | lain <lain@soykaf.club> | 2020-05-04 19:24:04 +0200 |
| commit | c23cb8d37a44e4b9ff09655e452122235ded1d84 (patch) | |
| tree | c9cbde41367e54910d0dad9e86239a58a4077458 /test/web/activity_pub/object_validator_test.exs | |
| parent | 7ff2a7dae2fa651cea579aeca40e2c030d19fcd5 (diff) | |
| parent | 378ab2db97843112523985ca72b427702d50fe58 (diff) | |
| download | pleroma-c23cb8d37a44e4b9ff09655e452122235ded1d84.tar.gz pleroma-c23cb8d37a44e4b9ff09655e452122235ded1d84.zip | |
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into remake-remodel-dms
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 475b7bb21..60db7187f 100644 --- a/test/web/activity_pub/object_validator_test.exs +++ b/test/web/activity_pub/object_validator_test.exs @@ -136,6 +136,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") |
