summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-06-19 16:38:57 +0200
committerlain <lain@soykaf.club>2020-06-19 16:38:57 +0200
commit75670a99e46a09f9bddc0959c680c2cb173e1f3b (patch)
tree004727060c5d165f43ba537e5de67fcb1e179f66 /test
parentabdb540d450b5e68ea452f78d865d63bca764a49 (diff)
downloadpleroma-75670a99e46a09f9bddc0959c680c2cb173e1f3b.tar.gz
pleroma-75670a99e46a09f9bddc0959c680c2cb173e1f3b.zip
UpdateValidator: Only allow updates from the user themselves.
Diffstat (limited to 'test')
-rw-r--r--test/web/activity_pub/object_validator_test.exs12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/web/activity_pub/object_validator_test.exs b/test/web/activity_pub/object_validator_test.exs
index adb56092d..770a8dcf8 100644
--- a/test/web/activity_pub/object_validator_test.exs
+++ b/test/web/activity_pub/object_validator_test.exs
@@ -641,5 +641,17 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidatorTest do
test "validates a basic object", %{valid_update: valid_update} do
assert {:ok, _update, []} = ObjectValidator.validate(valid_update, [])
end
+
+ test "returns an error if the object can't be updated by the actor", %{
+ valid_update: valid_update
+ } do
+ other_user = insert(:user)
+
+ update =
+ valid_update
+ |> Map.put("actor", other_user.ap_id)
+
+ assert {:error, _cng} = ObjectValidator.validate(update, [])
+ end
end
end