Resolve merge conflict
[akkoma] / test / web / activity_pub / activity_pub_controller_test.exs
index 620e036748a4e00b20596dfb602f30507e55fade..7aed8c71d812f0278ebcc75e5d43eb50e011e614 100644 (file)
@@ -75,6 +75,44 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
 
       assert json_response(conn, 404)
     end
+
+    test "it returns 404 for tombstone objects", %{conn: conn} do
+      tombstone = insert(:tombstone)
+      uuid = String.split(tombstone.data["id"], "/") |> List.last()
+
+      conn =
+        conn
+        |> put_req_header("accept", "application/activity+json")
+        |> get("/objects/#{uuid}")
+
+      assert json_response(conn, 404)
+    end
+  end
+
+  describe "/activities/:uuid" do
+    test "it returns a json representation of the activity", %{conn: conn} do
+      activity = insert(:note_activity)
+      uuid = String.split(activity.data["id"], "/") |> List.last()
+
+      conn =
+        conn
+        |> put_req_header("accept", "application/activity+json")
+        |> get("/activities/#{uuid}")
+
+      assert json_response(conn, 200) == ObjectView.render("object.json", %{object: activity})
+    end
+
+    test "it returns 404 for non-public activities", %{conn: conn} do
+      activity = insert(:direct_note_activity)
+      uuid = String.split(activity.data["id"], "/") |> List.last()
+
+      conn =
+        conn
+        |> put_req_header("accept", "application/activity+json")
+        |> get("/activities/#{uuid}")
+
+      assert json_response(conn, 404)
+    end
   end
 
   describe "/inbox" do