summaryrefslogtreecommitdiff
path: root/test/object
diff options
context:
space:
mode:
authorMaksim Pechnikov <parallel588@gmail.com>2019-12-05 12:22:19 +0300
committerMaksim Pechnikov <parallel588@gmail.com>2019-12-05 12:22:19 +0300
commit49bb0a130f93476d32d3177d7a989b7a98a063f2 (patch)
tree6e64e2bbe2644dd607ec685de5b2bf94c1f9326c /test/object
parentb9041c209787dc279d4dc5194d65dff73684cdb9 (diff)
parent228bf4d214abe3bb62c52128d3bc145e396b174d (diff)
downloadpleroma-49bb0a130f93476d32d3177d7a989b7a98a063f2.tar.gz
pleroma-49bb0a130f93476d32d3177d7a989b7a98a063f2.zip
Merge branch 'develop' into issue/1276
Diffstat (limited to 'test/object')
-rw-r--r--test/object/containment_test.exs24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/object/containment_test.exs b/test/object/containment_test.exs
index 0dc2728b9..7636803a6 100644
--- a/test/object/containment_test.exs
+++ b/test/object/containment_test.exs
@@ -17,6 +17,16 @@ defmodule Pleroma.Object.ContainmentTest do
end
describe "general origin containment" do
+ test "works for completely actorless posts" do
+ assert :error ==
+ Containment.contain_origin("https://glaceon.social/users/monorail", %{
+ "deleted" => "2019-10-30T05:48:50.249606Z",
+ "formerType" => "Note",
+ "id" => "https://glaceon.social/users/monorail/statuses/103049757364029187",
+ "type" => "Tombstone"
+ })
+ end
+
test "contain_origin_from_id() catches obvious spoofing attempts" do
data = %{
"id" => "http://example.com/~alyssa/activities/1234.json"
@@ -67,6 +77,20 @@ defmodule Pleroma.Object.ContainmentTest do
end) =~
"[error] Could not decode user at fetch https://n1u.moe/users/rye"
end
+
+ test "contain_origin_from_id() gracefully handles cases where no ID is present" do
+ data = %{
+ "type" => "Create",
+ "object" => %{
+ "id" => "http://example.net/~alyssa/activities/1234",
+ "attributedTo" => "http://example.org/~alyssa"
+ },
+ "actor" => "http://example.com/~bob"
+ }
+
+ :error =
+ Containment.contain_origin_from_id("http://example.net/~alyssa/activities/1234", data)
+ end
end
describe "containment of children" do