1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ActivityPub.ObjectValidators.UpdateHandlingTest do
6 use Pleroma.DataCase, async: true
8 alias Pleroma.Web.ActivityPub.Builder
9 alias Pleroma.Web.ActivityPub.ObjectValidator
11 import Pleroma.Factory
19 "name" => "A new name",
20 "summary" => "A new bio"
23 {:ok, valid_update, []} = Builder.update(user, object)
25 %{user: user, valid_update: valid_update}
28 test "validates a basic object", %{valid_update: valid_update} do
29 assert {:ok, _update, []} = ObjectValidator.validate(valid_update, [])
32 test "returns an error if the object can't be updated by the actor", %{
33 valid_update: valid_update
35 other_user = insert(:user)
39 |> Map.put("actor", other_user.ap_id)
41 assert {:error, _cng} = ObjectValidator.validate(update, [])