diff options
Diffstat (limited to 'test/web/mastodon_api')
| -rw-r--r-- | test/web/mastodon_api/mastodon_api_controller_test.exs | 25 | 
1 files changed, 19 insertions, 6 deletions
| diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs index 5c79ee633..cbff141c8 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@ -81,6 +81,19 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do      end)    end +  test "the public timeline when public is set to false", %{conn: conn} do +    public = Pleroma.Config.get([:instance, :public]) +    Pleroma.Config.put([:instance, :public], false) + +    on_exit(fn -> +      Pleroma.Config.put([:instance, :public], public) +    end) + +    assert conn +           |> get("/api/v1/timelines/public", %{"local" => "False"}) +           |> json_response(403) == %{"error" => "This resource requires authentication."} +  end +    test "posting a status", %{conn: conn} do      user = insert(:user) @@ -433,7 +446,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do    end    test "verify_credentials default scope unlisted", %{conn: conn} do -    user = insert(:user, %{info: %Pleroma.User.Info{default_scope: "unlisted"}}) +    user = insert(:user, %{info: %User.Info{default_scope: "unlisted"}})      conn =        conn @@ -1309,7 +1322,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do    describe "locked accounts" do      test "/api/v1/follow_requests works" do -      user = insert(:user, %{info: %Pleroma.User.Info{locked: true}}) +      user = insert(:user, %{info: %User.Info{locked: true}})        other_user = insert(:user)        {:ok, _activity} = ActivityPub.follow(other_user, user) @@ -1354,7 +1367,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do      end      test "verify_credentials", %{conn: conn} do -      user = insert(:user, %{info: %Pleroma.User.Info{default_scope: "private"}}) +      user = insert(:user, %{info: %User.Info{default_scope: "private"}})        conn =          conn @@ -1366,7 +1379,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do      end      test "/api/v1/follow_requests/:id/reject works" do -      user = insert(:user, %{info: %Pleroma.User.Info{locked: true}}) +      user = insert(:user, %{info: %User.Info{locked: true}})        other_user = insert(:user)        {:ok, _activity} = ActivityPub.follow(other_user, user) @@ -2116,7 +2129,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do          |> get("/api/v1/pleroma/accounts/#{user.id}/favourites")          |> json_response(:ok) -      assert length(anonymous_response) == 0 +      assert Enum.empty?(anonymous_response)      end      test "does not return others' favorited DM when user is not one of recipients", %{ @@ -2140,7 +2153,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do          |> get("/api/v1/pleroma/accounts/#{user.id}/favourites")          |> json_response(:ok) -      assert length(response) == 0 +      assert Enum.empty?(response)      end      test "paginates favorites using since_id and max_id", %{ | 
