diff options
author | lain <lain@soykaf.club> | 2019-01-28 13:07:12 +0100 |
---|---|---|
committer | lain <lain@soykaf.club> | 2019-01-28 13:07:12 +0100 |
commit | 8e8a1e1ba8a08bc297884fe085b4542a052d6d01 (patch) | |
tree | 61b6366190b1c01c9bcb753604b0779347bf0180 /test/web/twitter_api/util_controller_test.exs | |
parent | bcc559e4e61988c9d2c74dd407329b1a4c458400 (diff) | |
download | pleroma-8e8a1e1ba8a08bc297884fe085b4542a052d6d01.tar.gz pleroma-8e8a1e1ba8a08bc297884fe085b4542a052d6d01.zip |
Return new-style config if old-style config is set to false.
This is in preparation for 1.0. We'll be able to switch the config to the new
mechanism on PleromaFE then as well.
Diffstat (limited to 'test/web/twitter_api/util_controller_test.exs')
-rw-r--r-- | test/web/twitter_api/util_controller_test.exs | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/test/web/twitter_api/util_controller_test.exs b/test/web/twitter_api/util_controller_test.exs index c099db003..dc9bad369 100644 --- a/test/web/twitter_api/util_controller_test.exs +++ b/test/web/twitter_api/util_controller_test.exs @@ -33,7 +33,51 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do end end - describe "GET /api/pleroma/frontent_configurations" do + describe "GET /api/statusnet/config.json" do + test "it returns the managed config", %{conn: conn} do + Pleroma.Config.put([:instance, :managed_config], false) + + response = + conn + |> get("/api/statusnet/config.json") + |> json_response(:ok) + + refute response["site"]["pleromafe"] + + Pleroma.Config.put([:instance, :managed_config], true) + + response = + conn + |> get("/api/statusnet/config.json") + |> json_response(:ok) + + assert response["site"]["pleromafe"] + end + + test "if :pleroma, :fe is false, it returns the new style config settings", %{conn: conn} do + Pleroma.Config.put([:instance, :managed_config], true) + Pleroma.Config.put([:fe, :theme], "rei-ayanami-towel") + Pleroma.Config.put([:frontend_configurations, :pleroma_fe], %{theme: "asuka-hospital"}) + + response = + conn + |> get("/api/statusnet/config.json") + |> json_response(:ok) + + assert response["site"]["pleromafe"]["theme"] == "rei-ayanami-towel" + + Pleroma.Config.put([:fe], false) + + response = + conn + |> get("/api/statusnet/config.json") + |> json_response(:ok) + + assert response["site"]["pleromafe"]["theme"] == "asuka-hospital" + end + end + + describe "GET /api/pleroma/frontend_configurations" do test "returns everything in :pleroma, :frontend_configurations", %{conn: conn} do config = [ frontend_a: %{ |