LikeValidator: Fix up context.

This commit is contained in:
lain 2020-05-04 17:18:17 +02:00
commit 0f9bed022f
2 changed files with 29 additions and 2 deletions

View file

@ -49,6 +49,19 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidatorTest do
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")