MastoAPI: Add test.
authorlain <lain@soykaf.club>
Mon, 7 Jan 2019 12:13:37 +0000 (13:13 +0100)
committerlain <lain@soykaf.club>
Mon, 7 Jan 2019 12:13:37 +0000 (13:13 +0100)
test/web/mastodon_api/mastodon_api_controller_test.exs

index 0136acf8cdfcdfe5e12152c1075d5152be6ce020..ce87010c8edcc112cab849db5ecb17e7eb904a96 100644 (file)
@@ -1312,6 +1312,24 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
     end)
   end
 
+  test "search doesn't show statuses that it shouldn't", %{conn: conn} do
+    {:ok, activity} =
+      CommonAPI.post(insert(:user), %{
+        "status" => "This is about 2hu, but private",
+        "visibility" => "private"
+      })
+
+    capture_log(fn ->
+      conn =
+        conn
+        |> get("/api/v1/search", %{"q" => activity.data["object"]["id"]})
+
+      assert results = json_response(conn, 200)
+
+      [] = results["statuses"]
+    end)
+  end
+
   test "search fetches remote accounts", %{conn: conn} do
     conn =
       conn