update tests
[akkoma] / test / web / activity_pub / activity_pub_controller_test.exs
index 77f5e39faab586fea0496258827b15fbb0c6c456..5192e734f7246be87efc138469ea9810c6bc1247 100644 (file)
@@ -10,6 +10,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
   alias Pleroma.Object
   alias Pleroma.User
   alias Pleroma.Web.ActivityPub.ObjectView
+  alias Pleroma.Web.ActivityPub.Relay
   alias Pleroma.Web.ActivityPub.UserView
   alias Pleroma.Web.ActivityPub.Utils
   alias Pleroma.Web.CommonAPI
@@ -593,6 +594,34 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
     end
   end
 
+  describe "/relay/followers" do
+    test "it returns relay followers", %{conn: conn} do
+      relay_actor = Relay.get_actor()
+      user = insert(:user)
+      User.follow(user, relay_actor)
+
+      result =
+        conn
+        |> assign(:relay, true)
+        |> get("/relay/followers")
+        |> json_response(200)
+
+      assert result["first"]["orderedItems"] == [user.ap_id]
+    end
+  end
+
+  describe "/relay/following" do
+    test "it returns relay following", %{conn: conn} do
+      result =
+        conn
+        |> assign(:relay, true)
+        |> get("/relay/following")
+        |> json_response(200)
+
+      assert result["first"]["orderedItems"] == []
+    end
+  end
+
   describe "/users/:nickname/followers" do
     test "it returns the followers in a collection", %{conn: conn} do
       user = insert(:user)