diff options
author | lain <lain@soykaf.club> | 2020-08-13 15:37:42 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-08-13 15:37:42 +0200 |
commit | 57ab69870708b6982f45453121dbaec212ad4e6e (patch) | |
tree | 9139fc08d2b653a7fea8fb97613eacb8509228f0 /test | |
parent | 2bc2b321b6b56cbb50b484181042ccaae3d8707c (diff) | |
download | pleroma-57ab69870708b6982f45453121dbaec212ad4e6e.tar.gz |
UpdateValidator: Allow updating of your own objects.
Diffstat (limited to 'test')
-rw-r--r-- | test/web/activity_pub/object_validators/update_validation_test.exs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/web/activity_pub/object_validators/update_validation_test.exs b/test/web/activity_pub/object_validators/update_validation_test.exs index 5e80cf731..377aab841 100644 --- a/test/web/activity_pub/object_validators/update_validation_test.exs +++ b/test/web/activity_pub/object_validators/update_validation_test.exs @@ -5,8 +5,10 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.UpdateHandlingTest do use Pleroma.DataCase + alias Pleroma.Object alias Pleroma.Web.ActivityPub.Builder alias Pleroma.Web.ActivityPub.ObjectValidator + alias Pleroma.Web.CommonAPI import Pleroma.Factory @@ -40,5 +42,19 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.UpdateHandlingTest do assert {:error, _cng} = ObjectValidator.validate(update, []) end + + test "validates a user updating their own note", %{user: user} do + {:ok, activity} = CommonAPI.post(user, %{status: "I love cafe"}) + + object = Object.normalize(activity) + + updated_object = + object.data + |> Map.put("content", "I love cofe") + + {:ok, update, []} = Builder.update(user, updated_object) + + assert {ok, _update, []} = ObjectValidator.validate(update, []) + end end end |