X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Ftwitter_api%2Ftwitter_api_controller_test.exs;h=bcd0f522d5c9b8edf2e3d13fad9300416bf37aa5;hb=e706b42f519fe754af980fc758be492b24e3ccde;hp=e194f14fb55a80a62493582701cd664eae7f1554;hpb=f3e8f5b1f208b10130c7123e68af1e38575f180b;p=akkoma diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs index e194f14fb..bcd0f522d 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -144,41 +144,25 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do end test "returns 403 to unauthenticated request when the instance is not public", %{conn: conn} do - instance = - Application.get_env(:pleroma, :instance) - |> Keyword.put(:public, false) - - Application.put_env(:pleroma, :instance, instance) + Pleroma.Config.put([:instance, :public], false) conn |> get("/api/statuses/public_timeline.json") |> json_response(403) - instance = - Application.get_env(:pleroma, :instance) - |> Keyword.put(:public, true) - - Application.put_env(:pleroma, :instance, instance) + Pleroma.Config.put([:instance, :public], true) end test "returns 200 to authenticated request when the instance is not public", %{conn: conn, user: user} do - instance = - Application.get_env(:pleroma, :instance) - |> Keyword.put(:public, false) - - Application.put_env(:pleroma, :instance, instance) + Pleroma.Config.put([:instance, :public], false) conn |> with_credentials(user.nickname, "test") |> get("/api/statuses/public_timeline.json") |> json_response(200) - instance = - Application.get_env(:pleroma, :instance) - |> Keyword.put(:public, true) - - Application.put_env(:pleroma, :instance, instance) + Pleroma.Config.put([:instance, :public], true) end test "returns 200 to unauthenticated request when the instance is public", %{conn: conn} do @@ -214,41 +198,25 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do setup [:valid_user] test "returns 403 to unauthenticated request when the instance is not public", %{conn: conn} do - instance = - Application.get_env(:pleroma, :instance) - |> Keyword.put(:public, false) - - Application.put_env(:pleroma, :instance, instance) + Pleroma.Config.put([:instance, :public], false) conn |> get("/api/statuses/public_and_external_timeline.json") |> json_response(403) - instance = - Application.get_env(:pleroma, :instance) - |> Keyword.put(:public, true) - - Application.put_env(:pleroma, :instance, instance) + Pleroma.Config.put([:instance, :public], true) end test "returns 200 to authenticated request when the instance is not public", %{conn: conn, user: user} do - instance = - Application.get_env(:pleroma, :instance) - |> Keyword.put(:public, false) - - Application.put_env(:pleroma, :instance, instance) + Pleroma.Config.put([:instance, :public], false) conn |> with_credentials(user.nickname, "test") |> get("/api/statuses/public_and_external_timeline.json") |> json_response(200) - instance = - Application.get_env(:pleroma, :instance) - |> Keyword.put(:public, true) - - Application.put_env(:pleroma, :instance, instance) + Pleroma.Config.put([:instance, :public], true) end test "returns 200 to unauthenticated request when the instance is public", %{conn: conn} do