From 7dcafb4894006bd9f531403fe585ec4938d4de12 Mon Sep 17 00:00:00 2001 From: lain Date: Mon, 7 Jan 2019 13:13:37 +0100 Subject: [PATCH] MastoAPI: Add test. --- .../mastodon_api_controller_test.exs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs index 0136acf8c..ce87010c8 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@ -1312,6 +1312,24 @@ test "search fetches remote statuses", %{conn: conn} 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