Capitalize "tombstone"
[akkoma] / test / web / activity_pub / activity_pub_controller_test.exs
index 980f43553b6810e9ffd2616fbbfa273f7a1d1053..faeace0160022167c2efb69e4e3ca69a428a44fa 100644 (file)
@@ -23,10 +23,10 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
     test "with the relay disabled, it returns 404", %{conn: conn} do
       Pleroma.Config.put([:instance, :allow_relay], false)
 
-      res =
-        conn
-        |> get(activity_pub_path(conn, :relay))
-        |> json_response(404)
+      conn
+      |> get(activity_pub_path(conn, :relay))
+      |> json_response(404)
+      |> assert
 
       Pleroma.Config.put([:instance, :allow_relay], true)
     end
@@ -150,6 +150,20 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
       assert result["first"]["orderedItems"] == [user.ap_id]
     end
 
+    test "it returns returns empty if the user has 'hide_network' set", %{conn: conn} do
+      user = insert(:user)
+      user_two = insert(:user, %{info: %{hide_network: true}})
+      User.follow(user, user_two)
+
+      result =
+        conn
+        |> get("/users/#{user_two.nickname}/followers")
+        |> json_response(200)
+
+      assert result["first"]["orderedItems"] == []
+      assert result["totalItems"] == 1
+    end
+
     test "it works for more than 10 users", %{conn: conn} do
       user = insert(:user)
 
@@ -191,6 +205,20 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
       assert result["first"]["orderedItems"] == [user_two.ap_id]
     end
 
+    test "it returns returns empty if the user has 'hide_network' set", %{conn: conn} do
+      user = insert(:user, %{info: %{hide_network: true}})
+      user_two = insert(:user)
+      User.follow(user, user_two)
+
+      result =
+        conn
+        |> get("/users/#{user.nickname}/following")
+        |> json_response(200)
+
+      assert result["first"]["orderedItems"] == []
+      assert result["totalItems"] == 1
+    end
+
     test "it works for more than 10 users", %{conn: conn} do
       user = insert(:user)