Merge branch 'fix-streaming-reblog' into 'develop'
[akkoma] / test / web / mastodon_api / mastodon_api_controller_test.exs
index ec77b4656cf46e711e6261ab8452e3fefebf6a91..dad832a66a23181444803ca0fbb8e801f832440c 100644 (file)
@@ -96,6 +96,22 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
            |> json_response(403) == %{"error" => "This resource requires authentication."}
   end
 
+  test "the public timeline includes only public statuses for an authenticated user" do
+    user = insert(:user)
+
+    conn =
+      build_conn()
+      |> assign(:user, user)
+
+    {:ok, _activity} = CommonAPI.post(user, %{"status" => "test"})
+    {:ok, _activity} = CommonAPI.post(user, %{"status" => "test", "visibility" => "private"})
+    {:ok, _activity} = CommonAPI.post(user, %{"status" => "test", "visibility" => "unlisted"})
+    {:ok, _activity} = CommonAPI.post(user, %{"status" => "test", "visibility" => "direct"})
+
+    res_conn = get(conn, "/api/v1/timelines/public")
+    assert length(json_response(res_conn, 200)) == 1
+  end
+
   describe "posting statuses" do
     setup do
       user = insert(:user)
@@ -3856,7 +3872,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
       assert id == other_user.id
     end
 
-    test "requires authentifucation for private posts", %{conn: conn, user: user} do
+    test "requires authentification for private posts", %{conn: conn, user: user} do
       other_user = insert(:user)
 
       {:ok, activity} =