From bc36d40bee790c57d8e422d75c1999bdc8f4c031 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Thu, 23 Aug 2018 00:55:41 +0000 Subject: [PATCH] tests: add a testcase for verifying that objects without a valid ID are always rejected --- test/web/activity_pub/transmogrifier_test.exs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs index e455da39f..e2926d495 100644 --- a/test/web/activity_pub/transmogrifier_test.exs +++ b/test/web/activity_pub/transmogrifier_test.exs @@ -615,6 +615,18 @@ test "it works for incoming rejects which are referenced by IRI only" 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