summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTusooa Zhu <tusooa@kazv.moe>2022-05-29 11:36:00 -0400
committerTusooa Zhu <tusooa@kazv.moe>2022-05-29 11:36:00 -0400
commit547def67a76854aa4c9c8438eb1ee4dfa36fd8ac (patch)
tree388fbe3389b10c641c878fa4cf7b2272d65bf18c /test
parent7466136ad3288cc2b442495d40af6e0787b250fb (diff)
downloadpleroma-547def67a76854aa4c9c8438eb1ee4dfa36fd8ac.tar.gz
pleroma-547def67a76854aa4c9c8438eb1ee4dfa36fd8ac.zip
Allow Updates by every actor on the same origin
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/web/activity_pub/object_validators/update_handling_test.exs24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/pleroma/web/activity_pub/object_validators/update_handling_test.exs b/test/pleroma/web/activity_pub/object_validators/update_handling_test.exs
index 94bc5a89b..f2a22d370 100644
--- a/test/pleroma/web/activity_pub/object_validators/update_handling_test.exs
+++ b/test/pleroma/web/activity_pub/object_validators/update_handling_test.exs
@@ -32,7 +32,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.UpdateHandlingTest do
test "returns an error if the object can't be updated by the actor", %{
valid_update: valid_update
} do
- other_user = insert(:user)
+ other_user = insert(:user, local: false)
update =
valid_update
@@ -40,5 +40,27 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.UpdateHandlingTest do
assert {:error, _cng} = ObjectValidator.validate(update, [])
end
+
+ test "validates as long as the object is same-origin with the actor", %{
+ valid_update: valid_update
+ } do
+ other_user = insert(:user)
+
+ update =
+ valid_update
+ |> Map.put("actor", other_user.ap_id)
+
+ assert {:ok, _update, []} = ObjectValidator.validate(update, [])
+ end
+
+ test "validates if the object is not of an Actor type" do
+ note = insert(:note)
+ updated_note = note.data |> Map.put("content", "edited content")
+ other_user = insert(:user)
+
+ {:ok, update, _} = Builder.update(other_user, updated_note)
+
+ assert {:ok, _update, []} = ObjectValidator.validate(update, [])
+ end
end
end