aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-05-04 17:08:31 +0200
committerlain <lain@soykaf.club>2020-05-04 17:08:31 +0200
commite03c301ebeea6687ee7f19d447232864b182d581 (patch)
treedecfb2dd2c46c64e2277dc81e3b8de8c382cb755 /test
parent335aabc39c6384216d2eaa3036cea541141d8025 (diff)
downloadpleroma-e03c301ebeea6687ee7f19d447232864b182d581.tar.gz
LikeValidator: Fix up missing recipients.
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 3c5c3696e..9e9e41c6b 100644
--- a/test/web/activity_pub/object_validator_test.exs
+++ b/test/web/activity_pub/object_validator_test.exs
@@ -36,6 +36,19 @@ 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 "it errors when the actor is missing or not known", %{valid_like: valid_like} do
without_actor = Map.delete(valid_like, "actor")