summaryrefslogtreecommitdiff
path: root/test/object
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2019-12-04 16:35:59 +0100
committerlain <lain@soykaf.club>2019-12-04 16:35:59 +0100
commite9993acdbbd1649bbcbf3fb36581b91145fe6055 (patch)
treeb78d91c904e307a504ed91a06ab718d8c694ca5c /test/object
parent1bd1f62af55e01613e6362661b36a19091c87424 (diff)
parent228bf4d214abe3bb62c52128d3bc145e396b174d (diff)
downloadpleroma-e9993acdbbd1649bbcbf3fb36581b91145fe6055.tar.gz
pleroma-e9993acdbbd1649bbcbf3fb36581b91145fe6055.zip
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into remake-remodel
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