tests: add a testcase for verifying that objects without a valid ID are always rejected
authorWilliam Pitcock <nenolod@dereferenced.org>
Thu, 23 Aug 2018 00:55:41 +0000 (00:55 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Thu, 23 Aug 2018 01:25:27 +0000 (01:25 +0000)
test/web/activity_pub/transmogrifier_test.exs

index e455da39f88d1a2e0fde5470a081b415743fd792..e2926d49535ba07480311f0a0212790717d268d7 100644 (file)
@@ -615,6 +615,18 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
 
       assert User.following?(follower, followed) == false
     end
+
+    test "it rejects activities without a valid ID" do
+      user = insert(:user)
+
+      data =
+        File.read!("test/fixtures/mastodon-follow-activity.json")
+        |> Poison.decode!()
+        |> Map.put("object", user.ap_id)
+        |> Map.put("id", "")
+
+      :error = Transmogrifier.handle_incoming(data)
+    end
   end
 
   describe "prepare outgoing" do